From e0deddbcf6215cfa3f270abab5426fc6bdfd41b2 Mon Sep 17 00:00:00 2001 From: Andre Guedes Date: Thu, 25 Apr 2019 14:16:46 -0700 Subject: [PATCH] tests: Add AVTP sink tests This patch adds test cases for the AVTP sink element. For now, only properties get() and set() are covered. --- tests/check/Makefile.am | 5 +++- tests/check/elements/avtpsink.c | 66 +++++++++++++++++++++++++++++++++++++++++ tests/check/meson.build | 1 + 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 tests/check/elements/avtpsink.c diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index be10214..513b85f 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -40,7 +40,7 @@ check_assrender = endif if USE_AVTP -check_avtp = elements/avtpaafpay elements/avtpaafdepay +check_avtp = elements/avtpaafpay elements/avtpaafdepay elements/avtpsink else check_avtp = endif @@ -510,6 +510,9 @@ elements_avtpaafpay_LDADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(LDADD) $ elements_avtpaafdepay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS) $(AVTP_CFLAGS) elements_avtpaafdepay_LDADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(LDADD) $(AVTP_LIBS) +elements_avtpsink_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS) +elements_avtpsink_LDADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(LDADD) + elements_mpegtsmux_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS) elements_mpegtsmux_LDADD = $(GST_PLUGINS_BASE_LIBS) $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) $(LDADD) diff --git a/tests/check/elements/avtpsink.c b/tests/check/elements/avtpsink.c new file mode 100644 index 0000000..78bd909 --- /dev/null +++ b/tests/check/elements/avtpsink.c @@ -0,0 +1,66 @@ +/* + * GStreamer AVTP Plugin + * Copyright (C) 2019 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include + +GST_START_TEST (test_properties) +{ + GstElement *element; + const gchar *ifname = "enp1s0"; + const gchar *address = "01:AA:BB:CC:DD:EE"; + const gint priority = 3; + gchar *str; + gint val; + + element = gst_check_setup_element ("avtpsink"); + + g_object_set (G_OBJECT (element), "ifname", ifname, NULL); + g_object_get (G_OBJECT (element), "ifname", &str, NULL); + fail_unless_equals_string (str, ifname); + g_free (str); + + g_object_set (G_OBJECT (element), "address", address, NULL); + g_object_get (G_OBJECT (element), "address", &str, NULL); + fail_unless_equals_string (str, address); + g_free (str); + + g_object_set (G_OBJECT (element), "priority", priority, NULL); + g_object_get (G_OBJECT (element), "priority", &val, NULL); + fail_unless (val, priority); + + gst_check_teardown_element (element); +} + +GST_END_TEST; + +static Suite * +avtpsink_suite (void) +{ + Suite *s = suite_create ("avtpsink"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_properties); + + return s; +} + +GST_CHECK_MAIN (avtpsink); diff --git a/tests/check/meson.build b/tests/check/meson.build index e4ca077..dd745cd 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -72,6 +72,7 @@ if host_machine.system() != 'windows' [['elements/assrender.c'], not ass_dep.found(), [ass_dep]], [['elements/avtpaafpay.c'], not avtp_dep.found(), [avtp_dep]], [['elements/avtpaafdepay.c'], not avtp_dep.found(), [avtp_dep]], + [['elements/avtpsink.c'], not avtp_dep.found(), [avtp_dep]], [['elements/ccconverter.c']], [['elements/cccombiner.c']], [['elements/ccextractor.c']], -- 2.7.4