caps: improve _do_simplify
[platform/upstream/gstreamer.git] / tests / check / gst / gstcontroller.c
1 /* GStreamer
2  *
3  * unit test for the controller library
4  *
5  * Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
6  * Copyright (C) <2006-2007> Sebastian Dröge <slomo@circular-chaos.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27 #include <gst/gst.h>
28 #include <gst/check/gstcheck.h>
29
30
31 /* local test element */
32
33 enum
34 {
35   PROP_INT = 1,
36   PROP_FLOAT,
37   PROP_DOUBLE,
38   PROP_BOOLEAN,
39   PROP_READONLY,
40   PROP_STATIC,
41   PROP_CONSTRUCTONLY,
42   PROP_COUNT
43 };
44
45 #define GST_TYPE_TEST_OBJ            (gst_test_obj_get_type ())
46 #define GST_TEST_OBJ(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TEST_OBJ, GstTestObj))
47 #define GST_TEST_OBJ_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TEST_OBJ, GstTestObjClass))
48 #define GST_IS_TEST_OBJ(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TEST_OBJ))
49 #define GST_IS_TEST_OBJ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TEST_OBJ))
50 #define GST_TEST_OBJ_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TEST_OBJ, GstTestObjClass))
51
52 typedef struct _GstTestObj GstTestObj;
53 typedef struct _GstTestObjClass GstTestObjClass;
54
55 struct _GstTestObj
56 {
57   GstElement parent;
58   gint val_int;
59   gfloat val_float;
60   gdouble val_double;
61   gboolean val_boolean;
62 };
63 struct _GstTestObjClass
64 {
65   GstElementClass parent_class;
66 };
67
68 static GType gst_test_obj_get_type (void);
69
70 static void
71 gst_test_obj_get_property (GObject * object,
72     guint property_id, GValue * value, GParamSpec * pspec)
73 {
74   GstTestObj *self = GST_TEST_OBJ (object);
75
76   switch (property_id) {
77     case PROP_INT:
78       g_value_set_int (value, self->val_int);
79       break;
80     case PROP_FLOAT:
81       g_value_set_float (value, self->val_float);
82       break;
83     case PROP_DOUBLE:
84       g_value_set_double (value, self->val_double);
85       break;
86     case PROP_BOOLEAN:
87       g_value_set_boolean (value, self->val_boolean);
88       break;
89     default:
90       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
91       break;
92   }
93 }
94
95 static void
96 gst_test_obj_set_property (GObject * object,
97     guint property_id, const GValue * value, GParamSpec * pspec)
98 {
99   GstTestObj *self = GST_TEST_OBJ (object);
100
101   switch (property_id) {
102     case PROP_INT:
103       self->val_int = g_value_get_int (value);
104       GST_DEBUG ("test value int=%d", self->val_int);
105       break;
106     case PROP_FLOAT:
107       self->val_float = g_value_get_float (value);
108       GST_DEBUG ("test value float=%f", self->val_float);
109       break;
110     case PROP_DOUBLE:
111       self->val_double = g_value_get_double (value);
112       GST_DEBUG ("test value double=%lf", self->val_double);
113       break;
114     case PROP_BOOLEAN:
115       self->val_boolean = g_value_get_boolean (value);
116       GST_DEBUG ("test value boolean=%d", self->val_boolean);
117       break;
118     case PROP_CONSTRUCTONLY:
119       break;
120     default:
121       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
122       break;
123   }
124 }
125
126 static void
127 gst_test_obj_class_init (GstTestObjClass * klass)
128 {
129   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
130
131   gobject_class->set_property = gst_test_obj_set_property;
132   gobject_class->get_property = gst_test_obj_get_property;
133
134   g_object_class_install_property (gobject_class, PROP_INT,
135       g_param_spec_int ("int",
136           "int prop",
137           "int number parameter",
138           0, 100, 0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
139
140   g_object_class_install_property (gobject_class, PROP_FLOAT,
141       g_param_spec_float ("float",
142           "float prop",
143           "float number parameter",
144           0.0, 100.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
145
146   g_object_class_install_property (gobject_class, PROP_DOUBLE,
147       g_param_spec_double ("double",
148           "double prop",
149           "double number parameter",
150           0.0, 100.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
151
152   g_object_class_install_property (gobject_class, PROP_BOOLEAN,
153       g_param_spec_boolean ("boolean",
154           "boolean prop",
155           "boolean parameter",
156           FALSE, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
157
158   g_object_class_install_property (gobject_class, PROP_READONLY,
159       g_param_spec_int ("readonly",
160           "readonly prop",
161           "readonly parameter",
162           0, G_MAXINT, 0, G_PARAM_READABLE | GST_PARAM_CONTROLLABLE));
163
164   g_object_class_install_property (gobject_class, PROP_STATIC,
165       g_param_spec_int ("static",
166           "static prop",
167           "static parameter", 0, G_MAXINT, 0, G_PARAM_READWRITE));
168
169   g_object_class_install_property (gobject_class, PROP_CONSTRUCTONLY,
170       g_param_spec_int ("construct-only",
171           "construct-only prop",
172           "construct-only parameter",
173           0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
174 }
175
176 static void
177 gst_test_obj_base_init (GstTestObjClass * klass)
178 {
179   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
180
181   gst_element_class_set_details_simple (element_class,
182       "test object for unit tests",
183       "Test", "Use in unit tests", "Stefan Sauer <ensonic@users.sf.net>");
184 }
185
186 static GType
187 gst_test_obj_get_type (void)
188 {
189   static volatile gsize test_obj_type = 0;
190
191   if (g_once_init_enter (&test_obj_type)) {
192     GType type;
193     static const GTypeInfo info = {
194       (guint16) sizeof (GstTestObjClass),
195       (GBaseInitFunc) gst_test_obj_base_init,   // base_init
196       NULL,                     // base_finalize
197       (GClassInitFunc) gst_test_obj_class_init, // class_init
198       NULL,                     // class_finalize
199       NULL,                     // class_data
200       (guint16) sizeof (GstTestObj),
201       0,                        // n_preallocs
202       NULL,                     // instance_init
203       NULL                      // value_table
204     };
205     type = g_type_register_static (GST_TYPE_ELEMENT, "GstTestObj", &info, 0);
206     g_once_init_leave (&test_obj_type, type);
207   }
208   return test_obj_type;
209 }
210
211 /* test control source */
212
213 #define GST_TYPE_TEST_CONTROL_SOURCE            (gst_test_control_source_get_type ())
214 #define GST_TEST_CONTROL_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TEST_CONTROL_SOURCE, GstTestControlSource))
215 #define GST_TEST_CONTROL_SOURCE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TEST_CONTROL_SOURCE, GstTestControlSourceClass))
216 #define GST_IS_TEST_CONTROL_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TEST_CONTROL_SOURCE))
217 #define GST_IS_TEST_CONTROL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TEST_CONTROL_SOURCE))
218 #define GST_TEST_CONTROL_SOURCE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TEST_CONTROL_SOURCE, GstTestControlSourceClass))
219
220 typedef struct _GstTestControlSource GstTestControlSource;
221 typedef struct _GstTestControlSourceClass GstTestControlSourceClass;
222
223 struct _GstTestControlSource
224 {
225   GstControlSource parent;
226
227   gdouble value;
228 };
229 struct _GstTestControlSourceClass
230 {
231   GstControlSourceClass parent_class;
232 };
233
234 static GType gst_test_control_source_get_type (void);
235
236 static GstTestControlSource *
237 gst_test_control_source_new (void)
238 {
239   return g_object_newv (GST_TYPE_TEST_CONTROL_SOURCE, 0, NULL);
240 }
241
242 static gboolean
243 gst_test_control_source_get (GstTestControlSource * self,
244     GstClockTime timestamp, gdouble * value)
245 {
246   *value = self->value;
247   return TRUE;
248 }
249
250 static gboolean
251 gst_test_control_source_get_value_array (GstTestControlSource * self,
252     GstClockTime timestamp, GstClockTime interval, guint n_values,
253     gdouble * values)
254 {
255   guint i;
256
257   for (i = 0; i < n_values; i++) {
258     *values = self->value;
259     values++;
260   }
261   return TRUE;
262 }
263
264 static void
265 gst_test_control_source_init (GstTestControlSource * self)
266 {
267   GstControlSource *cs = (GstControlSource *) self;
268
269   cs->get_value = (GstControlSourceGetValue) gst_test_control_source_get;
270   cs->get_value_array = (GstControlSourceGetValueArray)
271       gst_test_control_source_get_value_array;
272   self->value = 0.0;
273 }
274
275 static GType
276 gst_test_control_source_get_type (void)
277 {
278   static volatile gsize test_countrol_source_type = 0;
279
280   if (g_once_init_enter (&test_countrol_source_type)) {
281     GType type;
282     static const GTypeInfo info = {
283       (guint16) sizeof (GstTestControlSourceClass),
284       NULL,                     // base_init
285       NULL,                     // base_finalize
286       NULL,                     // class_init
287       NULL,                     // class_finalize
288       NULL,                     // class_data
289       (guint16) sizeof (GstTestControlSource),
290       0,                        // n_preallocs
291       (GInstanceInitFunc) gst_test_control_source_init, // instance_init
292       NULL                      // value_table
293     };
294     type =
295         g_type_register_static (GST_TYPE_CONTROL_SOURCE, "GstTestControlSource",
296         &info, 0);
297     g_once_init_leave (&test_countrol_source_type, type);
298   }
299   return test_countrol_source_type;
300 }
301
302 /* test control binding */
303
304 #define GST_TYPE_TEST_CONTROL_BINDING            (gst_test_control_binding_get_type ())
305 #define GST_TEST_CONTROL_BINDING(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TEST_CONTROL_BINDING, GstTestControlBinding))
306 #define GST_TEST_CONTROL_BINDING_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TEST_CONTROL_BINDING, GstTestControlBindingClass))
307 #define GST_IS_TEST_CONTROL_BINDING(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TEST_CONTROL_BINDING))
308 #define GST_IS_TEST_CONTROL_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TEST_CONTROL_BINDING))
309 #define GST_TEST_CONTROL_BINDING_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TEST_CONTROL_BINDING, GstTestControlBindingClass))
310
311 typedef struct _GstTestControlBinding GstTestControlBinding;
312 typedef struct _GstTestControlBindingClass GstTestControlBindingClass;
313
314 struct _GstTestControlBinding
315 {
316   GstControlBinding parent;
317
318   GstControlSource *cs;
319 };
320 struct _GstTestControlBindingClass
321 {
322   GstControlBindingClass parent_class;
323 };
324
325 static GType gst_test_control_binding_get_type (void);
326
327 static GstControlBinding *
328 gst_test_control_binding_new (GstObject * object, const gchar * property_name,
329     GstControlSource * cs)
330 {
331   GstTestControlBinding *self;
332   self = (GstTestControlBinding *) g_object_new (GST_TYPE_TEST_CONTROL_BINDING,
333       "object", object, "name", property_name, NULL);
334
335   self->cs = gst_object_ref (cs);
336
337   return (GstControlBinding *) self;
338 }
339
340 static GstControlSource *
341 gst_test_control_binding_get_control_source (GstTestControlBinding * self)
342 {
343   g_return_val_if_fail (GST_IS_TEST_CONTROL_BINDING (self), NULL);
344
345   return self->cs ? gst_object_ref (self->cs) : NULL;
346 }
347
348 static GType
349 gst_test_control_binding_get_type (void)
350 {
351   static volatile gsize test_countrol_source_type = 0;
352
353   if (g_once_init_enter (&test_countrol_source_type)) {
354     GType type;
355     static const GTypeInfo info = {
356       (guint16) sizeof (GstTestControlBindingClass),
357       NULL,                     // base_init
358       NULL,                     // base_finalize
359       NULL,                     // class_init
360       NULL,                     // class_finalize
361       NULL,                     // class_data
362       (guint16) sizeof (GstTestControlBinding),
363       0,                        // n_preallocs
364       NULL,                     // instance_init
365       NULL                      // value_table
366     };
367     type =
368         g_type_register_static (GST_TYPE_CONTROL_BINDING,
369         "GstTestControlBinding", &info, 0);
370     g_once_init_leave (&test_countrol_source_type, type);
371   }
372   return test_countrol_source_type;
373 }
374
375
376 static void
377 setup (void)
378 {
379   gst_element_register (NULL, "testobj", GST_RANK_NONE, GST_TYPE_TEST_OBJ);
380 }
381
382 static void
383 teardown (void)
384 {
385 }
386
387
388 /* TESTS */
389
390 /* tests for an element with no controlled params */
391 GST_START_TEST (controller_new_fail1)
392 {
393   GstElement *elem;
394   GstTestControlSource *cs;
395   GstControlBinding *cb;
396
397   elem = gst_element_factory_make ("testobj", NULL);
398   cs = gst_test_control_source_new ();
399
400   /* that property should not exist */
401   cb = gst_test_control_binding_new (GST_OBJECT (elem), "_schrompf_",
402       GST_CONTROL_SOURCE (cs));
403   fail_unless (GST_CONTROL_BINDING_PSPEC (cb) == NULL, NULL);
404
405   gst_object_unref (cb);
406   gst_object_unref (cs);
407   gst_object_unref (elem);
408 }
409
410 GST_END_TEST;
411
412 /* tests for readonly params */
413 GST_START_TEST (controller_new_fail2)
414 {
415   GstElement *elem;
416   GstTestControlSource *cs;
417   GstControlBinding *cb;
418
419   elem = gst_element_factory_make ("testobj", NULL);
420   cs = gst_test_control_source_new ();
421
422   /* that property should exist and but is readonly */
423   cb = gst_test_control_binding_new (GST_OBJECT (elem), "readonly",
424       GST_CONTROL_SOURCE (cs));
425   fail_unless (GST_CONTROL_BINDING_PSPEC (cb) == NULL, NULL);
426
427   gst_object_unref (cb);
428   gst_object_unref (cs);
429   gst_object_unref (elem);
430 }
431
432 GST_END_TEST;
433
434 /* tests for static params */
435 GST_START_TEST (controller_new_fail3)
436 {
437   GstElement *elem;
438   GstTestControlSource *cs;
439   GstControlBinding *cb;
440
441   elem = gst_element_factory_make ("testobj", NULL);
442   cs = gst_test_control_source_new ();
443
444   /* that property should exist and but is not controlable */
445   cb = gst_test_control_binding_new (GST_OBJECT (elem), "static",
446       GST_CONTROL_SOURCE (cs));
447   fail_unless (GST_CONTROL_BINDING_PSPEC (cb) == NULL, NULL);
448
449   gst_object_unref (cb);
450   gst_object_unref (cs);
451   gst_object_unref (elem);
452 }
453
454 GST_END_TEST;
455
456 /* tests for construct-only params */
457 GST_START_TEST (controller_new_fail4)
458 {
459   GstElement *elem;
460   GstTestControlSource *cs;
461   GstControlBinding *cb;
462
463   elem = gst_element_factory_make ("testobj", NULL);
464   cs = gst_test_control_source_new ();
465
466   /* that property should exist and but is construct-only */
467   cb = gst_test_control_binding_new (GST_OBJECT (elem), "construct-only",
468       GST_CONTROL_SOURCE (cs));
469   fail_unless (GST_CONTROL_BINDING_PSPEC (cb) == NULL, NULL);
470
471   gst_object_unref (cb);
472   gst_object_unref (cs);
473   gst_object_unref (elem);
474 }
475
476 GST_END_TEST;
477
478
479 /* tests for an element with controlled params */
480 GST_START_TEST (controller_new_okay1)
481 {
482   GstElement *elem;
483   GstTestControlSource *cs;
484   GstControlBinding *cb;
485
486   elem = gst_element_factory_make ("testobj", NULL);
487   cs = gst_test_control_source_new ();
488
489   /* that property should exist and should be controllable */
490   cb = gst_test_control_binding_new (GST_OBJECT (elem), "int",
491       GST_CONTROL_SOURCE (cs));
492   fail_unless (GST_CONTROL_BINDING_PSPEC (cb) != NULL, NULL);
493
494   gst_object_unref (cb);
495   gst_object_unref (cs);
496   gst_object_unref (elem);
497 }
498
499 GST_END_TEST;
500
501 /* tests for an element with several controlled params */
502 GST_START_TEST (controller_new_okay2)
503 {
504   GstElement *elem;
505   GstTestControlSource *cs1, *cs2;
506   GstControlBinding *cb1, *cb2;
507
508   elem = gst_element_factory_make ("testobj", NULL);
509   cs1 = gst_test_control_source_new ();
510   cs2 = gst_test_control_source_new ();
511
512   /* these properties should exist and should be controllable */
513   cb1 = gst_test_control_binding_new (GST_OBJECT (elem), "int",
514       GST_CONTROL_SOURCE (cs1));
515   fail_unless (GST_CONTROL_BINDING_PSPEC (cb1) != NULL, NULL);
516
517   cb2 = gst_test_control_binding_new (GST_OBJECT (elem), "boolean",
518       GST_CONTROL_SOURCE (cs2));
519   fail_unless (GST_CONTROL_BINDING_PSPEC (cb2) != NULL, NULL);
520
521   gst_object_unref (cb1);
522   gst_object_unref (cb2);
523   gst_object_unref (cs1);
524   gst_object_unref (cs2);
525   gst_object_unref (elem);
526 }
527
528 GST_END_TEST;
529
530 /* controlling a param twice should be handled */
531 GST_START_TEST (controller_param_twice)
532 {
533   GstElement *elem;
534   GstTestControlSource *cs;
535   GstControlBinding *cb;
536   gboolean res;
537
538   elem = gst_element_factory_make ("testobj", NULL);
539   cs = gst_test_control_source_new ();
540
541   /* that property should exist and should be controllable */
542   cb = gst_test_control_binding_new (GST_OBJECT (elem), "int",
543       GST_CONTROL_SOURCE (cs));
544   fail_unless (GST_CONTROL_BINDING_PSPEC (cb) != NULL, NULL);
545   cb = gst_object_ref (cb);
546
547   res = gst_object_add_control_binding (GST_OBJECT (elem), cb);
548   fail_unless (res, NULL);
549
550   /* setting it again will just unset the old and set it again
551    * this might cause some trouble with binding the control source again
552    */
553   res = gst_object_add_control_binding (GST_OBJECT (elem), cb);
554   fail_unless (res, NULL);
555
556   /* it should have been added now, let remove it */
557   res = gst_object_remove_control_binding (GST_OBJECT (elem), cb);
558   fail_unless (res, NULL);
559
560   /* removing it again should not work */
561   res = gst_object_remove_control_binding (GST_OBJECT (elem), cb);
562   fail_unless (!res, NULL);
563
564   gst_object_unref (cb);
565   gst_object_unref (cs);
566   gst_object_unref (elem);
567 }
568
569 GST_END_TEST;
570
571 /* tests if we can run controller methods against any GObject */
572 GST_START_TEST (controller_any_gobject)
573 {
574   GstElement *elem;
575   gboolean res;
576
577   elem = gst_element_factory_make ("bin", "test_elem");
578
579   /* that element is not controllable */
580   res = gst_object_sync_values (GST_OBJECT (elem), 0LL);
581   /* Syncing should still succeed as there's nothing to sync */
582   fail_unless (res == TRUE, NULL);
583
584   gst_object_unref (elem);
585 }
586
587 GST_END_TEST;
588
589 /* tests if we cleanup properly */
590 GST_START_TEST (controller_controlsource_refcounts)
591 {
592   GstElement *elem;
593   GstControlBinding *cb, *test_cb;
594   GstControlSource *cs, *test_cs;
595
596   elem = gst_element_factory_make ("testobj", NULL);
597
598   cs = (GstControlSource *) gst_test_control_source_new ();
599   fail_unless (cs != NULL, NULL);
600
601   fail_unless_equals_int (G_OBJECT (cs)->ref_count, 1);
602
603   cb = gst_test_control_binding_new (GST_OBJECT (elem), "int", cs);
604   fail_unless (GST_CONTROL_BINDING_PSPEC (cb) != NULL, NULL);
605   fail_unless_equals_int (G_OBJECT (cs)->ref_count, 2);
606   fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), cb));
607
608   test_cb = gst_object_get_control_binding (GST_OBJECT (elem), "int");
609   fail_unless (test_cb != NULL, NULL);
610
611   test_cs =
612       gst_test_control_binding_get_control_source (GST_TEST_CONTROL_BINDING
613       (test_cb));
614   fail_unless (test_cs != NULL, NULL);
615   fail_unless (test_cs == cs);
616   fail_unless_equals_int (G_OBJECT (cs)->ref_count, 3);
617   gst_object_unref (test_cs);
618   gst_object_unref (test_cb);
619   gst_object_unref (cs);
620
621   gst_object_unref (elem);
622 }
623
624 GST_END_TEST;
625
626 /* tests if we can bind a control source twice */
627 GST_START_TEST (controller_bind_twice)
628 {
629   GstElement *elem;
630   GstControlSource *cs;
631   GstControlBinding *cb1, *cb2;
632
633   elem = gst_element_factory_make ("testobj", NULL);
634
635   cs = (GstControlSource *) gst_test_control_source_new ();
636   fail_unless (cs != NULL, NULL);
637
638   cb1 = gst_test_control_binding_new (GST_OBJECT (elem), "int", cs);
639   fail_unless (GST_CONTROL_BINDING_PSPEC (cb1) != NULL, NULL);
640   cb2 = gst_test_control_binding_new (GST_OBJECT (elem), "double", cs);
641   fail_unless (GST_CONTROL_BINDING_PSPEC (cb2) != NULL, NULL);
642
643   gst_object_unref (cb1);
644   gst_object_unref (cb2);
645   gst_object_unref (cs);
646   gst_object_unref (elem);
647 }
648
649 GST_END_TEST;
650
651
652 static Suite *
653 gst_controller_suite (void)
654 {
655   Suite *s = suite_create ("Controller");
656   TCase *tc = tcase_create ("general");
657
658   suite_add_tcase (s, tc);
659   tcase_add_checked_fixture (tc, setup, teardown);
660   tcase_add_test (tc, controller_new_fail1);
661   tcase_add_test (tc, controller_new_fail2);
662   tcase_add_test (tc, controller_new_fail3);
663   tcase_add_test (tc, controller_new_fail4);
664   tcase_add_test (tc, controller_new_okay1);
665   tcase_add_test (tc, controller_new_okay2);
666   tcase_add_test (tc, controller_param_twice);
667   tcase_add_test (tc, controller_any_gobject);
668   tcase_add_test (tc, controller_controlsource_refcounts);
669   tcase_add_test (tc, controller_bind_twice);
670
671   return s;
672 }
673
674 GST_CHECK_MAIN (gst_controller);