|
1 /* GStreamer GstImplementsInterface check |
|
2 * Copyright (C) 2008 Tim-Philipp Müller <tim centricular net> |
|
3 * |
|
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. |
|
8 * |
|
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. |
|
13 * |
|
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. |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #define LOG_FILE "c:\\logs\\gstinterface_logs.txt" |
|
23 |
|
24 #include <gst/gst_global.h> |
|
25 #include "std_log_result.h" |
|
26 #define LOG_FILENAME_LINE __FILE__, __LINE__ |
|
27 |
|
28 void create_xml(int result) |
|
29 { |
|
30 if(result) |
|
31 assert_failed = 1; |
|
32 |
|
33 testResultXml(xmlfile); |
|
34 close_log_file(); |
|
35 } |
|
36 |
|
37 |
|
38 #include <gst/check/gstcheck.h> |
|
39 |
|
40 void test_without_implements_interface() |
|
41 { |
|
42 GstElement *element; |
|
43 |
|
44 std_log(LOG_FILENAME_LINE, "Test Started test_without_implements_interface"); |
|
45 |
|
46 /* we shouldn't crash if someone tries to use |
|
47 * gst_element_implements_interface() on an element which doesn't implement |
|
48 * the GstImplementsInterface (neither if the element does implement the |
|
49 * requested interface, nor if it doesn't) */ |
|
50 element = gst_element_factory_make ("filesrc", "filesrc"); |
|
51 fail_unless (element != NULL, "Could not create filesrc element"); |
|
52 |
|
53 /* does not implement GstImplementsInterface, but does implement the |
|
54 * GstUriHandler interface, so should just return TRUE */ |
|
55 fail_if (!gst_element_implements_interface (element, GST_TYPE_URI_HANDLER)); |
|
56 fail_if (gst_element_implements_interface (element, |
|
57 GST_TYPE_IMPLEMENTS_INTERFACE)); |
|
58 gst_object_unref (element); |
|
59 |
|
60 element = gst_element_factory_make ("identity", "identity"); |
|
61 fail_unless (element != NULL, "Could not create identity element"); |
|
62 fail_if (gst_element_implements_interface (element, GST_TYPE_URI_HANDLER)); |
|
63 fail_if (gst_element_implements_interface (element, |
|
64 GST_TYPE_IMPLEMENTS_INTERFACE)); |
|
65 gst_object_unref (element); |
|
66 |
|
67 std_log(LOG_FILENAME_LINE, "Test Successful"); |
|
68 create_xml(0); |
|
69 } |
|
70 |
|
71 |
|
72 |
|
73 void (*fn[]) (void) = { |
|
74 test_without_implements_interface |
|
75 }; |
|
76 |
|
77 char *args[] = { |
|
78 "test_without_implements_interface" |
|
79 }; |
|
80 |
|
81 GST_CHECK_MAIN (gst_interface); |