summaryrefslogtreecommitdiff
path: root/tests/check/pipelines/mimic.c
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>2009-09-18 18:45:09 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.co.uk>2009-10-06 18:08:40 -0400
commit461c1727a22c165e4503f8078121cb4861160e2c (patch)
tree4090bdc907f17348a8c16971f81c5b9a1d4662e7 /tests/check/pipelines/mimic.c
parent1d2d68e050e99981a2e90bf2815b59d2975e0164 (diff)
tests: Add test for mimic elements
Diffstat (limited to 'tests/check/pipelines/mimic.c')
-rw-r--r--tests/check/pipelines/mimic.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/check/pipelines/mimic.c b/tests/check/pipelines/mimic.c
new file mode 100644
index 000000000..5d51a80be
--- /dev/null
+++ b/tests/check/pipelines/mimic.c
@@ -0,0 +1,79 @@
+/* GStreamer
+ *
+ * unit test for mimic
+ *
+ * Copyright 2009 Collabora Ltd.
+ * @author: Olivier Crete <olivier.crete@collabora.co.uk>
+ * Copyright 2009 Nokia Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gst/check/gstcheck.h>
+
+static GMainLoop *loop;
+
+static void
+eos_message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
+{
+ GST_DEBUG ("Received eos");
+ g_main_loop_quit (loop);
+}
+
+GST_START_TEST (test_mimic_pipeline)
+{
+ GstElement *pipeline;
+ GError *error = NULL;
+ GstBus *bus;
+ const gchar *bin_str = "videotestsrc num-buffers=10 ! mimenc ! "
+ "mimdec ! fakesink";
+
+ pipeline = gst_parse_launch (bin_str, &error);
+ fail_unless (pipeline != NULL, "Error parsing pipeline: %s", bin_str,
+ error ? error->message : "(invalid error)");
+
+ loop = g_main_loop_new (NULL, FALSE);
+ bus = gst_element_get_bus (pipeline);
+ gst_bus_add_signal_watch (bus);
+ g_signal_connect (bus, "message::eos", (GCallback) eos_message_cb, NULL);
+ gst_object_unref (bus);
+
+ fail_unless (gst_element_set_state (pipeline, GST_STATE_PLAYING)
+ != GST_STATE_CHANGE_FAILURE);
+
+ g_main_loop_run (loop);
+ g_main_loop_unref (loop);
+
+ gst_element_set_state (pipeline, GST_STATE_NULL);
+ gst_object_unref (pipeline);
+}
+
+GST_END_TEST;
+
+static Suite *
+mimic_suite (void)
+{
+ Suite *s = suite_create ("mimic");
+ TCase *tc_chain;
+
+ tc_chain = tcase_create ("mimic_pipeline");
+ tcase_add_test (tc_chain, test_mimic_pipeline);
+ suite_add_tcase (s, tc_chain);
+
+ return s;
+}
+
+GST_CHECK_MAIN (mimic)