2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
22 /* tests if gst_bin_get_(all_)by_interface works */
25 main (gint argc, gchar *argv[])
31 gst_init (&argc, &argv);
33 bin = GST_BIN (gst_bin_new (NULL));
36 filesrc = gst_element_factory_make ("filesrc", NULL);
38 g_assert (GST_IS_URI_HANDLER (filesrc));
39 gst_bin_add (bin, filesrc);
41 g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc);
42 list = gst_bin_get_all_by_interface (bin, GST_TYPE_URI_HANDLER);
43 g_assert (g_list_length (list) == 1);
44 g_assert (list->data == (gpointer) filesrc);
47 gst_bin_add_many (bin,
48 gst_element_factory_make ("identity", NULL),
49 gst_element_factory_make ("identity", NULL),
50 gst_element_factory_make ("identity", NULL),
52 g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc);
53 list = gst_bin_get_all_by_interface (bin, GST_TYPE_URI_HANDLER);
54 g_assert (g_list_length (list) == 1);
55 g_assert (list->data == (gpointer) filesrc);
59 bin = GST_BIN (gst_bin_new (NULL));
61 gst_bin_add_many (bin,
62 gst_element_factory_make ("identity", NULL),
63 gst_element_factory_make ("identity", NULL),
65 gst_element_factory_make ("identity", NULL),
67 g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc);
68 list = gst_bin_get_all_by_interface (bin, GST_TYPE_URI_HANDLER);
69 g_assert (g_list_length (list) == 1);
70 g_assert (list->data == (gpointer) filesrc);
73 gst_bin_add (bin, gst_element_factory_make ("filesrc", NULL));
74 gst_bin_add (bin2, gst_element_factory_make ("filesrc", NULL));
75 list = gst_bin_get_all_by_interface (bin, GST_TYPE_URI_HANDLER);
76 g_assert (g_list_length (list) == 3);