From 752dd15c54238c389f676105867ff7815d623ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 3 Nov 2016 13:27:51 +0000 Subject: [PATCH] tests: wavparse: add test for processing an actual .wav file https://bugzilla.gnome.org/show_bug.cgi?id=773861 --- tests/check/elements/wavparse.c | 63 ++++++++++++++++++++++++++++++++ tests/files/Makefile.am | 1 + tests/files/audiotestsrc.wav | Bin 0 -> 6200 bytes 3 files changed, 64 insertions(+) create mode 100644 tests/files/audiotestsrc.wav diff --git a/tests/check/elements/wavparse.c b/tests/check/elements/wavparse.c index 10e2ea7076..ac91106519 100644 --- a/tests/check/elements/wavparse.c +++ b/tests/check/elements/wavparse.c @@ -21,6 +21,67 @@ #include +#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 bd3282b917..3bf6aef9d3 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 0000000000000000000000000000000000000000..5a7f02e760a937243f2d6158f376cc8eb09a8aef GIT binary patch literal 6200 zcmeI1^;?wb+lPlzQa}OePU(>DX6S|)rso-TRaSS^?<&R`sH?lHi@N$e(=!a+F?2W5 zAt2odC?GBM@^8GyvB&-E{o{3hKG$(xAwHg-CbBSCq)UVc>FNzt2^b8NWM9 zmxr7DNRdLx!?Q-p&YDK&){LK=pS0z3o^^ld)9XJF{73j~)I9PpbRV_^Z%>Q{BuF@t zFR24qBr*vbxEah1R1)HDhpbvSDA3UKM&Qy&CPcpLXH zn|v$93-MDwkKFrI(53jXxZzcGQW;NCQXZH!miAlnmBcdUCHigZ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