diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index d3e14c7b87..bae1cf3585 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -43,6 +43,7 @@ check_gl=\ libs/gstglshader \ libs/gstglheaders \ libs/gstglformat \ + libs/gstglfeature \ elements/glimagesink \ elements/glbin \ pipelines/gl-launch-lines @@ -513,6 +514,14 @@ libs_gstglformat_LDADD = \ $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \ $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD) +libs_gstglfeature_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS) + +libs_gstglfeature_LDADD = \ + $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \ + $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD) + elements_glimagesink_CFLAGS = \ $(GST_PLUGINS_BASE_CFLAGS) \ $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS) diff --git a/tests/check/libs/.gitignore b/tests/check/libs/.gitignore index f883967dec..64a1eb63e7 100644 --- a/tests/check/libs/.gitignore +++ b/tests/check/libs/.gitignore @@ -10,6 +10,7 @@ fft gstglcolorconvert gstglcontext gstglheaders +gstglfeature gstglformat gstglmatrix gstglmemory diff --git a/tests/check/libs/gstglfeature.c b/tests/check/libs/gstglfeature.c new file mode 100644 index 0000000000..beffb87066 --- /dev/null +++ b/tests/check/libs/gstglfeature.c @@ -0,0 +1,161 @@ +/* GStreamer + * + * Copyright (C) 2018 Matthew Waters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include + +GST_START_TEST (test_same_version) +{ + fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 2, 2, 2), TRUE); +} + +GST_END_TEST; + +GST_START_TEST (test_greater_major_version) +{ + fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (3, 2, 2, 2), TRUE); +} + +GST_END_TEST; + +GST_START_TEST (test_greater_minor_version) +{ + fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 3, 2, 2), TRUE); +} + +GST_END_TEST; + +GST_START_TEST (test_greater_major_minor_version) +{ + fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (3, 3, 2, 2), TRUE); +} + +GST_END_TEST; + +GST_START_TEST (test_lesser_major_version) +{ + fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 2, 3, 2), FALSE); +} + +GST_END_TEST; + +GST_START_TEST (test_lesser_minor_version) +{ + fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 2, 2, 3), FALSE); +} + +GST_END_TEST; + +GST_START_TEST (test_lesser_major_minor_version) +{ + fail_unless_equals_int (GST_GL_CHECK_GL_VERSION (2, 2, 3, 3), FALSE); +} + +GST_END_TEST; + +static const gchar *dummy_extensions = "start middle end"; + +GST_START_TEST (test_extension_start) +{ + fail_unless_equals_int (gst_gl_check_extension ("start", dummy_extensions), + TRUE); +} + +GST_END_TEST; + +GST_START_TEST (test_extension_middle) +{ + fail_unless_equals_int (gst_gl_check_extension ("middle", dummy_extensions), + TRUE); +} + +GST_END_TEST; + +GST_START_TEST (test_extension_end) +{ + fail_unless_equals_int (gst_gl_check_extension ("end", dummy_extensions), + TRUE); +} + +GST_END_TEST; + +GST_START_TEST (test_extension_non_existent) +{ + fail_unless_equals_int (gst_gl_check_extension ("ZZZZZZ", dummy_extensions), + FALSE); +} + +GST_END_TEST; + +GST_START_TEST (test_extension_non_existent_start) +{ + fail_unless_equals_int (gst_gl_check_extension ("start1", dummy_extensions), + FALSE); +} + +GST_END_TEST; + +GST_START_TEST (test_extension_non_existent_middle) +{ + fail_unless_equals_int (gst_gl_check_extension ("middle1", dummy_extensions), + FALSE); +} + +GST_END_TEST; + +GST_START_TEST (test_extension_non_existent_end) +{ + fail_unless_equals_int (gst_gl_check_extension ("1end", dummy_extensions), + FALSE); +} + +GST_END_TEST; + +static Suite * +gst_gl_format_suite (void) +{ + Suite *s = suite_create ("Gst GL Feature"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_same_version); + tcase_add_test (tc_chain, test_greater_major_version); + tcase_add_test (tc_chain, test_greater_minor_version); + tcase_add_test (tc_chain, test_greater_major_minor_version); + tcase_add_test (tc_chain, test_lesser_major_version); + tcase_add_test (tc_chain, test_lesser_minor_version); + tcase_add_test (tc_chain, test_lesser_major_minor_version); + tcase_add_test (tc_chain, test_extension_start); + tcase_add_test (tc_chain, test_extension_middle); + tcase_add_test (tc_chain, test_extension_end); + tcase_add_test (tc_chain, test_extension_non_existent); + tcase_add_test (tc_chain, test_extension_non_existent_start); + tcase_add_test (tc_chain, test_extension_non_existent_middle); + tcase_add_test (tc_chain, test_extension_non_existent_end); + + return s; +} + +GST_CHECK_MAIN (gst_gl_format); diff --git a/tests/check/meson.build b/tests/check/meson.build index 3e4b3064bb..0e42f7f82e 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -75,6 +75,7 @@ if build_gstgl base_tests += [ [ 'libs/gstglcolorconvert.c', not build_gstgl, [gstgl_dep]], [ 'libs/gstglcontext.c', not build_gstgl, [gstgl_dep]], + [ 'libs/gstglfeature.c', not build_gstgl, [gstgl_dep]], [ 'libs/gstglformat.c', not build_gstgl, [gstgl_dep]], [ 'libs/gstglheaders.c', not build_gstgl, [gstgl_dep]], [ 'libs/gstglmatrix.c', not build_gstgl, [gstgl_dep]],