Files
AareDAQ/tests/unit/gui/test_log_panel.py
T
duan_jandClaude Fable 5 46aed87a4c
CI / lint (push) Skipped
CI / test (3.11) (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / test (3.11) (pull_request) Successful in 1m1s
CI / test (3.12) (pull_request) Successful in 1m0s
CI / test (3.13) (pull_request) Successful in 1m0s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m0s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m2s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m18s
CI / test-with-coverage (pull_request) Successful in 1m31s
CI / coverage-analysis (pull_request) Successful in 3s
CI / lint (pull_request) Successful in 2m29s
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-07 17:52:30 +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() == ""