1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
/*
* 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/check/gstcheck.h>
#include <gst/check/gstharness.h>
GST_START_TEST (test_clock_select_tai_clock)
{
GstHarness *h;
GstElement *element;
GstClock *clock;
guint clock_type;
h = gst_harness_new_parse ("clockselect clock-id=tai");
/* Check if element provides right clock */
element = gst_harness_find_element (h, "clockselect");
clock = gst_element_provide_clock (element);
fail_unless (GST_IS_SYSTEM_CLOCK (clock));
g_object_get (G_OBJECT (clock), "clock-type", &clock_type, NULL);
fail_unless_equals_uint64 (clock_type, GST_CLOCK_TYPE_TAI);
gst_object_unref (element);
gst_object_unref (clock);
gst_harness_teardown (h);
}
GST_END_TEST;
GST_START_TEST (test_clock_select_realtime_clock)
{
GstHarness *h;
GstElement *element;
GstClock *clock;
guint clock_type;
h = gst_harness_new_parse ("clockselect clock-id=realtime");
/* Check if element provides right clock */
element = gst_harness_find_element (h, "clockselect");
clock = gst_element_provide_clock (element);
fail_unless (GST_IS_SYSTEM_CLOCK (clock));
g_object_get (G_OBJECT (clock), "clock-type", &clock_type, NULL);
fail_unless_equals_uint64 (clock_type, GST_CLOCK_TYPE_REALTIME);
gst_object_unref (element);
gst_object_unref (clock);
gst_harness_teardown (h);
}
GST_END_TEST;
GST_START_TEST (test_clock_select_monotonic_clock)
{
GstHarness *h;
GstElement *element;
GstClock *clock;
guint clock_type;
h = gst_harness_new_parse ("clockselect clock-id=monotonic");
/* Check if element provides right clock */
element = gst_harness_find_element (h, "clockselect");
clock = gst_element_provide_clock (element);
fail_unless (GST_IS_SYSTEM_CLOCK (clock));
g_object_get (G_OBJECT (clock), "clock-type", &clock_type, NULL);
fail_unless_equals_uint64 (clock_type, GST_CLOCK_TYPE_MONOTONIC);
gst_object_unref (element);
gst_object_unref (clock);
gst_harness_teardown (h);
}
GST_END_TEST;
GST_START_TEST (test_clock_select_properties)
{
GstHarness *h;
GstElement *element;
guint clock_id, domain;
h = gst_harness_new_parse ("clockselect clock-id=ptp ptp-domain=2");
/* Check if all properties were properly set up */
element = gst_harness_find_element (h, "clockselect");
g_object_get (G_OBJECT (element), "clock-id", &clock_id, NULL);
fail_unless_equals_uint64 (clock_id, 3);
g_object_get (G_OBJECT (element), "ptp-domain", &domain, NULL);
fail_unless_equals_uint64 (domain, 2);
gst_object_unref (element);
gst_harness_teardown (h);
}
GST_END_TEST;
static Suite *
clock_select_suite (void)
{
Suite *s = suite_create ("clockselect");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_clock_select_properties);
tcase_add_test (tc_chain, test_clock_select_monotonic_clock);
tcase_add_test (tc_chain, test_clock_select_realtime_clock);
tcase_add_test (tc_chain, test_clock_select_tai_clock);
return s;
}
GST_CHECK_MAIN (clock_select);
|