Files
AareDAQ/tests/unit/gui/test_axis_video_panel.py
duan_jandClaude Fable 5 e77dfb4716 refactor: shared busy-badge renderer for camera and axis video views
draw_busy_badge in busy_overlay renders the title+subtext pill once;
the sample camera and axis video overlays both delegate to it instead
of keeping diverging copies. The axis panel's dot+label status pill and
its per-theme QSS go away with it.

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

38 lines
1.3 KiB
Python

from aarecommon.models.models import SessionsStateEnum
from PySide6.QtWidgets import QVBoxLayout, QWidget
from aare.gui.panels.axis_video_panel import AxisVideoPanel
from aare.gui.widgets.busy_overlay import build_busy_overlay_style
from aare.gui.widgets.video_image import VideoGraphicsView
def _vacant_style():
return build_busy_overlay_style(
is_busy=False, tell_state=None, session_state=SessionsStateEnum.Vacant
)
def test_badge_drawn_once_and_hint_stripped(qtbot):
# Combined-view shape: two video views stacked in one container.
container = QWidget()
layout = QVBoxLayout(container)
first, second = VideoGraphicsView(), VideoGraphicsView()
layout.addWidget(first)
layout.addWidget(second)
panel = AxisVideoPanel("Combined", container)
qtbot.addWidget(panel)
style = _vacant_style()
assert style is not None and style.subtext # sample camera keeps the hint
panel.set_busy_style(style)
applied = first._busy_overlay_style
assert applied is not None
assert applied.text == "In viewing mode"
assert applied.subtext == "" # not clickable here, hint stripped
assert second._busy_overlay_style is None # one badge, not one per view
panel.set_busy_style(None)
assert first._busy_overlay_style is None