tests: camerabin: fix image location switching test

The test should wait until the last image-done is posted so it
can correctly check that all images have been saved.
This commit is contained in:
Thiago Santos 2012-08-26 16:43:37 -03:00
parent 9fd555c3d0
commit 8c3c7ee47a

View file

@ -1519,9 +1519,21 @@ GST_START_TEST (test_image_location_switching)
g_idle_add (image_location_switch_do_capture, filenames); g_idle_add (image_location_switch_do_capture, filenames);
g_main_loop_run (main_loop); g_main_loop_run (main_loop);
while (1) {
const gchar *filename;
msg = wait_for_element_message (camera, "image-done", GST_CLOCK_TIME_NONE); msg = wait_for_element_message (camera, "image-done", GST_CLOCK_TIME_NONE);
fail_unless (msg != NULL); fail_unless (msg != NULL);
filename =
gst_structure_get_string (gst_message_get_structure (msg), "filename");
if (strcmp (filename,
filenames[LOCATION_SWITCHING_FILENAMES_COUNT - 1]) == 0) {
gst_message_unref (msg); gst_message_unref (msg);
break;
}
gst_message_unref (msg);
}
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);