改善 Studio 回放布局与传感器切换体验

缩短界面提示,保存上次视频目录,并防止旧结果绘入 Finger 3D。针对性测试及可见界面复测通过。
This commit is contained in:
ykcheungab
2026-10-06 20:18:50 +08:00
parent 425fa0d44d
commit 321e52f47a
11 changed files with 265 additions and 41 deletions
+82
View File
@@ -2830,6 +2830,88 @@ def test_the_rail_reads_the_rate_and_what_it_cost(qt_app, make_window):
window.close()
def test_replay_without_a_video_names_the_visible_picker(qt_app, make_window):
from orisys_app_shared.i18n import t
window = make_window(sensor_type="box")
window.brand_bar.btn_playback.click()
qt_app.processEvents()
assert window.arrow_panel.image_label.text() == t("panels.replay_empty")
assert window.toolbar.btn_replay_video.text() in t("panels.replay_empty")
window.close()
def test_a_remembered_video_is_not_described_as_open(make_window):
from orisys_app_shared.i18n import t
window = make_window(sensor_type="finger", video_path="D:/clips/old.mp4")
window.brand_bar.btn_playback.click()
window._refresh_status_rail()
assert not window.replay.has_video()
assert window.toolbar.source_summary.text() == t(
"status.rail_recent_video", name="old.mp4"
)
def test_the_rail_puts_result_identity_before_a_long_video_name(
qt_app, make_window, monkeypatch
):
from types import SimpleNamespace
from orisys_app_shared.i18n import t
window = make_window(sensor_type="finger")
window.resize(1197, 752)
window.show()
window.brand_bar.btn_playback.click()
window.toolbar.set_video_path("D:/very-long-recording-name-for-a-box-sensor.mp4")
session = SimpleNamespace(
reader=SimpleNamespace(provenance=SimpleNamespace(sensor_type="box"))
)
monkeypatch.setattr(window.replay_ctl, "available_result", lambda: session)
window._refresh_status_rail()
qt_app.processEvents()
prefix = t("status.rail_result_profile", type="box")
label = window.toolbar.source_summary
assert label.text().startswith(prefix), label.text()
assert label.fontMetrics().horizontalAdvance(prefix) <= label.width(), (
"the result's sensor disappears from the visible rail"
)
window.close()
def test_old_result_depth_is_not_sent_to_the_new_sensor_scene(make_window, monkeypatch):
from types import SimpleNamespace
window = make_window(sensor_type="finger")
session = SimpleNamespace(
reader=SimpleNamespace(provenance=SimpleNamespace(sensor_type="box")),
paint_policy=lambda: None,
)
monkeypatch.setattr(window.replay_ctl, "available_result", lambda: session)
submitted = []
fake_view = SimpleNamespace(
set_overlay_policy=lambda _policy: None,
submit_packet=submitted.append,
)
panel = window.mesh3d_panel
real_view = panel._view
panel._view = fake_view
monkeypatch.setattr(window, "_connect_analysis_display", lambda _panel: True)
monkeypatch.setattr(window, "_tick_analysis_3d", lambda: None)
try:
window._show_analysis_frame("old box packet")
assert submitted == []
session.reader.provenance.sensor_type = "finger"
window._show_analysis_frame("finger packet")
assert submitted == ["finger packet"]
finally:
panel._view = real_view
def test_the_camera_probe_is_usable_without_a_camera(capsys):
"""The probe has to be safe to run on a machine with no camera attached."""
import camera_probe