diff --git a/tests/test_basic.py b/tests/test_basic.py index 00404d3..f2fd623 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -640,39 +640,33 @@ def test_execute_trigger(runtime: Runtime): dm = runtime.device_manager() p = runtime.get_configuration() - p.video[0].camera.identifier = dm.select(DeviceKind.Camera, "simulated.*random.*") + p.video[0].camera.identifier = dm.select(DeviceKind.Camera, "simulated.*empty.*") p.video[0].storage.identifier = dm.select(DeviceKind.Storage, "Trash") p.video[0].camera.settings.binning = 1 p.video[0].camera.settings.shape = (64, 48) - p.video[0].camera.settings.exposure_time_us = 1e4 + p.video[0].camera.settings.exposure_time_us = 1e3 p.video[0].camera.settings.pixel_type = acquire.SampleType.U8 - p.video[0].camera.settings.input_triggers.frame_start.line = 1 - p.video[0].camera.settings.input_triggers.frame_start.enable = True - p.video[0].max_frame_count = 100 + p.video[0].camera.settings.input_triggers.frame_start = Trigger(enable=True, line=0, edge='Rising') + p.video[0].max_frame_count = 10 p = runtime.set_configuration(p) + assert p.video[0].camera.settings.input_triggers.frame_start.enable + runtime.start() - # Snap one frame - runtime.execute_trigger(0) - packet = wait_for_data(runtime, 0) - # TODO: why do i get more than one frame? - assert packet.get_frame_count() >= 1 - frames = tuple(packet.frames()) - assert frames[0].metadata().frame_id >= 0 - del frames - del packet + # No triggers yet, so no data. + assert runtime.get_available_data(0) is None - # Snap another frame - runtime.execute_trigger(0) - packet = wait_for_data(runtime, 0) - # TODO: why do i get more than one frame? - assert packet.get_frame_count() >= 1 - frames = tuple(packet.frames()) - assert frames[0].metadata().frame_id >= 1 - del frames - del packet + # Snap a few individual frames + for i in range(p.video[0].max_frame_count): + runtime.execute_trigger(0) + packet = wait_for_data(runtime, 0) + frames = tuple(packet.frames()) + assert packet.get_frame_count() == 1 + assert frames[0].metadata().frame_id == i + del frames + del packet runtime.stop()