fixed display problem
This commit is contained in:
@@ -925,6 +925,59 @@ def test_depth_view_reports_missing_data_and_fixes_its_scale(make_window):
|
||||
_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.
|
||||
|
||||
Same treatment as the depth colour scale above, and for the same reason — a mask
|
||||
that is re-derived every frame redraws an edge that has not moved, and any pixel of
|
||||
difference repaints the whole boundary (measured: a 0.73% area wobble repaints 69%
|
||||
of the boundary band).
|
||||
"""
|
||||
import numpy as np
|
||||
|
||||
window, stuck = _running_window(make_window)
|
||||
window.arrow_panel.set_view_mode("arrows_pure")
|
||||
island = np.zeros((8, 8), dtype=bool)
|
||||
island[1:7, 1:7] = True
|
||||
island_wobble = island.copy()
|
||||
island_wobble[1, 1] = False # one pixel of rim, i.e. 1.6% of a 36-pixel island
|
||||
|
||||
window._last_rendered_view_mode = None
|
||||
stuck.emit(ui_check._fake_packet(0, valid_mask=island))
|
||||
window._on_run_tick()
|
||||
assert np.array_equal(window._domain_mask.mask, island), (
|
||||
"the session never established the device's island"
|
||||
)
|
||||
|
||||
window._last_rendered_view_mode = None
|
||||
stuck.emit(ui_check._fake_packet(1, valid_mask=island_wobble))
|
||||
window._on_run_tick()
|
||||
assert np.array_equal(window._domain_mask.mask, island), (
|
||||
"a rebuilt mask moved the session's boundary"
|
||||
)
|
||||
assert (window._domain_mask.adoptions, window._domain_mask.held) == (1, 1)
|
||||
|
||||
# An island that really changed is adopted rather than frozen out.
|
||||
moved = np.zeros((8, 8), dtype=bool)
|
||||
moved[2:8, 2:8] = True
|
||||
window._last_rendered_view_mode = None
|
||||
stuck.emit(ui_check._fake_packet(2, valid_mask=moved))
|
||||
window._on_run_tick()
|
||||
assert np.array_equal(window._domain_mask.mask, moved), (
|
||||
"a moved island kept the old boundary on screen"
|
||||
)
|
||||
assert window._domain_mask.adoptions == 2
|
||||
|
||||
# A new run is a new session: the previous island must not survive into it.
|
||||
_finish(window, stuck)
|
||||
window._start_run()
|
||||
assert window._domain_mask.mask is None, (
|
||||
"the previous session's island survived into a new run"
|
||||
)
|
||||
window._run_timer.stop()
|
||||
window._stop_run(reason="user_stop")
|
||||
|
||||
|
||||
# ------------------------------------------------------------- experiment record
|
||||
def test_recording_writes_the_documented_experiment_layout(make_window, record_root):
|
||||
import csv
|
||||
|
||||
Reference in New Issue
Block a user