为二维与三维深度色标增加每帧自适应选项。
默认仍锁定本会话首帧,勾选后两视图按当前帧有效深度共用同一范围。已用深度色标与显示设置测试验证。
This commit is contained in:
@@ -920,11 +920,6 @@ def test_depth_view_reports_missing_data_and_fixes_its_scale(make_window):
|
||||
window._on_run_tick()
|
||||
latched = window.arrow_panel.depth_scale_label.text()
|
||||
assert latched
|
||||
shared = window.mesh3d_panel._shared_depth_scale
|
||||
assert shared == window._depth_range_value
|
||||
assert shared is not None
|
||||
assert shared[0] == pytest.approx(0.0)
|
||||
assert shared[1] == pytest.approx(1.0)
|
||||
|
||||
window._last_rendered_view_mode = None
|
||||
stuck.emit(ui_check._fake_packet(2, depth=np.linspace(0.0, 9.0, 64).reshape(8, 8)))
|
||||
@@ -932,12 +927,61 @@ def test_depth_view_reports_missing_data_and_fixes_its_scale(make_window):
|
||||
assert window.arrow_panel.depth_scale_label.text() == latched, (
|
||||
"the depth colour scale re-fitted on every frame"
|
||||
)
|
||||
assert window.mesh3d_panel._shared_depth_scale == shared, (
|
||||
"the 3D depth colour span must stay locked to the 2D latch"
|
||||
assert window.mesh3d_panel.shared_depth_scale() == window._depth_range(), (
|
||||
"the 3D depth colour scale is not the 2D canvas's latched span"
|
||||
)
|
||||
_finish(window, stuck)
|
||||
|
||||
|
||||
def test_adaptive_depth_scale_refits_both_views(make_window):
|
||||
"""The setting restores the per-frame colour bar, and both views share it."""
|
||||
import numpy as np
|
||||
from orisys_app_shared.scene3d.contracts import DisplaySettings
|
||||
|
||||
window, stuck = _running_window(make_window)
|
||||
window.arrow_panel.set_view_mode("depth")
|
||||
window.mesh3d_panel.set_display_settings(
|
||||
DisplaySettings(depth_scale_adaptive=True)
|
||||
)
|
||||
|
||||
window._last_rendered_view_mode = None
|
||||
stuck.emit(ui_check._fake_packet(1, depth=np.linspace(0.0, 1.0, 64).reshape(8, 8)))
|
||||
window._on_run_tick()
|
||||
from orisys_app_shared.i18n import t
|
||||
|
||||
first = window.arrow_panel.depth_scale_label.text()
|
||||
assert window.mesh3d_panel.shared_depth_scale() == (0.0, 1.0)
|
||||
assert "1.000" in first
|
||||
assert window.arrow_panel.depth_scale_label.toolTip() == t(
|
||||
"panels.depth_scale_tip_adaptive"
|
||||
)
|
||||
|
||||
window._last_rendered_view_mode = None
|
||||
stuck.emit(ui_check._fake_packet(2, depth=np.linspace(0.0, 9.0, 64).reshape(8, 8)))
|
||||
window._on_run_tick()
|
||||
assert window.arrow_panel.depth_scale_label.text() != first, (
|
||||
"the adaptive colour bar stayed on the first frame"
|
||||
)
|
||||
assert window.mesh3d_panel.shared_depth_scale() == (0.0, 9.0)
|
||||
assert window._depth_range_value is None
|
||||
|
||||
window.mesh3d_panel.set_display_settings(DisplaySettings())
|
||||
window._last_rendered_view_mode = None
|
||||
stuck.emit(ui_check._fake_packet(3, depth=np.linspace(0.0, 4.0, 64).reshape(8, 8)))
|
||||
window._on_run_tick()
|
||||
latched = window.mesh3d_panel.shared_depth_scale()
|
||||
assert latched == (0.0, 4.0)
|
||||
|
||||
window._last_rendered_view_mode = None
|
||||
stuck.emit(ui_check._fake_packet(4, depth=np.linspace(0.0, 8.0, 64).reshape(8, 8)))
|
||||
window._on_run_tick()
|
||||
assert window.mesh3d_panel.shared_depth_scale() == latched, (
|
||||
"leaving adaptive did not return to the session latch"
|
||||
)
|
||||
assert window.arrow_panel.depth_scale_label.toolTip() == t("panels.depth_scale_tip")
|
||||
_finish(window, stuck)
|
||||
|
||||
|
||||
def test_the_domain_boundary_is_latched_for_the_session(make_window):
|
||||
"""The 2D boundary is the device's island: rebuilt per frame, decided once.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user