fixed label under 3d view
This commit is contained in:
@@ -7,7 +7,9 @@ whole session (Qt forbids creating more than one).
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import itertools
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -77,3 +79,98 @@ def visible_descendants(widget):
|
||||
continue
|
||||
if child.isVisible():
|
||||
yield child
|
||||
|
||||
|
||||
def show_window(window, size):
|
||||
"""Show a window at ``size`` and flush pending Qt events."""
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
window.resize(*size)
|
||||
window.show()
|
||||
QApplication.processEvents()
|
||||
return window
|
||||
|
||||
|
||||
def running_window(make_window):
|
||||
"""Return a running window backed by a controllable test worker."""
|
||||
import ui_check
|
||||
|
||||
window = show_window(
|
||||
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()
|
||||
window._set_phase("running")
|
||||
return window, stuck
|
||||
|
||||
|
||||
def finish_run(window, stuck):
|
||||
"""Stop a test run and release its controllable worker."""
|
||||
window._stop_run(reason="user_stop")
|
||||
stuck.release()
|
||||
|
||||
|
||||
_RECORD_SCRATCH = (
|
||||
Path(__file__).resolve().parents[1] / "outputs" / "_test_record"
|
||||
)
|
||||
_RECORD_3D_SCRATCH = (
|
||||
Path(__file__).resolve().parents[1] / "outputs" / "_test_record_3d"
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def record_root():
|
||||
"""A clean workspace-local directory for recording tests."""
|
||||
shutil.rmtree(_RECORD_SCRATCH, ignore_errors=True)
|
||||
_RECORD_SCRATCH.mkdir(parents=True, exist_ok=True)
|
||||
yield _RECORD_SCRATCH
|
||||
shutil.rmtree(_RECORD_SCRATCH, ignore_errors=True)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def next_record_root():
|
||||
"""Create isolated recording directories for comparisons within one test."""
|
||||
shutil.rmtree(_RECORD_3D_SCRATCH, ignore_errors=True)
|
||||
_RECORD_3D_SCRATCH.mkdir(parents=True, exist_ok=True)
|
||||
counter = itertools.count()
|
||||
|
||||
def _next() -> Path:
|
||||
path = _RECORD_3D_SCRATCH / f"run{next(counter)}"
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
return path
|
||||
|
||||
yield _next
|
||||
shutil.rmtree(_RECORD_3D_SCRATCH, ignore_errors=True)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def replay_recording(record_root):
|
||||
"""One short finished recording (video, forces, frames, and metadata)."""
|
||||
import ui_check
|
||||
from orisys_app_shared.record import ExperimentRecorder, RecordConfig
|
||||
|
||||
recorder = ExperimentRecorder(
|
||||
RecordConfig(video=True, fps=30.0, segment_seconds=30.0)
|
||||
)
|
||||
recording = recorder.start(
|
||||
root=record_root,
|
||||
session_id=1,
|
||||
metadata={
|
||||
"device": {
|
||||
"sensor_type": "box",
|
||||
"config_ref": str(record_root / "sensor.json"),
|
||||
"config_sha256": "recorded",
|
||||
},
|
||||
"versions": {"sdk": "0.5.1"},
|
||||
"depth": {"stored": False, "replay": "recompute"},
|
||||
},
|
||||
)
|
||||
for index in range(60):
|
||||
recorder.on_packet(ui_check._fake_packet(index))
|
||||
recorder.stop()
|
||||
yield Path(recording)
|
||||
|
||||
Reference in New Issue
Block a user