summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/wavparse.c63
-rw-r--r--tests/files/Makefile.am1
-rw-r--r--tests/files/audiotestsrc.wavbin0 -> 6200 bytes
3 files changed, 64 insertions, 0 deletions
diff --git a/tests/check/elements/wavparse.c b/tests/check/elements/wavparse.c
index 10e2ea707..ac9110651 100644
--- a/tests/check/elements/wavparse.c
+++ b/tests/check/elements/wavparse.c
@@ -21,6 +21,67 @@
#include <gst/check/gstcheck.h>
+#define SIMPLE_WAV_PATH GST_TEST_FILES_PATH G_DIR_SEPARATOR_S "audiotestsrc.wav"
+
+static void
+do_test_simple_file (GstPadMode mode)
+{
+ GstStateChangeReturn ret;
+ GstElement *pipeline;
+ GstElement *src, *q = NULL;
+ GstElement *wavparse;
+ GstElement *fakesink;
+ GstMessage *msg;
+
+ pipeline = gst_pipeline_new ("testpipe");
+ src = gst_element_factory_make ("filesrc", NULL);
+ fail_if (src == NULL);
+ if (mode == GST_PAD_MODE_PUSH)
+ q = gst_element_factory_make ("queue", NULL);
+ wavparse = gst_element_factory_make ("wavparse", NULL);
+ fail_if (wavparse == NULL);
+ fakesink = gst_element_factory_make ("fakesink", NULL);
+ fail_if (fakesink == NULL);
+
+ gst_bin_add_many (GST_BIN (pipeline), src, wavparse, fakesink, q, NULL);
+
+ g_object_set (src, "location", SIMPLE_WAV_PATH, NULL);
+
+ if (mode == GST_PAD_MODE_PUSH)
+ fail_unless (gst_element_link_many (src, q, wavparse, fakesink, NULL));
+ else
+ fail_unless (gst_element_link_many (src, wavparse, fakesink, NULL));
+
+ ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
+ fail_unless_equals_int (ret, GST_STATE_CHANGE_ASYNC);
+
+ ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
+ fail_unless_equals_int (ret, GST_STATE_CHANGE_SUCCESS);
+
+ msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline),
+ GST_CLOCK_TIME_NONE, GST_MESSAGE_EOS | GST_MESSAGE_ERROR);
+
+ fail_unless_equals_string (GST_MESSAGE_TYPE_NAME (msg), "eos");
+
+ gst_message_unref (msg);
+ gst_element_set_state (pipeline, GST_STATE_NULL);
+ gst_object_unref (pipeline);
+}
+
+GST_START_TEST (test_simple_file_pull)
+{
+ do_test_simple_file (TRUE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_simple_file_push)
+{
+ do_test_simple_file (FALSE);
+}
+
+GST_END_TEST;
+
static void
do_test_empty_file (gboolean can_activate_pull)
{
@@ -81,6 +142,8 @@ wavparse_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_empty_file_pull);
tcase_add_test (tc_chain, test_empty_file_push);
+ tcase_add_test (tc_chain, test_simple_file_pull);
+ tcase_add_test (tc_chain, test_simple_file_push);
return s;
}
diff --git a/tests/files/Makefile.am b/tests/files/Makefile.am
index bd3282b91..3bf6aef9d 100644
--- a/tests/files/Makefile.am
+++ b/tests/files/Makefile.am
@@ -1,6 +1,7 @@
EXTRA_DIST = \
audiotestsrc.flac \
+ audiotestsrc.wav \
gradient.j2k \
id3-407349-1.tag \
id3-407349-2.tag \
diff --git a/tests/files/audiotestsrc.wav b/tests/files/audiotestsrc.wav
new file mode 100644
index 000000000..5a7f02e76
--- /dev/null
+++ b/tests/files/audiotestsrc.wav
Binary files differ