fix Studio reset, 3D base colour and arrow-trigger defects
The tracker reset was decided by which panel was on screen rather than by the session, the automatic colour range moved the 3D surface's base colour on the first press, and the 2D canvas and the 3D overlay applied different flow thresholds (622 arrows against 432 on a real recording). ui_check 600/0; apps/studio 380 items and shared 390 items with no failures; real-GL 18 items, only the pre-existing colour-scale failure; AutoCal 358 passed; both views now select identical arrows on all 42 frames of a real video.
This commit is contained in:
@@ -110,6 +110,44 @@ def test_a_mode_the_plan_does_not_offer_falls_back_to_the_default():
|
||||
|
||||
|
||||
# --------------------------------------------------------------- one renderer
|
||||
def test_the_2d_canvas_draws_from_the_policy_it_is_given():
|
||||
"""The threshold is the caller's — the pane's — not a per-view default.
|
||||
|
||||
``arrow_policy`` is the policy the 3D surface samples its overlay with
|
||||
(``visual_policy.policy_for_settings`` over the display settings). A sample inside
|
||||
the hysteresis band is the case that used to differ between the two figures, so it
|
||||
is the case pinned here: with a 0.4 px threshold nothing is drawn, with 0.3 px the
|
||||
same frame carries arrows.
|
||||
"""
|
||||
from orisys_app_shared.scene3d.contracts import DisplaySettings
|
||||
from orisys_app_shared.scene3d.visual_policy import policy_for_settings
|
||||
|
||||
h, w = 12, 16
|
||||
flow = np.zeros((h, w, 2), dtype=np.float32)
|
||||
flow[..., 0] = 0.175 # |2*flow| = 0.35 px: above flow_off_px, below flow_on_px
|
||||
frame = backend.ImageFrame(_image(h, w), flow=flow, flow_valid=True)
|
||||
base = np.zeros((h, w, 3), dtype=np.uint8)
|
||||
|
||||
strict = policy_for_settings(DisplaySettings(flow_on_px=0.4, flow_off_px=0.3))
|
||||
loose = policy_for_settings(DisplaySettings(flow_on_px=0.3, flow_off_px=0.2))
|
||||
strict_image = backend.render_image(
|
||||
frame, mode="arrows_pure", draw_style="finger", arrow_policy=strict
|
||||
)
|
||||
loose_image = backend.render_image(
|
||||
frame, mode="arrows_pure", draw_style="finger", arrow_policy=loose
|
||||
)
|
||||
assert len(np.unique(strict_image.reshape(-1, 3), axis=0)) == 1, (
|
||||
"a 0.4 px threshold drew something for a 0.35 px sample"
|
||||
)
|
||||
assert len(np.unique(loose_image.reshape(-1, 3), axis=0)) > 1, (
|
||||
"a 0.3 px threshold drew nothing for a 0.35 px sample"
|
||||
)
|
||||
# The same policy governs the primitive directly, which is what the window calls
|
||||
# through the backend.
|
||||
direct = draw_arrow_display(base, flow, draw_style="finger", policy=strict)
|
||||
assert len(np.unique(direct.reshape(-1, 3), axis=0)) == 1
|
||||
|
||||
|
||||
def test_the_backend_renders_what_the_primitives_rendered_before():
|
||||
"""Live went through these two calls; the backend must not change a pixel."""
|
||||
image = _image()
|
||||
|
||||
Reference in New Issue
Block a user