958fde9050
- Removed outdated comments and documentation from CsvSessionSource and DemoSource classes. - Introduced new unit tests for CsvSource and DataSource functionalities, ensuring robust validation of CSV loading and session handling. - Added UI smoke tests to verify window instantiation and menu actions without hardware dependencies. - Implemented VisionEngine tests to validate demo snapshots and alignment state logic.
59 lines
1.7 KiB
Python
59 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
|
|
try:
|
|
from PySide6 import QtWidgets
|
|
|
|
PYSIDE6_IMPORT_ERROR = None
|
|
except Exception as exc:
|
|
QtWidgets = None
|
|
PYSIDE6_IMPORT_ERROR = exc
|
|
|
|
|
|
@unittest.skipIf(PYSIDE6_IMPORT_ERROR is not None, "PySide6 is not installed")
|
|
class UiSmokeTests(unittest.TestCase):
|
|
def test_windows_instantiate_without_hardware(self) -> None:
|
|
from wafer_edge.App import UserWindow
|
|
|
|
app = QtWidgets.QApplication.instance() or QtWidgets.QApplication([])
|
|
|
|
user = UserWindow()
|
|
|
|
self.assertEqual(user.windowTitle(), "Wafer Position Monitor")
|
|
self.assertEqual(user.source_label.text(), "User App")
|
|
app.quit()
|
|
|
|
def test_file_menu_has_open_session_action(self) -> None:
|
|
"""Verify File → Open Session… action exists in the menu bar."""
|
|
from wafer_edge.App import UserWindow
|
|
|
|
app = QtWidgets.QApplication.instance() or QtWidgets.QApplication([])
|
|
|
|
user = UserWindow()
|
|
menu_bar = user.menuBar()
|
|
self.assertIsNotNone(menu_bar)
|
|
|
|
file_menu = None
|
|
for action in menu_bar.actions():
|
|
menu = action.menu()
|
|
if menu is not None and menu.title() in ("File", "&File"):
|
|
file_menu = menu
|
|
break
|
|
|
|
self.assertIsNotNone(file_menu, "File menu should exist in the menu bar")
|
|
|
|
# Check that "Open Session…" is one of the menu actions.
|
|
action_texts = {a.text() for a in file_menu.actions()}
|
|
self.assertIn(
|
|
"Open Session…",
|
|
action_texts,
|
|
"File menu should contain an 'Open Session…' action",
|
|
)
|
|
app.quit()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|