Files
AareDAQ/tests/unit/gui/test_busy_overlay.py
T
duan_jandClaude Fable 5 16e112f44a
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 / lint (pull_request) Successful in 1m3s
CI / test (3.11) (pull_request) Successful in 1m25s
CI / test (3.12) (pull_request) Successful in 1m25s
CI / test (3.13) (pull_request) Successful in 1m24s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m32s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m37s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m41s
CI / test-with-coverage (pull_request) Successful in 2m4s
CI / coverage-analysis (pull_request) Successful in 3s
test: lift diff coverage over the 80 percent gate
Promote the illumination panel's __main__ self-check to a real pytest
file so CI counts it, add busy-overlay render checks (status text
paints, video view routes through it), and cover the motor group's
incomplete-entry and below-min Enter paths. Local diff coverage from
the gui suite alone: 82 percent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 08:52:01 +02:00

37 lines
1.3 KiB
Python

"""The Axis views' busy flag is a passive status: plain shadowed text, not
the badge pill (which reads as a button). These checks fail if the text
renderer stops painting or the video view stops routing through it."""
from PySide6.QtCore import Qt
from PySide6.QtGui import QPainter, QPixmap
from aare.gui.widgets.busy_overlay import build_busy_overlay_style, draw_busy_status_text
from aare.gui.widgets.video_image import VideoGraphicsView
def _busy_style():
style = build_busy_overlay_style(is_busy=True, tell_state=None)
assert style is not None and style.text == "BEAMLINE BUSY"
return style
def test_status_text_paints_something(qapp):
pixmap = QPixmap(400, 300)
pixmap.fill(Qt.GlobalColor.black)
blank = pixmap.toImage()
painter = QPainter(pixmap)
draw_busy_status_text(painter, 400, 300, _busy_style())
painter.end()
assert pixmap.toImage() != blank, "busy text must actually paint"
def test_video_view_paints_busy_text(qtbot):
view = VideoGraphicsView()
qtbot.addWidget(view)
view.resize(400, 300)
idle = view.grab().toImage()
view.set_busy_overlay_style(_busy_style())
assert view.grab().toImage() != idle, "busy style must change the rendered view"
view.set_busy_overlay_style(None)
assert view.grab().toImage() == idle, "clearing the style must restore the view"