tests/check/: use the new macro
[platform/upstream/gstreamer.git] / tests / check / pipelines / stress.c
1 /* GStreamer
2  * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20
21 #include <gst/check/gstcheck.h>
22
23
24 GST_START_TEST (test_stress)
25 {
26   GstElement *fakesrc, *fakesink, *pipeline;
27   gint i;
28
29   fakesrc = gst_element_factory_make ("fakesrc", NULL);
30   fakesink = gst_element_factory_make ("fakesink", NULL);
31   pipeline = gst_element_factory_make ("pipeline", NULL);
32
33   g_return_if_fail (fakesrc && fakesink && pipeline);
34
35   gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL);
36   gst_element_link (fakesrc, fakesink);
37
38   i = 100;
39   while (i--) {
40     gst_element_set_state (pipeline, GST_STATE_PAUSED);
41     gst_element_set_state (pipeline, GST_STATE_PLAYING);
42
43     gst_element_set_state (pipeline, GST_STATE_PAUSED);
44     gst_element_set_state (pipeline, GST_STATE_PLAYING);
45     gst_element_set_state (pipeline, GST_STATE_PAUSED);
46     gst_element_set_state (pipeline, GST_STATE_READY);
47     gst_element_set_state (pipeline, GST_STATE_PLAYING);
48     gst_element_set_state (pipeline, GST_STATE_PAUSED);
49     gst_element_set_state (pipeline, GST_STATE_READY);
50     gst_element_set_state (pipeline, GST_STATE_PAUSED);
51     gst_element_set_state (pipeline, GST_STATE_NULL);
52   }
53
54   gst_object_unref (pipeline);
55 }
56
57 GST_END_TEST;
58
59 Suite *
60 stress_suite (void)
61 {
62   Suite *s = suite_create ("stress");
63   TCase *tc_chain = tcase_create ("linear");
64
65   /* time out after 20s, not the default 3 */
66   tcase_set_timeout (tc_chain, 0);
67
68   suite_add_tcase (s, tc_chain);
69   tcase_add_test (tc_chain, test_stress);
70   return s;
71 }
72
73 GST_CHECK_MAIN (stress);