fixed studio dd02 live cannot work problem
This commit is contained in:
@@ -129,6 +129,61 @@ def test_a_zeroing_is_applied_by_the_worker_and_reported_with_its_frame():
|
||||
assert events == [(42, 1.4, 2)]
|
||||
|
||||
|
||||
def test_a_live_zeroing_is_queued_on_the_pipeline():
|
||||
"""The stream path must not reset the tracker on the consumer thread.
|
||||
|
||||
The flow stage is indexing the tracker's frame queue at the same time.
|
||||
Clearing it here is the ``list index out of range`` that ends the session.
|
||||
"""
|
||||
events: list[tuple] = []
|
||||
worker = _worker(on_reset_applied=lambda *args: events.append(args))
|
||||
sensor = _Sensor()
|
||||
queued: list[int] = []
|
||||
|
||||
class _Pipeline:
|
||||
def reset(self) -> None:
|
||||
queued.append(sensor.resets)
|
||||
|
||||
worker._session_id = 2
|
||||
worker.reset()
|
||||
worker._consume_pending_reset(
|
||||
sensor, frame_id=42, mono_t=1.4, pipeline=_Pipeline()
|
||||
)
|
||||
assert sensor.resets == 0, "the live zeroing ran on the consumer thread"
|
||||
assert queued == [0]
|
||||
assert events == [(42, 1.4, 2)]
|
||||
|
||||
|
||||
def test_a_live_finger_zeroing_is_queued_on_the_pipeline():
|
||||
from orisys_app_shared.acquisition.finger_worker import FingerAcquisitionWorker
|
||||
|
||||
events: list[tuple] = []
|
||||
worker = FingerAcquisitionWorker(on_reset_applied=lambda *args: events.append(args))
|
||||
tactile_resets: list[int] = []
|
||||
|
||||
class _Tactile:
|
||||
def reset(self) -> None:
|
||||
tactile_resets.append(1)
|
||||
|
||||
class _Runtime:
|
||||
tactile = _Tactile()
|
||||
|
||||
queued: list[int] = []
|
||||
|
||||
class _Pipeline:
|
||||
def reset(self) -> None:
|
||||
queued.append(len(tactile_resets))
|
||||
|
||||
worker._session_id = 3
|
||||
worker.reset()
|
||||
worker._consume_pending_reset(
|
||||
_Runtime(), frame_id=7, mono_t=0.2, pipeline=_Pipeline()
|
||||
)
|
||||
assert tactile_resets == [], "the finger zeroing ran on the consumer thread"
|
||||
assert queued == [0]
|
||||
assert events == [(7, 0.2, 3)]
|
||||
|
||||
|
||||
def test_a_started_session_drops_a_stale_zeroing_request():
|
||||
root = _root()
|
||||
events: list[tuple] = []
|
||||
|
||||
Reference in New Issue
Block a user