Initialize Tizen 2.3
[framework/multimedia/gstreamer0.10.git] / wearable / tests / check / gst / gst.c
1 /* GStreamer
2  * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
3  *
4  * gst.c: Unit test for gst.c
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #include <gst/check/gstcheck.h>
23 #include <gst/gstversion.h>
24
25 GST_START_TEST (test_init)
26 {
27   /* don't segfault with NULL, NULL */
28   gst_init (NULL, NULL);
29   /* allow calling twice. well, actually, thrice. */
30   gst_init (NULL, NULL);
31 }
32
33 GST_END_TEST;
34
35 GST_START_TEST (test_deinit)
36 {
37   gst_init (NULL, NULL);
38
39   gst_deinit ();
40 }
41
42 GST_END_TEST;
43
44 GST_START_TEST (test_deinit_sysclock)
45 {
46   GstClock *clock;
47
48   gst_init (NULL, NULL);
49
50   clock = gst_system_clock_obtain ();
51   gst_object_unref (clock);
52
53   gst_deinit ();
54 }
55
56 GST_END_TEST;
57
58 /* tests if we can create an element from a compiled-in plugin */
59 GST_START_TEST (test_new_pipeline)
60 {
61   GstElement *pipeline;
62
63   pipeline = gst_pipeline_new ("pipeline");
64   gst_object_unref (pipeline);
65 }
66
67 GST_END_TEST;
68
69 /* tests if we can load an element from a plugin */
70 GST_START_TEST (test_new_fakesrc)
71 {
72   GstElement *element;
73
74   element = gst_element_factory_make ("fakesrc", NULL);
75   gst_object_unref (element);
76 }
77
78 GST_END_TEST;
79
80 GST_START_TEST (test_version)
81 {
82   guint major, minor, micro, nano;
83   gchar *version;
84
85   gst_version (&major, &minor, &micro, &nano);
86   assert_equals_int (major, GST_VERSION_MAJOR);
87
88   version = gst_version_string ();
89   fail_if (version == NULL);
90   g_free (version);
91 }
92
93 GST_END_TEST;
94
95 static Suite *
96 gst_suite (void)
97 {
98   Suite *s = suite_create ("Gst");
99   TCase *tc_chain = tcase_create ("gst tests");
100
101   suite_add_tcase (s, tc_chain);
102   tcase_add_test (tc_chain, test_init);
103   tcase_add_test (tc_chain, test_new_pipeline);
104   tcase_add_test (tc_chain, test_new_fakesrc);
105   tcase_add_test (tc_chain, test_version);
106   /* run these last so the others don't fail if CK_FORK=no is being used */
107   tcase_add_test (tc_chain, test_deinit_sysclock);
108   tcase_add_test (tc_chain, test_deinit);
109
110   return s;
111 }
112
113 GST_CHECK_MAIN (gst);