tests: Add AVTP sink tests
[platform/upstream/gstreamer.git] / tests / check / elements / avtpsink.c
1 /*
2  * GStreamer AVTP Plugin
3  * Copyright (C) 2019 Intel Corporation
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later
9  * version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301 USA
20  */
21
22 #include <gst/check/gstcheck.h>
23
24 GST_START_TEST (test_properties)
25 {
26   GstElement *element;
27   const gchar *ifname = "enp1s0";
28   const gchar *address = "01:AA:BB:CC:DD:EE";
29   const gint priority = 3;
30   gchar *str;
31   gint val;
32
33   element = gst_check_setup_element ("avtpsink");
34
35   g_object_set (G_OBJECT (element), "ifname", ifname, NULL);
36   g_object_get (G_OBJECT (element), "ifname", &str, NULL);
37   fail_unless_equals_string (str, ifname);
38   g_free (str);
39
40   g_object_set (G_OBJECT (element), "address", address, NULL);
41   g_object_get (G_OBJECT (element), "address", &str, NULL);
42   fail_unless_equals_string (str, address);
43   g_free (str);
44
45   g_object_set (G_OBJECT (element), "priority", priority, NULL);
46   g_object_get (G_OBJECT (element), "priority", &val, NULL);
47   fail_unless (val, priority);
48
49   gst_check_teardown_element (element);
50 }
51
52 GST_END_TEST;
53
54 static Suite *
55 avtpsink_suite (void)
56 {
57   Suite *s = suite_create ("avtpsink");
58   TCase *tc_chain = tcase_create ("general");
59
60   suite_add_tcase (s, tc_chain);
61   tcase_add_test (tc_chain, test_properties);
62
63   return s;
64 }
65
66 GST_CHECK_MAIN (avtpsink);