caps: improve _do_simplify
[platform/upstream/gstreamer.git] / tests / check / gst / gstchildproxy.c
1 /* GStreamer
2  * Copyright (C) 2009 Stefan Kost <ensonic@users.sf.net>
3  *
4  * gstchildproxy.c: Unit test for GstChildProxy interface
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
24 GST_START_TEST (test_get)
25 {
26   GstElement *pipeline;
27   gchar *name;
28
29   pipeline = gst_pipeline_new ("foo");
30   fail_unless (pipeline != NULL, "Could not create pipeline");
31
32   gst_child_proxy_get (GST_OBJECT (pipeline), "name", &name, NULL);
33   fail_if (g_strcmp0 ("foo", name));
34   g_free (name);
35
36   gst_object_unref (pipeline);
37 }
38
39 GST_END_TEST;
40
41 GST_START_TEST (test_child_get)
42 {
43   GstElement *pipeline, *elem;
44   gchar *name;
45
46   pipeline = gst_pipeline_new (NULL);
47   fail_unless (pipeline != NULL, "Could not create pipeline");
48
49   elem = gst_element_factory_make ("fakesrc", "src");
50   fail_if (elem == NULL, "Could not create fakesrc");
51
52   gst_bin_add (GST_BIN (pipeline), elem);
53
54   gst_child_proxy_get (GST_OBJECT (pipeline), "src::name", &name, NULL);
55   fail_if (g_strcmp0 ("src", name));
56   g_free (name);
57
58   gst_object_unref (pipeline);
59 }
60
61 GST_END_TEST;
62
63
64 static Suite *
65 gst_child_proxy_suite (void)
66 {
67   Suite *s = suite_create ("GstChildProxy");
68   TCase *tc_chain = tcase_create ("child proxy tests");
69
70   tcase_set_timeout (tc_chain, 0);
71
72   suite_add_tcase (s, tc_chain);
73   tcase_add_test (tc_chain, test_get);
74   tcase_add_test (tc_chain, test_child_get);
75
76   return s;
77 }
78
79 GST_CHECK_MAIN (gst_child_proxy);