Skip to content

Commit 8d75c55

Browse files
committed
test: add offscreen smoke for Settings, TTS and History window instantiation
Extends test_smoke_launch.py with test_secondary_windows_instantiate, which boots a BlitztextApp offscreen and verifies that all three previously uncovered dialog/panel constructors (HistoryPanel, TtsWindow, SettingsDialog) produce live objects without errors. SettingsDialog is instantiated directly to avoid the exec() call in show_settings_dialog(); History and TTS use the same lazy-init path as production code. Completes the smoke coverage goal: MainWindow, Tray, Compose, Settings, TTS, and History are now all exercised under WHISPER_GUI_TESTS=1.
1 parent 993b976 commit 8d75c55

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

tests/test_smoke_launch.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,46 @@ def test_app_boots_idles_and_exits_clean(ui_language, tmp_path):
8888
set_language(DEFAULT_LANGUAGE)
8989

9090

91+
@gui_only
92+
def test_secondary_windows_instantiate(tmp_path):
93+
"""Settings-, TTS- und History-Fenster lassen sich offscreen instanziieren."""
94+
from PyQt6.QtWidgets import QApplication
95+
96+
from app.blitztext_linux import BlitztextApp, SettingsDialog
97+
from app.config import Config
98+
99+
config = Config.load(tmp_path / "config.json")
100+
101+
qapp = QApplication.instance() or QApplication([])
102+
app = None
103+
try:
104+
with patch("app.blitztext_linux.Config.load", return_value=config):
105+
app = BlitztextApp(qapp)
106+
app.stop_hotkey_worker()
107+
qapp.processEvents()
108+
109+
# History-Panel: lazy-init via show_history_panel().
110+
app.show_history_panel()
111+
qapp.processEvents()
112+
assert app._history_panel is not None
113+
114+
# TTS-Fenster: lazy-init via show_tts_window().
115+
app.show_tts_window()
116+
qapp.processEvents()
117+
assert app._tts_window is not None
118+
119+
# Settings-Dialog: direkt instanziieren, da show_settings_dialog() exec() aufruft.
120+
dlg = SettingsDialog(config)
121+
qapp.processEvents()
122+
assert dlg is not None
123+
dlg.close()
124+
125+
finally:
126+
if app is not None:
127+
app.stop_hotkey_worker()
128+
set_language(DEFAULT_LANGUAGE)
129+
130+
91131
@gui_only
92132
def test_compose_dialog_lifecycle(tmp_path):
93133
"""Compose-Dialog öffnet sich, wird wiederverwendet und übersetzt sich neu."""

0 commit comments

Comments
 (0)