#!/usr/bin/env python3 """ Test script to verify logo switching logic without PyQt5 """ import os import sys # Add project root to path sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from themes.theme_config import ThemeConfig def test_logo_paths(): """Test that logo paths are correctly configured.""" print("=" * 60) print("LOGO SWITCHING TEST") print("=" * 60) # Test light theme logo light_theme = ThemeConfig.get_theme('light') light_logo = light_theme.get('logo_path', 'NOT_FOUND') print(f"\n✓ Light theme logo: {light_logo}") # Test dark theme logo dark_theme = ThemeConfig.get_theme('dark') dark_logo = dark_theme.get('logo_path', 'NOT_FOUND') print(f"✓ Dark theme logo: {dark_logo}") # Check if files exist base_dir = os.path.dirname(os.path.abspath(__file__)) light_path = os.path.join(base_dir, "resources", "icons", light_logo) dark_path = os.path.join(base_dir, "resources", "icons", dark_logo) print(f"\n✓ Light logo exists: {os.path.exists(light_path)} ({light_path})") print(f"✓ Dark logo exists: {os.path.exists(dark_path)} ({dark_path})") # Simulate theme manager logic print("\n" + "=" * 60) print("SIMULATING THEME MANAGER LOGIC") print("=" * 60) class MockThemeManager: def __init__(self): self.base_dir = base_dir self.current_theme = 'light' def get_icon_path(self, icon_name): if icon_name == "intelsight-logo": theme = ThemeConfig.get_theme(self.current_theme) logo_name = theme.get('logo_path', 'intelsight-logo.svg').replace('.svg', '') return os.path.join(self.base_dir, "resources", "icons", f"{logo_name}.svg") return os.path.join(self.base_dir, "resources", "icons", f"{icon_name}.svg") tm = MockThemeManager() # Test light theme tm.current_theme = 'light' light_result = tm.get_icon_path("intelsight-logo") print(f"\nLight theme path: {light_result}") print(f"File exists: {os.path.exists(light_result)}") # Test dark theme tm.current_theme = 'dark' dark_result = tm.get_icon_path("intelsight-logo") print(f"\nDark theme path: {dark_result}") print(f"File exists: {os.path.exists(dark_result)}") # Check if paths are different if light_result != dark_result: print("\n✅ SUCCESS: Different logos for different themes!") else: print("\n❌ ERROR: Same logo path for both themes!") return False # Check actual file names if "intelsight-logo" in light_result and "intelsight-dark" in dark_result: print("✅ SUCCESS: Correct logo files selected!") else: print("❌ ERROR: Wrong logo files!") return False return True if __name__ == "__main__": success = test_logo_paths() sys.exit(0 if success else 1)