1 /* GStreamer
2 *
3 * Copyright (C) 2018 Matthew Waters <matthew@centricular.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
24
25 #include <gst/check/gstcheck.h>
26
27 #include <gst/gl/gl.h>
28
GST_START_TEST(test_same_version)29 GST_START_TEST (test_same_version)
30 {
31 fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 2, 2, 2), TRUE);
32 }
33
34 GST_END_TEST;
35
GST_START_TEST(test_greater_major_version)36 GST_START_TEST (test_greater_major_version)
37 {
38 fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (3, 2, 2, 2), TRUE);
39 }
40
41 GST_END_TEST;
42
GST_START_TEST(test_greater_minor_version)43 GST_START_TEST (test_greater_minor_version)
44 {
45 fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 3, 2, 2), TRUE);
46 }
47
48 GST_END_TEST;
49
GST_START_TEST(test_greater_major_minor_version)50 GST_START_TEST (test_greater_major_minor_version)
51 {
52 fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (3, 3, 2, 2), TRUE);
53 }
54
55 GST_END_TEST;
56
GST_START_TEST(test_lesser_major_version)57 GST_START_TEST (test_lesser_major_version)
58 {
59 fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 2, 3, 2), FALSE);
60 }
61
62 GST_END_TEST;
63
GST_START_TEST(test_lesser_minor_version)64 GST_START_TEST (test_lesser_minor_version)
65 {
66 fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 2, 2, 3), FALSE);
67 }
68
69 GST_END_TEST;
70
GST_START_TEST(test_lesser_major_minor_version)71 GST_START_TEST (test_lesser_major_minor_version)
72 {
73 fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 2, 3, 3), FALSE);
74 }
75
76 GST_END_TEST;
77
78 static const gchar *dummy_extensions = "start middle end";
79
GST_START_TEST(test_extension_start)80 GST_START_TEST (test_extension_start)
81 {
82 fail_unless_equals_int (gst_gl_check_extension ("start", dummy_extensions),
83 TRUE);
84 }
85
86 GST_END_TEST;
87
GST_START_TEST(test_extension_middle)88 GST_START_TEST (test_extension_middle)
89 {
90 fail_unless_equals_int (gst_gl_check_extension ("middle", dummy_extensions),
91 TRUE);
92 }
93
94 GST_END_TEST;
95
GST_START_TEST(test_extension_end)96 GST_START_TEST (test_extension_end)
97 {
98 fail_unless_equals_int (gst_gl_check_extension ("end", dummy_extensions),
99 TRUE);
100 }
101
102 GST_END_TEST;
103
GST_START_TEST(test_extension_non_existent)104 GST_START_TEST (test_extension_non_existent)
105 {
106 fail_unless_equals_int (gst_gl_check_extension ("ZZZZZZ", dummy_extensions),
107 FALSE);
108 }
109
110 GST_END_TEST;
111
GST_START_TEST(test_extension_non_existent_start)112 GST_START_TEST (test_extension_non_existent_start)
113 {
114 fail_unless_equals_int (gst_gl_check_extension ("start1", dummy_extensions),
115 FALSE);
116 }
117
118 GST_END_TEST;
119
GST_START_TEST(test_extension_non_existent_middle)120 GST_START_TEST (test_extension_non_existent_middle)
121 {
122 fail_unless_equals_int (gst_gl_check_extension ("middle1", dummy_extensions),
123 FALSE);
124 }
125
126 GST_END_TEST;
127
GST_START_TEST(test_extension_non_existent_end)128 GST_START_TEST (test_extension_non_existent_end)
129 {
130 fail_unless_equals_int (gst_gl_check_extension ("1end", dummy_extensions),
131 FALSE);
132 }
133
134 GST_END_TEST;
135
136 static Suite *
gst_gl_format_suite(void)137 gst_gl_format_suite (void)
138 {
139 Suite *s = suite_create ("Gst GL Feature");
140 TCase *tc_chain = tcase_create ("general");
141
142 suite_add_tcase (s, tc_chain);
143 tcase_add_test (tc_chain, test_same_version);
144 tcase_add_test (tc_chain, test_greater_major_version);
145 tcase_add_test (tc_chain, test_greater_minor_version);
146 tcase_add_test (tc_chain, test_greater_major_minor_version);
147 tcase_add_test (tc_chain, test_lesser_major_version);
148 tcase_add_test (tc_chain, test_lesser_minor_version);
149 tcase_add_test (tc_chain, test_lesser_major_minor_version);
150 tcase_add_test (tc_chain, test_extension_start);
151 tcase_add_test (tc_chain, test_extension_middle);
152 tcase_add_test (tc_chain, test_extension_end);
153 tcase_add_test (tc_chain, test_extension_non_existent);
154 tcase_add_test (tc_chain, test_extension_non_existent_start);
155 tcase_add_test (tc_chain, test_extension_non_existent_middle);
156 tcase_add_test (tc_chain, test_extension_non_existent_end);
157
158 return s;
159 }
160
161 GST_CHECK_MAIN (gst_gl_format);
162