mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 05:22:30 +00:00
tests: remove temporary files when done in camerabin, camerabin2 and jifmux tests
This commit is contained in:
parent
c4abaf1428
commit
3c69286db9
3 changed files with 50 additions and 1 deletions
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <glib/gstdio.h>
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
#include <gst/interfaces/photography.h>
|
#include <gst/interfaces/photography.h>
|
||||||
|
@ -501,6 +502,16 @@ check_file_validity (const gchar * filename, gint num, GstTagList * taglist)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
remove_file (const gchar * fn_template, guint num)
|
||||||
|
{
|
||||||
|
const gchar *fn;
|
||||||
|
|
||||||
|
fn = make_test_file_name (fn_template, num);
|
||||||
|
GST_INFO ("removing %s", fn);
|
||||||
|
g_unlink (fn);
|
||||||
|
}
|
||||||
|
|
||||||
GST_START_TEST (test_single_image_capture)
|
GST_START_TEST (test_single_image_capture)
|
||||||
{
|
{
|
||||||
gboolean ready = FALSE;
|
gboolean ready = FALSE;
|
||||||
|
@ -544,6 +555,7 @@ GST_START_TEST (test_single_image_capture)
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
|
|
||||||
check_file_validity (SINGLE_IMAGE_FILENAME, 0, NULL);
|
check_file_validity (SINGLE_IMAGE_FILENAME, 0, NULL);
|
||||||
|
remove_file (SINGLE_IMAGE_FILENAME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -568,6 +580,7 @@ GST_START_TEST (test_single_image_capture_with_flags)
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
|
|
||||||
check_file_validity (SINGLE_IMAGE_WITH_FLAGS_FILENAME, 0, NULL);
|
check_file_validity (SINGLE_IMAGE_WITH_FLAGS_FILENAME, 0, NULL);
|
||||||
|
remove_file (SINGLE_IMAGE_WITH_FLAGS_FILENAME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -617,6 +630,7 @@ GST_START_TEST (test_video_recording)
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
|
|
||||||
check_file_validity (VIDEO_WITH_FLAGS_FILENAME, 0, NULL);
|
check_file_validity (VIDEO_WITH_FLAGS_FILENAME, 0, NULL);
|
||||||
|
remove_file (VIDEO_WITH_FLAGS_FILENAME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -653,6 +667,7 @@ GST_START_TEST (test_video_recording_with_flags)
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
|
|
||||||
check_file_validity (VIDEO_FILENAME, 0, NULL);
|
check_file_validity (VIDEO_FILENAME, 0, NULL);
|
||||||
|
remove_file (VIDEO_FILENAME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -704,6 +719,7 @@ GST_START_TEST (test_video_recording_pause)
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
|
|
||||||
check_file_validity (VIDEO_PAUSE_FILENAME, 0, NULL);
|
check_file_validity (VIDEO_PAUSE_FILENAME, 0, NULL);
|
||||||
|
remove_file (VIDEO_PAUSE_FILENAME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -740,6 +756,7 @@ GST_START_TEST (test_video_recording_no_audio)
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
|
|
||||||
check_file_validity (VIDEO_NOAUDIO_FILENAME, 0, NULL);
|
check_file_validity (VIDEO_NOAUDIO_FILENAME, 0, NULL);
|
||||||
|
remove_file (VIDEO_NOAUDIO_FILENAME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -767,7 +784,9 @@ GST_START_TEST (test_image_video_cycle)
|
||||||
/* validate all the files */
|
/* validate all the files */
|
||||||
for (i = 2; i > 0; i--) {
|
for (i = 2; i > 0; i--) {
|
||||||
check_file_validity (CYCLE_IMAGE_FILENAME, i, NULL);
|
check_file_validity (CYCLE_IMAGE_FILENAME, i, NULL);
|
||||||
|
remove_file (CYCLE_IMAGE_FILENAME, i);
|
||||||
check_file_validity (CYCLE_VIDEO_FILENAME, i, NULL);
|
check_file_validity (CYCLE_VIDEO_FILENAME, i, NULL);
|
||||||
|
remove_file (CYCLE_VIDEO_FILENAME, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,6 +815,7 @@ GST_START_TEST (test_image_tags_setting)
|
||||||
for (i = 0; i < SEQUENTIAL_IMAGES_COUNT; i++) {
|
for (i = 0; i < SEQUENTIAL_IMAGES_COUNT; i++) {
|
||||||
check_file_validity (SEQUENTIAL_IMAGES_FILENAME, i,
|
check_file_validity (SEQUENTIAL_IMAGES_FILENAME, i,
|
||||||
taglists[i % TAGLISTS_COUNT]);
|
taglists[i % TAGLISTS_COUNT]);
|
||||||
|
remove_file (SEQUENTIAL_IMAGES_FILENAME, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <glib/gstdio.h>
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
@ -434,8 +435,9 @@ teardown (void)
|
||||||
tags_found = NULL;
|
tags_found = NULL;
|
||||||
|
|
||||||
g_free (video_filename);
|
g_free (video_filename);
|
||||||
g_free (image_filename);
|
|
||||||
video_filename = NULL;
|
video_filename = NULL;
|
||||||
|
|
||||||
|
g_free (image_filename);
|
||||||
image_filename = NULL;
|
image_filename = NULL;
|
||||||
|
|
||||||
GST_INFO ("done");
|
GST_INFO ("done");
|
||||||
|
@ -569,6 +571,16 @@ check_file_validity (const gchar * filename, gint num, GstTagList * taglist,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
remove_file (const gchar * fn_template, guint num)
|
||||||
|
{
|
||||||
|
const gchar *fn;
|
||||||
|
|
||||||
|
fn = make_const_file_name (fn_template, num);
|
||||||
|
GST_INFO ("removing %s", fn);
|
||||||
|
g_unlink (fn);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
filter_buffer_count (GstPad * pad, GstMiniObject * obj, gpointer data)
|
filter_buffer_count (GstPad * pad, GstMiniObject * obj, gpointer data)
|
||||||
{
|
{
|
||||||
|
@ -676,6 +688,7 @@ GST_START_TEST (test_single_image_capture)
|
||||||
wait_for_idle_state ();
|
wait_for_idle_state ();
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
check_file_validity (image_filename, 0, NULL, 0, 0, NO_AUDIO);
|
check_file_validity (image_filename, 0, NULL, 0, 0, NO_AUDIO);
|
||||||
|
remove_file (image_filename, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -730,6 +743,7 @@ GST_START_TEST (test_multiple_image_captures)
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
check_file_validity (image_filename, i, NULL, widths[i], heights[i],
|
check_file_validity (image_filename, i, NULL, widths[i], heights[i],
|
||||||
NO_AUDIO);
|
NO_AUDIO);
|
||||||
|
remove_file (image_filename, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,6 +793,8 @@ GST_START_TEST (test_single_video_recording)
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
|
|
||||||
check_file_validity (video_filename, 0, NULL, 0, 0, WITH_AUDIO);
|
check_file_validity (video_filename, 0, NULL, 0, 0, WITH_AUDIO);
|
||||||
|
remove_file (video_filename, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -850,6 +866,7 @@ GST_START_TEST (test_multiple_video_recordings)
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
check_file_validity (video_filename, i, NULL, widths[i], heights[i],
|
check_file_validity (video_filename, i, NULL, widths[i], heights[i],
|
||||||
WITH_AUDIO);
|
WITH_AUDIO);
|
||||||
|
remove_file (video_filename, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,7 +931,9 @@ GST_START_TEST (test_image_video_cycle)
|
||||||
/* validate all the files */
|
/* validate all the files */
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
check_file_validity (image_filename, i, NULL, 0, 0, NO_AUDIO);
|
check_file_validity (image_filename, i, NULL, 0, 0, NO_AUDIO);
|
||||||
|
remove_file (image_filename, i);
|
||||||
check_file_validity (video_filename, i, NULL, 0, 0, WITH_AUDIO);
|
check_file_validity (video_filename, i, NULL, 0, 0, WITH_AUDIO);
|
||||||
|
remove_file (video_filename, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,6 +980,7 @@ GST_START_TEST (test_image_capture_previews)
|
||||||
gst_message_unref (msg);
|
gst_message_unref (msg);
|
||||||
|
|
||||||
check_preview_image (camera, image_filename, i);
|
check_preview_image (camera, image_filename, i);
|
||||||
|
remove_file (image_filename, i);
|
||||||
|
|
||||||
if (preview_buffer)
|
if (preview_buffer)
|
||||||
gst_buffer_unref (preview_buffer);
|
gst_buffer_unref (preview_buffer);
|
||||||
|
@ -1040,6 +1060,7 @@ GST_START_TEST (test_image_capture_with_tags)
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
check_file_validity (image_filename, i, taglists[i], 0, 0, NO_AUDIO);
|
check_file_validity (image_filename, i, taglists[i], 0, 0, NO_AUDIO);
|
||||||
gst_tag_list_free (taglists[i]);
|
gst_tag_list_free (taglists[i]);
|
||||||
|
remove_file (image_filename, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1117,6 +1138,7 @@ GST_START_TEST (test_video_capture_with_tags)
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
check_file_validity (video_filename, i, taglists[i], 0, 0, NO_AUDIO);
|
check_file_validity (video_filename, i, taglists[i], 0, 0, NO_AUDIO);
|
||||||
gst_tag_list_free (taglists[i]);
|
gst_tag_list_free (taglists[i]);
|
||||||
|
remove_file (video_filename, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,6 +1240,7 @@ GST_START_TEST (test_idle_property)
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
|
|
||||||
check_file_validity (video_filename, 0, NULL, 0, 0, WITH_AUDIO);
|
check_file_validity (video_filename, 0, NULL, 0, 0, WITH_AUDIO);
|
||||||
|
remove_file (video_filename, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -1284,6 +1307,7 @@ GST_START_TEST (test_image_custom_filter)
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
check_file_validity (image_filename, 0, NULL, 0, 0, NO_AUDIO);
|
check_file_validity (image_filename, 0, NULL, 0, 0, NO_AUDIO);
|
||||||
|
remove_file (image_filename, 0);
|
||||||
|
|
||||||
fail_unless (vf_probe_counter > 0);
|
fail_unless (vf_probe_counter > 0);
|
||||||
fail_unless (image_probe_counter == 1);
|
fail_unless (image_probe_counter == 1);
|
||||||
|
@ -1365,6 +1389,7 @@ GST_START_TEST (test_video_custom_filter)
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
check_file_validity (video_filename, 0, NULL, 0, 0, WITH_AUDIO);
|
check_file_validity (video_filename, 0, NULL, 0, 0, WITH_AUDIO);
|
||||||
|
remove_file (video_filename, 0);
|
||||||
|
|
||||||
fail_unless (vf_probe_counter > 0);
|
fail_unless (vf_probe_counter > 0);
|
||||||
fail_unless (video_probe_counter > 0);
|
fail_unless (video_probe_counter > 0);
|
||||||
|
@ -1467,6 +1492,7 @@ GST_START_TEST (test_image_location_switching)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < LOCATION_SWITCHING_FILENAMES_COUNT; i++) {
|
for (i = 0; i < LOCATION_SWITCHING_FILENAMES_COUNT; i++) {
|
||||||
|
g_unlink (filenames[i]);
|
||||||
g_free (filenames[i]);
|
g_free (filenames[i]);
|
||||||
}
|
}
|
||||||
g_signal_handler_disconnect (src, notify_id);
|
g_signal_handler_disconnect (src, notify_id);
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
#include <gst/tag/tag.h>
|
#include <gst/tag/tag.h>
|
||||||
|
|
||||||
|
@ -1200,6 +1202,7 @@ GST_START_TEST (test_jifmux_tags)
|
||||||
tmpfile);
|
tmpfile);
|
||||||
libexif_check_tags (FILE_SOURCE_TAG ("transparent-scanner"), tmpfile);
|
libexif_check_tags (FILE_SOURCE_TAG ("transparent-scanner"), tmpfile);
|
||||||
|
|
||||||
|
g_unlink (tmpfile);
|
||||||
g_free (tmpfile);
|
g_free (tmpfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue