Make the rail reset zero the sensor in live and the display in replay
The replay view disabled a control whose display reset is exactly what an operator wants there, and the bare "Reset" hid that the live one zeroes the sensor tracker; the label, tooltip and status line now name the target, and Ctrl+R follows the view. Verified with the studio suite, ui_check (628 checks) and real-GL rail snapshots of both views.
This commit is contained in:
@@ -1532,7 +1532,6 @@ def test_the_nav_items_switch_the_main_window_layout(make_window):
|
||||
assert not window.replay.is_loaded()
|
||||
assert window.force_plots.mode() == "follow", "browsing starts with no recording"
|
||||
assert window.toolbar.btn_replay_video.isVisible(), "no video picker in the replay"
|
||||
live_sizes = tuple(window.content_splitter.sizes())
|
||||
|
||||
window.brand_bar.btn_live.click()
|
||||
assert window.view_preset() == "live"
|
||||
@@ -2050,7 +2049,8 @@ def test_the_replay_view_offers_a_stop_that_always_works(make_window, replay_rec
|
||||
wrong. So the rail's Stop button — the same one the live view uses to end a session
|
||||
— is an unconditional stop in this view, and it covers both things that can run
|
||||
there: plain playback and a recompute pass. The tracker reset owns no device here,
|
||||
so it is disabled rather than repurposed.
|
||||
so it is the *display* reset and says so (see
|
||||
``test_the_replay_reset_is_the_display_reset_and_never_the_device``).
|
||||
"""
|
||||
from orisys_app_shared.i18n import t
|
||||
from PySide6.QtWidgets import QApplication
|
||||
@@ -2061,10 +2061,10 @@ def test_the_replay_view_offers_a_stop_that_always_works(make_window, replay_rec
|
||||
assert window._load_recording(replay_recording)
|
||||
QApplication.processEvents()
|
||||
|
||||
assert not window.toolbar.btn_reset.isEnabled(), (
|
||||
"the replay view offers to zero a device tracker it has not got"
|
||||
assert window.toolbar.btn_reset.isEnabled(), (
|
||||
"the replay view's display reset is unavailable"
|
||||
)
|
||||
assert window.toolbar.btn_reset.text() == t("toolbar.reset")
|
||||
assert window.toolbar.btn_reset.text() == t("toolbar.reset_display")
|
||||
assert window.toolbar.btn_stop.text() == t("toolbar.stop_label")
|
||||
assert not window.toolbar.btn_stop.isEnabled(), (
|
||||
"a stop is offered while nothing is running"
|
||||
@@ -2136,12 +2136,131 @@ def test_the_live_view_keeps_the_tracker_reset(make_window):
|
||||
window = _show(make_window(), (1440, 880))
|
||||
window.brand_bar.btn_live.click()
|
||||
QApplication.processEvents()
|
||||
assert window.toolbar.btn_reset.text() == t("toolbar.reset"), (
|
||||
assert window.toolbar.reset_target() == "sensor", (
|
||||
"the live view's reset is the sensor tracker's"
|
||||
)
|
||||
assert window.toolbar.btn_reset.text() == t("toolbar.reset_sensor"), (
|
||||
"the rail's reset slot is not the tracker reset in the live view"
|
||||
)
|
||||
# Idle, the tip explains what is missing instead of leaving a dead button.
|
||||
assert not window.toolbar.btn_reset.isEnabled()
|
||||
assert window.toolbar.btn_reset.toolTip() == t("toolbar.reset_sensor_unavailable"), (
|
||||
window.toolbar.btn_reset.toolTip()
|
||||
)
|
||||
window.close()
|
||||
|
||||
|
||||
def test_the_replay_reset_is_the_display_reset_and_never_the_device(
|
||||
make_window, replay_recording
|
||||
):
|
||||
"""The reported defect: "the reset button cannot be used in replay mode".
|
||||
|
||||
The replay view owns no device, so the tracker reset is meaningless there — but the
|
||||
display reset is exactly what an operator wants. The control is the same one, and
|
||||
these are the facts that have to hold together: it is available, it puts the display
|
||||
back (curves redrawn at their default framing, playhead at the start), and it never
|
||||
asks a device worker to zero anything — the window is armed with one, and its request
|
||||
counter stays at zero.
|
||||
"""
|
||||
from orisys_app_shared.i18n import t
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
window = _show(make_window(), (1440, 880))
|
||||
stuck = ui_check._StuckWorker()
|
||||
window._ensure_workers = lambda: None
|
||||
window._box_worker = stuck
|
||||
window._finger_worker = stuck
|
||||
window.brand_bar.btn_playback.click()
|
||||
QApplication.processEvents()
|
||||
assert window._load_recording(replay_recording)
|
||||
QApplication.processEvents()
|
||||
|
||||
assert window.toolbar.reset_target() == "display"
|
||||
assert window.toolbar.btn_reset.isEnabled(), (
|
||||
"the replay view must offer the display reset"
|
||||
)
|
||||
assert window.toolbar.btn_reset.text() == t("toolbar.reset_display")
|
||||
assert window.toolbar.btn_reset.toolTip() == t("toolbar.reset_display_tip")
|
||||
assert window.act_reset.text() == t("menu.reset_display"), (
|
||||
"Ctrl+R is the same control and must be named the same way"
|
||||
)
|
||||
assert window.act_reset.isEnabled()
|
||||
|
||||
# What the reset has to undo: a moved playhead and a browsed window.
|
||||
window.replay.set_position(0.9)
|
||||
window.force_plots.set_window(0.4, 1.1)
|
||||
QApplication.processEvents()
|
||||
assert window.force_plots.mode() == "browse"
|
||||
assert window.replay.position() > 0.5
|
||||
|
||||
window.toolbar.btn_reset.click()
|
||||
QApplication.processEvents()
|
||||
assert stuck.reset_requests == 0, (
|
||||
"the replay's reset asked a device worker to zero the tracker"
|
||||
)
|
||||
assert window.replay.position() == 0.0, (
|
||||
f"the reset did not start the replay over: {window.replay.position()}"
|
||||
)
|
||||
assert window.force_plots.cursor_time() == 0.0
|
||||
assert window.force_plots.mode() == "browse", (
|
||||
"the reset left the charts out of the replay's own mode"
|
||||
)
|
||||
sizes = [
|
||||
0 if curve.getData()[0] is None else int(curve.getData()[0].size)
|
||||
for curve in window.force_plots.curves
|
||||
]
|
||||
assert all(size > 0 for size in sizes), (
|
||||
f"the reset left the replay with blank charts: {sizes}"
|
||||
)
|
||||
assert window.statusBar().currentMessage() == t("status.reset_display"), (
|
||||
window.statusBar().currentMessage()
|
||||
)
|
||||
window.close()
|
||||
|
||||
|
||||
def test_the_live_reset_zeroes_the_device_and_restarts_the_display_baseline(make_window):
|
||||
"""The live half of the same control: the device is asked, and the tip's side
|
||||
effect (the display baseline restarting) really happens."""
|
||||
from orisys_app_shared.i18n import t
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
window = _show(make_window(sensor_type="box", source_mode="camera"), (1440, 880))
|
||||
stuck = ui_check._StuckWorker()
|
||||
window._ensure_workers = lambda: None
|
||||
window._box_worker = stuck
|
||||
window._finger_worker = stuck
|
||||
window._start_run()
|
||||
window._run_timer.stop()
|
||||
try:
|
||||
# The first frame is the application's own path to ``running`` — and the moment
|
||||
# the rail recomputes what a session can do (see ``_update_run_enabled``), which
|
||||
# is why the state is reached through it rather than stated directly.
|
||||
stuck.emit(ui_check._fake_packet(1))
|
||||
window._on_run_tick()
|
||||
QApplication.processEvents()
|
||||
assert window._session_phase == "running"
|
||||
assert window.toolbar.btn_reset.isEnabled()
|
||||
assert window.toolbar.btn_reset.text() == t("toolbar.reset_sensor")
|
||||
assert window.toolbar.btn_reset.toolTip() == t("toolbar.reset_sensor_tip")
|
||||
restarts: list = []
|
||||
window.force_plots.request_presentation_reestimate = lambda: restarts.append(True)
|
||||
|
||||
window.toolbar.btn_reset.click()
|
||||
assert stuck.reset_requests == 1, "the live reset did not reach the device"
|
||||
assert restarts == [True], (
|
||||
"the display baseline was not restarted with the zero (the tooltip's side effect)"
|
||||
)
|
||||
assert window.statusBar().currentMessage() == t("status.reset_pending"), (
|
||||
window.statusBar().currentMessage()
|
||||
)
|
||||
assert window.act_reset.text() == t("menu.reset"), (
|
||||
"Ctrl+R must be named as the sensor reset in the live view"
|
||||
)
|
||||
finally:
|
||||
window._stop_run(reason="user_stop")
|
||||
stuck.release()
|
||||
|
||||
|
||||
def test_the_tracker_reset_follows_the_session_across_a_view_switch(make_window):
|
||||
"""Zeroing the tracker is a *device* action: which panel is on screen is not a fact
|
||||
about the session, so switching live → calibration → live must not take the reset
|
||||
@@ -2171,7 +2290,7 @@ def test_the_tracker_reset_follows_the_session_across_a_view_switch(make_window)
|
||||
assert window.toolbar.btn_reset.isEnabled() and window.act_reset.isEnabled(), (
|
||||
"a running session must offer the tracker reset before any view switch"
|
||||
)
|
||||
assert window.toolbar.btn_reset.text() == t("toolbar.reset")
|
||||
assert window.toolbar.btn_reset.text() == t("toolbar.reset_sensor")
|
||||
|
||||
window.brand_bar.btn_calibration.click()
|
||||
QApplication.processEvents()
|
||||
|
||||
Reference in New Issue
Block a user