fixed studio dd02 live cannot work problem
This commit is contained in:
@@ -416,3 +416,32 @@ def test_a_failed_chain_marks_the_frame_rather_than_claiming_its_forces():
|
||||
assert packet.contact.centroid_uv_xy is None
|
||||
finally:
|
||||
_restore(saved)
|
||||
|
||||
|
||||
def test_the_finger_producer_reports_the_camera_rate(monkeypatch):
|
||||
"""The first live frame asks the producer for ``capture_fps``.
|
||||
|
||||
That call is what ended a finger session with
|
||||
``'_FingerProducer' object has no attribute 'capture_fps'``. A file has no
|
||||
delivered-frame counter, so it reports nothing; a live source reports the
|
||||
frames its counter advanced over the wall-clock between two reads.
|
||||
"""
|
||||
from orisys_app_shared.acquisition import finger_worker
|
||||
|
||||
clock = {"t": 1000.0}
|
||||
monkeypatch.setattr(finger_worker.time, "perf_counter", lambda: clock["t"])
|
||||
|
||||
file_source = types.SimpleNamespace(running=False, status=types.SimpleNamespace(last_seq=0))
|
||||
file_runtime = types.SimpleNamespace(capture_source=file_source)
|
||||
file_producer = finger_worker._FingerProducer(file_runtime, is_file=True)
|
||||
assert file_producer.capture_fps() == 0.0
|
||||
|
||||
status = types.SimpleNamespace(last_seq=10, dropped_frames=0)
|
||||
live = types.SimpleNamespace(running=True, status=status)
|
||||
producer = finger_worker._FingerProducer(
|
||||
types.SimpleNamespace(capture_source=live), is_file=False
|
||||
)
|
||||
assert producer.capture_fps() == 0.0
|
||||
clock["t"] = 1001.0
|
||||
producer.capture_seq = 40
|
||||
assert producer.capture_fps() == pytest.approx(30.0)
|
||||
|
||||
Reference in New Issue
Block a user