Files
AareDAQ/tests/unit/gui/test_log_panel.py
T
duan_jandClaude Fable 5 2adf8ff6d5 style: narrow the log pop-out view for the pyright gate
The Optional _popout_view is assert-narrowed once after opening; the
unguarded accesses were the last three diff-gate violations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 10:35:54 +02:00

32 lines
1.0 KiB
Python

"""The console-log pop-out is a second view on the same emitter: history is
copied on open, live lines reach both views, and clear() empties both."""
from aare.gui.panels.log_panel import LogDock
def test_log_popout_mirrors_and_clears(qtbot):
dock = LogDock()
qtbot.addWidget(dock)
dock.emitter.message.emit("first line")
assert "first line" in dock.view.toPlainText()
dock._open_popout()
assert dock._popout is not None
assert dock._popout.isVisible()
popout_view = dock._popout_view
assert popout_view is not None
# History copied on open, live lines reach both views.
assert "first line" in popout_view.toPlainText()
dock.emitter.message.emit("second line")
assert "second line" in dock.view.toPlainText()
assert "second line" in popout_view.toPlainText()
# Reopening reuses the window instead of stacking mirrors.
popout = dock._popout
dock._open_popout()
assert dock._popout is popout
dock.clear()
assert dock.view.toPlainText() == ""
assert popout_view.toPlainText() == ""