55 lines
1.6 KiB
Python
Executable File
55 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Test script for Launch Agent functionality.
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
|
|
# Add src directory to path
|
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'src'))
|
|
|
|
from launch_agent import get_launch_agent_manager
|
|
from logging_config import setup_logging, get_logger
|
|
|
|
def test_launch_agent():
|
|
"""Test the launch agent functionality"""
|
|
setup_logging(debug=True)
|
|
logger = get_logger(__name__)
|
|
|
|
print("🧪 Testing Launch Agent Functionality")
|
|
print("=" * 40)
|
|
|
|
# Get launch agent manager
|
|
manager = get_launch_agent_manager()
|
|
|
|
# Check current status
|
|
is_enabled = manager.is_startup_enabled()
|
|
print(f"📋 Current startup status: {'Enabled' if is_enabled else 'Disabled'}")
|
|
|
|
if is_enabled:
|
|
info = manager.get_launch_agent_info()
|
|
if info:
|
|
print(f"📂 Plist path: {info['path']}")
|
|
print(f"🚀 Program: {' '.join(info['program_arguments'])}")
|
|
|
|
# Test app path detection
|
|
app_path = manager.get_app_path()
|
|
print(f"📱 Detected app path: {app_path}")
|
|
|
|
# Test plist creation (don't install it)
|
|
plist_data = manager.create_launch_agent_plist()
|
|
print(f"📄 Generated plist data:")
|
|
for key, value in plist_data.items():
|
|
print(f" {key}: {value}")
|
|
|
|
print("\n✅ Launch Agent test completed!")
|
|
print("\nTo test startup functionality:")
|
|
print("1. Build the app: ./build_app.sh")
|
|
print("2. Run the app and go to Options")
|
|
print("3. Enable 'Launch at Startup'")
|
|
print("4. Log out and back in to test")
|
|
|
|
if __name__ == "__main__":
|
|
test_launch_agent()
|