Be sure that we have a new copy of the caps and not reffed caps from a template
[platform/upstream/gstreamer.git] / tests / check / gst / gstpad.c
1 /* GStreamer
2  * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
3  *
4  * gstpad.c: Unit test for GstPad
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_link)
25 {
26   GstPad *src, *sink;
27   GstPadTemplate *srct;
28
29   GstPadLinkReturn ret;
30   gchar *name;
31
32   src = gst_pad_new ("source", GST_PAD_SRC);
33   fail_if (src == NULL);
34   ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
35
36   name = gst_pad_get_name (src);
37   fail_unless (strcmp (name, "source") == 0);
38   ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
39   g_free (name);
40
41   sink = gst_pad_new ("sink", GST_PAD_SINK);
42   fail_if (sink == NULL);
43
44   /* linking without templates or caps should fail */
45   ret = gst_pad_link (src, sink);
46   ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
47   ASSERT_OBJECT_REFCOUNT (sink, "sink pad", 1);
48   fail_unless (ret == GST_PAD_LINK_NOFORMAT);
49
50   ASSERT_CRITICAL (gst_pad_get_pad_template (NULL));
51
52   srct = gst_pad_get_pad_template (src);
53   fail_unless (srct == NULL);
54   ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
55
56   /* clean up */
57   ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
58   gst_object_unref (src);
59   gst_object_unref (sink);
60 }
61
62 GST_END_TEST;
63
64 /* threaded link/unlink */
65 /* use globals */
66 GstPad *src, *sink;
67
68 void
69 thread_link_unlink (gpointer data)
70 {
71   THREAD_START ();
72
73   while (THREAD_TEST_RUNNING ()) {
74     gst_pad_link (src, sink);
75     gst_pad_unlink (src, sink);
76     THREAD_SWITCH ();
77   }
78 }
79
80 GST_START_TEST (test_link_unlink_threaded)
81 {
82   GstCaps *caps;
83   int i;
84
85   src = gst_pad_new ("source", GST_PAD_SRC);
86   fail_if (src == NULL);
87   sink = gst_pad_new ("sink", GST_PAD_SINK);
88   fail_if (sink == NULL);
89
90   caps = gst_caps_from_string ("foo/bar");
91   gst_pad_set_caps (src, caps);
92   gst_pad_set_caps (sink, caps);
93   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
94
95   MAIN_START_THREADS (5, thread_link_unlink, NULL);
96   for (i = 0; i < 1000; ++i) {
97     gst_pad_is_linked (src);
98     gst_pad_is_linked (sink);
99     THREAD_SWITCH ();
100   }
101   MAIN_STOP_THREADS ();
102
103   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
104   gst_caps_unref (caps);
105
106   ASSERT_CAPS_REFCOUNT (caps, "caps", 2);
107   gst_object_unref (src);
108   gst_object_unref (sink);
109 }
110
111 GST_END_TEST;
112
113 GST_START_TEST (test_refcount)
114 {
115   GstPad *src, *sink;
116   GstCaps *caps;
117   GstPadLinkReturn plr;
118
119   sink = gst_pad_new ("sink", GST_PAD_SINK);
120   fail_if (sink == NULL);
121
122   src = gst_pad_new ("src", GST_PAD_SRC);
123   fail_if (src == NULL);
124
125   caps = gst_caps_from_string ("foo/bar");
126   /* one for me */
127   ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
128
129   gst_pad_set_caps (src, caps);
130   gst_pad_set_caps (sink, caps);
131   /* one for me and one for each set_caps */
132   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
133
134   plr = gst_pad_link (src, sink);
135   fail_unless (GST_PAD_LINK_SUCCESSFUL (plr));
136   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
137
138   gst_pad_unlink (src, sink);
139   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
140
141   /* cleanup */
142   gst_object_unref (src);
143   gst_object_unref (sink);
144   ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
145
146   gst_caps_unref (caps);
147 }
148
149 GST_END_TEST;
150
151 GST_START_TEST (test_get_allowed_caps)
152 {
153   GstPad *src, *sink;
154   GstCaps *caps, *gotcaps;
155   GstBuffer *buffer;
156   GstPadLinkReturn plr;
157
158   ASSERT_CRITICAL (gst_pad_get_allowed_caps (NULL));
159
160   buffer = gst_buffer_new ();
161   ASSERT_CRITICAL (gst_pad_get_allowed_caps ((GstPad *) buffer));
162   gst_buffer_unref (buffer);
163
164   src = gst_pad_new ("src", GST_PAD_SRC);
165   fail_if (src == NULL);
166   caps = gst_pad_get_allowed_caps (src);
167   fail_unless (caps == NULL);
168
169   caps = gst_caps_from_string ("foo/bar");
170
171   sink = gst_pad_new ("sink", GST_PAD_SINK);
172   gst_pad_set_caps (src, caps);
173   gst_pad_set_caps (sink, caps);
174   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
175
176   plr = gst_pad_link (src, sink);
177   fail_unless (GST_PAD_LINK_SUCCESSFUL (plr));
178
179   gotcaps = gst_pad_get_allowed_caps (src);
180   fail_if (gotcaps == NULL);
181   fail_unless (gst_caps_is_equal (gotcaps, caps));
182
183   ASSERT_CAPS_REFCOUNT (gotcaps, "gotcaps", 1);
184   gst_caps_unref (gotcaps);
185
186   gst_pad_unlink (src, sink);
187
188   /* cleanup */
189   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
190   ASSERT_OBJECT_REFCOUNT (src, "src", 1);
191   ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);
192
193   gst_object_unref (src);
194   gst_object_unref (sink);
195
196   ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
197   gst_caps_unref (caps);
198 }
199
200 GST_END_TEST;
201
202 static gboolean
203 name_is_valid (const gchar * name, GstPadPresence presence)
204 {
205   GstPadTemplate *new;
206
207   new = gst_pad_template_new (name, GST_PAD_SRC, presence, GST_CAPS_ANY);
208   if (new) {
209     gst_object_unref (GST_OBJECT (new));
210     return TRUE;
211   }
212   return FALSE;
213 }
214
215 GST_START_TEST (test_name_is_valid)
216 {
217   gboolean result = FALSE;
218
219   fail_unless (name_is_valid ("src", GST_PAD_ALWAYS));
220   ASSERT_WARNING (name_is_valid ("src%", GST_PAD_ALWAYS));
221   ASSERT_WARNING (result = name_is_valid ("src%d", GST_PAD_ALWAYS));
222   fail_if (result);
223
224   fail_unless (name_is_valid ("src", GST_PAD_REQUEST));
225   ASSERT_WARNING (name_is_valid ("src%s%s", GST_PAD_REQUEST));
226   ASSERT_WARNING (name_is_valid ("src%c", GST_PAD_REQUEST));
227   ASSERT_WARNING (name_is_valid ("src%", GST_PAD_REQUEST));
228   ASSERT_WARNING (name_is_valid ("src%dsrc", GST_PAD_REQUEST));
229
230   fail_unless (name_is_valid ("src", GST_PAD_SOMETIMES));
231   fail_unless (name_is_valid ("src%c", GST_PAD_SOMETIMES));
232 }
233
234 GST_END_TEST;
235
236 static gboolean
237 _probe_handler (GstPad * pad, GstBuffer * buffer, gpointer userdata)
238 {
239   gint ret = GPOINTER_TO_INT (userdata);
240
241   if (ret == 1)
242     return TRUE;
243   return FALSE;
244 }
245
246 GST_START_TEST (test_push_unlinked)
247 {
248   GstPad *src;
249   GstCaps *caps;
250   GstBuffer *buffer;
251   gulong id;
252
253   src = gst_pad_new ("src", GST_PAD_SRC);
254   fail_if (src == NULL);
255   caps = gst_pad_get_allowed_caps (src);
256   fail_unless (caps == NULL);
257
258   caps = gst_caps_from_string ("foo/bar");
259
260   gst_pad_set_caps (src, caps);
261   ASSERT_CAPS_REFCOUNT (caps, "caps", 2);
262
263   /* pushing on an unlinked pad will drop the buffer */
264   buffer = gst_buffer_new ();
265   gst_buffer_ref (buffer);
266   fail_unless (gst_pad_push (src, buffer) == GST_FLOW_NOT_LINKED);
267   ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
268   gst_buffer_unref (buffer);
269
270   /* adding a probe that returns FALSE will drop the buffer without trying
271    * to chain */
272   id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler,
273       GINT_TO_POINTER (0));
274   buffer = gst_buffer_new ();
275   gst_buffer_ref (buffer);
276   fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK);
277   ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
278   gst_buffer_unref (buffer);
279   gst_pad_remove_buffer_probe (src, id);
280
281   /* adding a probe that returns TRUE will still chain the buffer,
282    * and hence drop because pad is unlinked */
283   id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler,
284       GINT_TO_POINTER (1));
285   buffer = gst_buffer_new ();
286   gst_buffer_ref (buffer);
287   fail_unless (gst_pad_push (src, buffer) == GST_FLOW_NOT_LINKED);
288   ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
289   gst_buffer_unref (buffer);
290   gst_pad_remove_buffer_probe (src, id);
291
292
293   /* cleanup */
294   ASSERT_CAPS_REFCOUNT (caps, "caps", 2);
295   ASSERT_OBJECT_REFCOUNT (src, "src", 1);
296
297   gst_object_unref (src);
298
299   ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
300   gst_caps_unref (caps);
301 }
302
303 GST_END_TEST;
304
305 GST_START_TEST (test_push_linked)
306 {
307   GstPad *src, *sink;
308   GstPadLinkReturn plr;
309   GstCaps *caps;
310   GstBuffer *buffer;
311   gulong id;
312
313   /* setup */
314   sink = gst_pad_new ("sink", GST_PAD_SINK);
315   fail_if (sink == NULL);
316   gst_pad_set_chain_function (sink, gst_check_chain_func);
317
318   src = gst_pad_new ("src", GST_PAD_SRC);
319   fail_if (src == NULL);
320
321   caps = gst_caps_from_string ("foo/bar");
322   /* one for me */
323   ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
324
325   gst_pad_set_caps (src, caps);
326   gst_pad_set_caps (sink, caps);
327   /* one for me and one for each set_caps */
328   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
329
330   plr = gst_pad_link (src, sink);
331   fail_unless (GST_PAD_LINK_SUCCESSFUL (plr));
332   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
333
334   buffer = gst_buffer_new ();
335 #if 0
336   /* FIXME, new pad should be flushing */
337   gst_buffer_ref (buffer);
338   fail_unless (gst_pad_push (src, buffer) == GST_FLOW_WRONG_STATE);
339   gst_buffer_ref (buffer);
340   fail_unless (gst_pad_chain (sink, buffer) == GST_FLOW_WRONG_STATE);
341 #endif
342
343   /* activate pads */
344   gst_pad_set_active (src, TRUE);
345   gst_pad_set_active (sink, TRUE);
346
347   /* test */
348   /* pushing on a linked pad will drop the ref to the buffer */
349   gst_buffer_ref (buffer);
350   fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK);
351   ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 2);
352   gst_buffer_unref (buffer);
353   fail_unless_equals_int (g_list_length (buffers), 1);
354   buffer = GST_BUFFER (buffers->data);
355   ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
356   gst_buffer_unref (buffer);
357   g_list_free (buffers);
358   buffers = NULL;
359
360   /* adding a probe that returns FALSE will drop the buffer without trying
361    * to chain */
362   id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler,
363       GINT_TO_POINTER (0));
364   buffer = gst_buffer_new ();
365   gst_buffer_ref (buffer);
366   fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK);
367   ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
368   gst_buffer_unref (buffer);
369   gst_pad_remove_buffer_probe (src, id);
370   fail_unless_equals_int (g_list_length (buffers), 0);
371
372   /* adding a probe that returns TRUE will still chain the buffer */
373   id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler,
374       GINT_TO_POINTER (1));
375   buffer = gst_buffer_new ();
376   gst_buffer_ref (buffer);
377   fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK);
378   gst_pad_remove_buffer_probe (src, id);
379
380   ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 2);
381   gst_buffer_unref (buffer);
382   fail_unless_equals_int (g_list_length (buffers), 1);
383   buffer = GST_BUFFER (buffers->data);
384   ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
385   gst_buffer_unref (buffer);
386   g_list_free (buffers);
387   buffers = NULL;
388
389   /* teardown */
390   gst_pad_unlink (src, sink);
391   ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
392   gst_object_unref (src);
393   gst_object_unref (sink);
394   ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
395
396   gst_caps_unref (caps);
397 }
398
399 GST_END_TEST;
400
401 GST_START_TEST (test_flowreturn)
402 {
403   GstFlowReturn ret;
404   GQuark quark;
405
406   /* test some of the macros */
407   ret = GST_FLOW_UNEXPECTED;
408   fail_unless (GST_FLOW_IS_FATAL (ret));
409   fail_if (GST_FLOW_IS_SUCCESS (ret));
410   fail_if (strcmp (gst_flow_get_name (ret), "unexpected"));
411   quark = gst_flow_to_quark (ret);
412   fail_if (strcmp (g_quark_to_string (quark), "unexpected"));
413
414   ret = GST_FLOW_RESEND;
415   fail_if (GST_FLOW_IS_FATAL (ret));
416   fail_unless (GST_FLOW_IS_SUCCESS (ret));
417   fail_if (strcmp (gst_flow_get_name (ret), "resend"));
418   quark = gst_flow_to_quark (ret);
419   fail_if (strcmp (g_quark_to_string (quark), "resend"));
420
421   /* custom returns */
422   ret = GST_FLOW_CUSTOM_SUCCESS;
423   fail_if (GST_FLOW_IS_FATAL (ret));
424   fail_unless (GST_FLOW_IS_SUCCESS (ret));
425   fail_if (strcmp (gst_flow_get_name (ret), "custom-success"));
426   quark = gst_flow_to_quark (ret);
427   fail_if (strcmp (g_quark_to_string (quark), "custom-success"));
428
429   ret = GST_FLOW_CUSTOM_ERROR;
430   fail_unless (GST_FLOW_IS_FATAL (ret));
431   fail_if (GST_FLOW_IS_SUCCESS (ret));
432   fail_if (strcmp (gst_flow_get_name (ret), "custom-error"));
433   quark = gst_flow_to_quark (ret);
434   fail_if (strcmp (g_quark_to_string (quark), "custom-error"));
435
436   /* custom returns clamping */
437   ret = GST_FLOW_CUSTOM_SUCCESS + 2;
438   fail_if (GST_FLOW_IS_FATAL (ret));
439   fail_unless (GST_FLOW_IS_SUCCESS (ret));
440   fail_if (strcmp (gst_flow_get_name (ret), "custom-success"));
441   quark = gst_flow_to_quark (ret);
442   fail_if (strcmp (g_quark_to_string (quark), "custom-success"));
443
444   ret = GST_FLOW_CUSTOM_ERROR - 2;
445   fail_unless (GST_FLOW_IS_FATAL (ret));
446   fail_if (GST_FLOW_IS_SUCCESS (ret));
447   fail_if (strcmp (gst_flow_get_name (ret), "custom-error"));
448   quark = gst_flow_to_quark (ret);
449   fail_if (strcmp (g_quark_to_string (quark), "custom-error"));
450
451   /* unknown values */
452   ret = GST_FLOW_CUSTOM_ERROR + 2;
453   fail_unless (GST_FLOW_IS_FATAL (ret));
454   fail_if (GST_FLOW_IS_SUCCESS (ret));
455   fail_if (strcmp (gst_flow_get_name (ret), "unknown"));
456   quark = gst_flow_to_quark (ret);
457   fail_unless (quark == 0);
458 }
459
460 GST_END_TEST;
461
462 GST_START_TEST (test_push_negotiation)
463 {
464   GstPad *src, *sink;
465   GstPadLinkReturn plr;
466   GstPadTemplate *src_template = gst_pad_template_new ("src", GST_PAD_SRC,
467       GST_PAD_ALWAYS,
468       gst_caps_from_string ("audio/x-raw-int,width={16,32},depth={16,32}"));
469   GstPadTemplate *sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
470       GST_PAD_ALWAYS,
471       gst_caps_from_string ("audio/x-raw-int,width=32,depth={16,32}"));
472   GstCaps *caps;
473   GstBuffer *buffer;
474
475   /* setup */
476   sink = gst_pad_new_from_template (sink_template, "sink");
477   fail_if (sink == NULL);
478   gst_pad_set_chain_function (sink, gst_check_chain_func);
479
480   src = gst_pad_new_from_template (src_template, "src");
481   fail_if (src == NULL);
482
483   plr = gst_pad_link (src, sink);
484   fail_unless (GST_PAD_LINK_SUCCESSFUL (plr));
485
486   buffer = gst_buffer_new ();
487
488   /* activate pads */
489   gst_pad_set_active (src, TRUE);
490   gst_pad_set_active (sink, TRUE);
491
492   caps = gst_caps_from_string ("audio/x-raw-int,width=16,depth=16");
493
494   /* Should fail if src pad caps are incompatible with sink pad caps */
495   gst_pad_set_caps (src, caps);
496   gst_buffer_ref (buffer);
497   gst_buffer_set_caps (buffer, caps);
498   fail_unless (gst_pad_push (src, buffer) == GST_FLOW_NOT_NEGOTIATED);
499   ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
500   gst_buffer_unref (buffer);
501
502   /* teardown */
503   gst_pad_unlink (src, sink);
504   gst_object_unref (src);
505   gst_object_unref (sink);
506   gst_caps_unref (caps);
507   gst_object_unref (sink_template);
508   gst_object_unref (src_template);
509 }
510
511 GST_END_TEST;
512
513 /* see that an unref also unlinks the pads */
514 GST_START_TEST (test_src_unref_unlink)
515 {
516   GstPad *src, *sink;
517   GstCaps *caps;
518   GstPadLinkReturn plr;
519
520   sink = gst_pad_new ("sink", GST_PAD_SINK);
521   fail_if (sink == NULL);
522
523   src = gst_pad_new ("src", GST_PAD_SRC);
524   fail_if (src == NULL);
525
526   caps = gst_caps_from_string ("foo/bar");
527
528   gst_pad_set_caps (src, caps);
529   gst_pad_set_caps (sink, caps);
530
531   plr = gst_pad_link (src, sink);
532   fail_unless (GST_PAD_LINK_SUCCESSFUL (plr));
533
534   /* unref the srcpad */
535   gst_object_unref (src);
536
537   /* sink should be unlinked now */
538   fail_if (gst_pad_is_linked (sink));
539
540   /* cleanup */
541   gst_object_unref (sink);
542   gst_caps_unref (caps);
543 }
544
545 GST_END_TEST;
546
547 /* see that an unref also unlinks the pads */
548 GST_START_TEST (test_sink_unref_unlink)
549 {
550   GstPad *src, *sink;
551   GstCaps *caps;
552   GstPadLinkReturn plr;
553
554   sink = gst_pad_new ("sink", GST_PAD_SINK);
555   fail_if (sink == NULL);
556
557   src = gst_pad_new ("src", GST_PAD_SRC);
558   fail_if (src == NULL);
559
560   caps = gst_caps_from_string ("foo/bar");
561
562   gst_pad_set_caps (src, caps);
563   gst_pad_set_caps (sink, caps);
564
565   plr = gst_pad_link (src, sink);
566   fail_unless (GST_PAD_LINK_SUCCESSFUL (plr));
567
568   /* unref the sinkpad */
569   gst_object_unref (sink);
570
571   /* src should be unlinked now */
572   fail_if (gst_pad_is_linked (src));
573
574   /* cleanup */
575   gst_object_unref (src);
576   gst_caps_unref (caps);
577 }
578
579 GST_END_TEST;
580
581 /* gst_pad_get_caps should return a copy of the caps */
582 GST_START_TEST (test_get_caps_must_be_copy)
583 {
584   GstPad *pad;
585   GstCaps *caps;
586   GstPadTemplate *templ;
587
588   caps = gst_caps_new_any ();
589   templ =
590       gst_pad_template_new ("test_templ", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
591   pad = gst_pad_new_from_template (templ, NULL);
592   fail_unless (GST_PAD_CAPS (pad) == NULL, "caps present on pad");
593   caps = gst_pad_get_caps (pad);
594
595   /* we must own the caps */
596   ASSERT_OBJECT_REFCOUNT (caps, "caps", 1);
597
598   /* cleanup */
599   gst_caps_unref (caps);
600   gst_object_unref (pad);
601   gst_object_unref (templ);
602 }
603
604 GST_END_TEST;
605
606 Suite *
607 gst_pad_suite (void)
608 {
609   Suite *s = suite_create ("GstPad");
610   TCase *tc_chain = tcase_create ("general");
611
612   /* turn off timeout */
613   tcase_set_timeout (tc_chain, 60);
614
615   suite_add_tcase (s, tc_chain);
616   tcase_add_test (tc_chain, test_link);
617   tcase_add_test (tc_chain, test_refcount);
618   tcase_add_test (tc_chain, test_get_allowed_caps);
619   tcase_add_test (tc_chain, test_link_unlink_threaded);
620   tcase_add_test (tc_chain, test_name_is_valid);
621   tcase_add_test (tc_chain, test_push_unlinked);
622   tcase_add_test (tc_chain, test_push_linked);
623   tcase_add_test (tc_chain, test_flowreturn);
624   tcase_add_test (tc_chain, test_push_negotiation);
625   tcase_add_test (tc_chain, test_src_unref_unlink);
626   tcase_add_test (tc_chain, test_sink_unref_unlink);
627   tcase_add_test (tc_chain, test_get_caps_must_be_copy);
628
629   return s;
630 }
631
632 GST_CHECK_MAIN (gst_pad);