• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24 
25 #include <gst/check/gstcheck.h>
26 
GST_START_TEST(test_get)27 GST_START_TEST (test_get)
28 {
29   GstElement *pipeline;
30   gchar *name;
31 
32   pipeline = gst_pipeline_new ("foo");
33   fail_unless (pipeline != NULL, "Could not create pipeline");
34 
35   gst_child_proxy_get (GST_CHILD_PROXY (pipeline), "name", &name, NULL);
36   fail_if (g_strcmp0 ("foo", name));
37   g_free (name);
38 
39   gst_object_unref (pipeline);
40 }
41 
42 GST_END_TEST;
43 
GST_START_TEST(test_child_get)44 GST_START_TEST (test_child_get)
45 {
46   GstElement *pipeline, *elem;
47   gchar *name;
48 
49   pipeline = gst_pipeline_new (NULL);
50   fail_unless (pipeline != NULL, "Could not create pipeline");
51 
52   elem = gst_element_factory_make ("fakesrc", "src");
53   fail_if (elem == NULL, "Could not create fakesrc");
54 
55   gst_bin_add (GST_BIN (pipeline), elem);
56 
57   gst_child_proxy_get (GST_CHILD_PROXY (pipeline), "src::name", &name, NULL);
58   fail_if (g_strcmp0 ("src", name));
59   g_free (name);
60 
61   gst_object_unref (pipeline);
62 }
63 
64 GST_END_TEST;
65 
66 
67 static Suite *
gst_child_proxy_suite(void)68 gst_child_proxy_suite (void)
69 {
70   Suite *s = suite_create ("GstChildProxy");
71   TCase *tc_chain = tcase_create ("child proxy tests");
72 
73   tcase_set_timeout (tc_chain, 0);
74 
75   suite_add_tcase (s, tc_chain);
76   tcase_add_test (tc_chain, test_get);
77   tcase_add_test (tc_chain, test_child_get);
78 
79   return s;
80 }
81 
82 GST_CHECK_MAIN (gst_child_proxy);
83