-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_migration.py
More file actions
150 lines (113 loc) · 3.77 KB
/
test_migration.py
File metadata and controls
150 lines (113 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/env python3
"""
Test script to verify the QDarkStyleSheet migration works correctly.
"""
import os
import sys
# Add the current directory to the path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
def test_imports():
"""Test that all required imports work."""
print("🧪 Testing imports...")
try:
import qdarkstyle # noqa: F401
print(" ✅ qdarkstyle imported successfully")
except ImportError as e:
print(f" ❌ qdarkstyle import failed: {e}")
return False
try:
import qtawesome # noqa: F401
print(" ✅ qtawesome imported successfully")
except ImportError as e:
print(f" ❌ qtawesome import failed: {e}")
return False
try:
from PySide6.QtWidgets import QApplication # noqa: F401
print(" ✅ PySide6 imported successfully")
except ImportError as e:
print(f" ❌ PySide6 import failed: {e}")
return False
return True
def test_theme_loading():
"""Test that QDarkStyleSheet loads correctly."""
print("\n🎨 Testing theme loading...")
try:
import qdarkstyle
stylesheet = qdarkstyle.load_stylesheet_pyside6()
print(f" ✅ QDarkStyleSheet loaded ({len(stylesheet)} characters)")
return True
except Exception as e:
print(f" ❌ QDarkStyleSheet loading failed: {e}")
return False
def test_icon_loading():
"""Test that QtAwesome icons load correctly."""
print("\n🎯 Testing icon loading...")
try:
import qtawesome as qta
from PySide6.QtWidgets import QApplication
# Need a QApplication to create icons
app = QApplication.instance()
if app is None:
app = QApplication([])
# Test common icons
icons_to_test = [
"fa5s.home",
"fa5s.file-archive",
"fa5s.file-export",
"fa5s.tools",
"fa5s.cog",
"fa5s.compact-disc",
]
for icon_name in icons_to_test:
qta.icon(icon_name)
print(f" ✅ {icon_name} loaded successfully")
return True
except Exception as e:
print(f" ❌ Icon loading failed: {e}")
return False
def test_main_window_import():
"""Test that the main window can be imported."""
print("\n🏠 Testing MainWindow import...")
try:
# Import modules that MainWindow depends on
print(" ✅ AppSettings imported")
print(" ✅ HomeTab imported")
print(" ✅ CompressionTab imported")
# Note: We're not actually importing MainWindow yet since it might
# have issues we need to fix first
print(" ✅ Core dependencies imported successfully")
return True
except Exception as e:
print(f" ❌ MainWindow dependencies failed: {e}")
return False
def main():
"""Run all tests."""
print("🚀 RETROCLAMP MIGRATION TEST SUITE")
print("=" * 50)
tests = [
test_imports,
test_theme_loading,
test_icon_loading,
test_main_window_import,
]
passed = 0
total = len(tests)
for test in tests:
if test():
passed += 1
else:
print(" 💥 Test failed!")
print(f"\n📊 RESULTS: {passed}/{total} tests passed")
if passed == total:
print("✅ ALL TESTS PASSED - Migration is working!")
print("\n🎯 READY FOR NEXT STEPS:")
print(" • Remove old theme modules")
print(" • Test the full application")
print(" • Update documentation")
return True
else:
print("❌ SOME TESTS FAILED - Need to fix issues before proceeding")
return False
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)