3 * Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.co.uk>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #include <gst/check/gstcheck.h>
31 on_message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
33 OnMessageUserData *d = user_data;
35 switch (GST_MESSAGE_TYPE (message)) {
36 case GST_MESSAGE_ERROR:
37 case GST_MESSAGE_WARNING:
38 g_assert_not_reached ();
41 g_main_loop_quit (d->loop);
50 run_test (const gchar * pipeline_string)
55 OnMessageUserData omud = { NULL, };
56 GstStateChangeReturn ret;
58 GST_DEBUG ("Testing pipeline '%s'", pipeline_string);
60 pipeline = gst_parse_launch (pipeline_string, NULL);
61 fail_unless (pipeline != NULL);
62 g_object_set (G_OBJECT (pipeline), "async-handling", TRUE, NULL);
64 loop = g_main_loop_new (NULL, FALSE);
66 bus = gst_element_get_bus (pipeline);
67 fail_unless (bus != NULL);
68 gst_bus_add_signal_watch (bus);
73 g_signal_connect (bus, "message", (GCallback) on_message_cb, &omud);
75 gst_object_unref (bus);
77 ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
78 fail_unless (ret == GST_STATE_CHANGE_SUCCESS
79 || ret == GST_STATE_CHANGE_ASYNC);
81 g_main_loop_run (loop);
83 fail_unless (gst_element_set_state (pipeline,
84 GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS);
86 fail_unless (omud.eos == TRUE);
88 gst_object_unref (pipeline);
89 g_main_loop_unref (loop);
92 #define CREATE_TEST(element) \
93 GST_START_TEST (test_##element) \
97 pipeline = g_strdup_printf ("videotestsrc num-buffers=100 ! " \
98 "ffmpegcolorspace ! " \
100 " fakesink", #element); \
102 run_test (pipeline); \
108 CREATE_TEST (agingtv);
109 CREATE_TEST (dicetv);
110 CREATE_TEST (edgetv);
112 CREATE_TEST (quarktv);
113 CREATE_TEST (radioactv);
115 CREATE_TEST (rippletv);
116 CREATE_TEST (shagadelictv);
117 CREATE_TEST (streaktv);
118 CREATE_TEST (vertigotv);
119 CREATE_TEST (warptv);
124 Suite *s = suite_create ("effectv");
125 TCase *tc_chain = tcase_create ("general");
127 suite_add_tcase (s, tc_chain);
128 tcase_set_timeout (tc_chain, 180);
130 tcase_add_test (tc_chain, test_agingtv);
131 tcase_add_test (tc_chain, test_dicetv);
132 tcase_add_test (tc_chain, test_edgetv);
133 tcase_add_test (tc_chain, test_optv);
134 tcase_add_test (tc_chain, test_quarktv);
135 tcase_add_test (tc_chain, test_radioactv);
136 tcase_add_test (tc_chain, test_revtv);
137 tcase_add_test (tc_chain, test_rippletv);
138 tcase_add_test (tc_chain, test_shagadelictv);
139 tcase_add_test (tc_chain, test_streaktv);
140 tcase_add_test (tc_chain, test_vertigotv);
141 tcase_add_test (tc_chain, test_warptv);
146 GST_CHECK_MAIN (effectv);