三维设置加箭头阈值,静默处理网格冲突
对话框写回 flow_on_px(二维三维共用),去掉 analysis_grid_mismatch 告警,缩短 UV/形变等工程腔文案并认 source=analysis。已用 pane UI 与 controller 单测验证。
This commit is contained in:
@@ -978,10 +978,45 @@ def test_the_controller_redraws_on_a_display_change_and_runs_no_pass(pass_root):
|
||||
assert session.threshold() == pytest.approx(0.5)
|
||||
# The frame is rebuilt from the same stored record, not from a new one.
|
||||
assert session.frame(int(session.frame_ids[0])).frame_id == FIRST_FRAME_ID
|
||||
assert host.notes == [], "a threshold change must not lecture about the grid"
|
||||
finally:
|
||||
session.reader.close()
|
||||
|
||||
|
||||
def test_a_refused_grid_change_redraws_without_a_status_warning():
|
||||
"""Moving max_arrows cannot be served; the frame is redrawn and nothing is said.
|
||||
|
||||
No evidence recording: the session is a stub whose ``serve_policy`` refuses, which
|
||||
is exactly the path that used to push ``playback.analysis_grid_mismatch``.
|
||||
"""
|
||||
class _Reader:
|
||||
def close(self) -> None:
|
||||
pass
|
||||
|
||||
class _Session:
|
||||
def __init__(self) -> None:
|
||||
self.calls: list = []
|
||||
self.reader = _Reader()
|
||||
|
||||
def serve_policy(self, policy) -> bool:
|
||||
self.calls.append(policy)
|
||||
return False
|
||||
|
||||
def close(self) -> None:
|
||||
pass
|
||||
|
||||
controller, host, engine, parts = _controller()
|
||||
session = _Session()
|
||||
controller.results.open_session(session) # type: ignore[arg-type]
|
||||
engine.use_analysis(session)
|
||||
engine.redraws = 0
|
||||
controller.on_display_settings(DisplaySettings(max_arrows=50))
|
||||
assert engine.redraws == 1, "the refused policy still redraws the stored frame"
|
||||
assert len(session.calls) == 1
|
||||
assert host.notes == [], "a grid mismatch must not reach the status bar"
|
||||
controller.results.close()
|
||||
|
||||
|
||||
# ------------------------------------------------------------ analysis on open
|
||||
def test_a_running_session_does_not_hide_a_stored_result(pass_root):
|
||||
"""A result on disk is served while a session is open: reading it opens no chain.
|
||||
|
||||
@@ -56,6 +56,7 @@ def test_the_pane_holds_a_legend_and_no_settings(panel):
|
||||
panel.housing_check,
|
||||
panel.deform_check,
|
||||
panel.gain_spin,
|
||||
panel.flow_threshold_spin,
|
||||
panel.scale_combo,
|
||||
panel.depth_adaptive_check,
|
||||
panel.fps_combo,
|
||||
@@ -106,6 +107,36 @@ def test_adaptive_depth_scale_round_trips_through_the_dialog(panel):
|
||||
assert panel.settings().depth_scale_adaptive is False
|
||||
|
||||
|
||||
def test_arrow_threshold_round_trips_and_feeds_the_shared_policy(panel):
|
||||
"""The threshold the dialog writes is the one both views sample with."""
|
||||
from orisys_app_shared.scene3d.contracts import DisplaySettings
|
||||
from orisys_app_shared.scene3d.visual_policy import policy_for_settings
|
||||
|
||||
panel.apply_settings(
|
||||
DisplaySettings(flow_on_px=0.9, flow_grid_spacing=12, max_arrows=200)
|
||||
)
|
||||
assert panel.flow_threshold_spin.value() == pytest.approx(0.9)
|
||||
settings = panel.settings()
|
||||
assert settings.flow_on_px == pytest.approx(0.9)
|
||||
assert settings.flow_off_px == pytest.approx(0.8)
|
||||
assert settings.flow_grid_spacing == 12
|
||||
assert settings.max_arrows == 200
|
||||
# A colour-scale click must not wipe the held grid or the typed threshold.
|
||||
panel.housing_check.setChecked(True)
|
||||
again = panel.settings()
|
||||
assert again.flow_on_px == pytest.approx(0.9)
|
||||
assert again.flow_grid_spacing == 12
|
||||
assert policy_for_settings(again).flow_on_px == pytest.approx(0.9)
|
||||
|
||||
|
||||
def test_source_kind_analysis_uses_its_own_label(panel):
|
||||
"""A stored result is not labelled as live acquisition."""
|
||||
panel.set_diagnostics_visible(True)
|
||||
panel.set_source_kind("analysis")
|
||||
assert panel.source_label.text() == t("scene3d.source_analysis")
|
||||
assert panel.source_label.toolTip() == t("scene3d.source_analysis_tip")
|
||||
|
||||
|
||||
def test_the_pane_header_offers_the_two_actions(qt_app):
|
||||
"""A gear and a view reset: the two things that belong to *looking*."""
|
||||
from orisys_studio.ui.mesh3d_panel import Mesh3dPanel
|
||||
|
||||
Reference in New Issue
Block a user