3 * Copyright (C) 2014 Matthew Waters <matthew@centricular.com>
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.
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.
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.
25 #include <gst/check/gstcheck.h>
27 #include <gst/gl/gl.h>
35 {GST_GL_API_OPENGL, "opengl"},
36 {GST_GL_API_OPENGL3, "opengl3"},
37 {GST_GL_API_GLES1, "gles1"},
38 {GST_GL_API_GLES2, "gles2"},
39 {GST_GL_API_ANY, "any"},
40 {GST_GL_API_NONE, "none"},
47 } from_api_strings[] = {
49 {GST_GL_API_ANY, NULL},
50 {GST_GL_API_NONE, "invalid-api"},
54 GST_START_TEST (gl_api_serialization)
58 for (i = 0; i < G_N_ELEMENTS (api_strings); i++) {
61 new_str = gst_gl_api_to_string (api_strings[i].api);
62 GST_DEBUG ("\'%s\' ?= \'%s\'", new_str, api_strings[i].str);
63 fail_unless_equals_int (0, g_strcmp0 (new_str, api_strings[i].str));
64 fail_unless_equals_int (gst_gl_api_from_string (api_strings[i].str),
69 for (i = 0; i < G_N_ELEMENTS (from_api_strings); i++) {
70 fail_unless_equals_int (gst_gl_api_from_string (from_api_strings[i].str),
71 from_api_strings[i].api);
80 GstGLPlatform platform;
82 } platform_strings[] = {
83 {GST_GL_PLATFORM_GLX, "glx"},
84 {GST_GL_PLATFORM_EGL, "egl"},
85 {GST_GL_PLATFORM_WGL, "wgl"},
86 {GST_GL_PLATFORM_CGL, "cgl"},
87 {GST_GL_PLATFORM_EAGL, "eagl"},
88 {GST_GL_PLATFORM_ANY, "any"},
89 {GST_GL_PLATFORM_NONE, "none"},
94 GstGLPlatform platform;
96 } from_platform_strings[] = {
97 {GST_GL_PLATFORM_ANY, ""},
98 {GST_GL_PLATFORM_ANY, NULL},
99 {GST_GL_PLATFORM_NONE, "invalid-platform"},
103 GST_START_TEST (gl_platform_serialization)
107 for (i = 0; i < G_N_ELEMENTS (platform_strings); i++) {
110 new_str = gst_gl_platform_to_string (platform_strings[i].platform);
111 GST_DEBUG ("\'%s\' ?= \'%s\'", new_str, platform_strings[i].str);
112 fail_unless_equals_int (0, g_strcmp0 (new_str, platform_strings[i].str));
113 fail_unless_equals_int (gst_gl_platform_from_string (platform_strings
114 [i].str), platform_strings[i].platform);
118 for (i = 0; i < G_N_ELEMENTS (from_platform_strings); i++) {
119 fail_unless_equals_int (gst_gl_platform_from_string (from_platform_strings
120 [i].str), from_platform_strings[i].platform);
127 gst_gl_color_convert_suite (void)
129 Suite *s = suite_create ("GstGLAPI");
130 TCase *tc_chain = tcase_create ("api");
132 suite_add_tcase (s, tc_chain);
133 tcase_add_test (tc_chain, gl_platform_serialization);
134 tcase_add_test (tc_chain, gl_api_serialization);
139 GST_CHECK_MAIN (gst_gl_color_convert);