1 /* GStreamer
2 *
3 * Copyright (C) 2019 Matthew Waters <matthew@centricular.com>
4 *
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.
9 *
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.
14 *
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., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24
25 #include <gst/gst.h>
26 #include <gst/check/gstcheck.h>
27 #include <gst/vulkan/vulkan.h>
28
29 static GstVulkanInstance *instance;
30
31 static void
setup(void)32 setup (void)
33 {
34 instance = gst_vulkan_instance_new ();
35 fail_unless (gst_vulkan_instance_open (instance, NULL));
36 }
37
38 static void
teardown(void)39 teardown (void)
40 {
41 gst_object_unref (instance);
42 }
43
GST_START_TEST(test_device_new)44 GST_START_TEST (test_device_new)
45 {
46 GstVulkanDevice *device;
47 GstVulkanInstance *dev_instance;
48
49 device = gst_vulkan_device_new_with_index (instance, 0);
50 g_object_get (device, "instance", &dev_instance, NULL);
51 fail_unless (dev_instance == instance);
52 gst_object_unref (dev_instance);
53 gst_object_unref (device);
54 }
55
56 GST_END_TEST;
57
58 static Suite *
vkdevice_suite(void)59 vkdevice_suite (void)
60 {
61 Suite *s = suite_create ("vkdevice");
62 TCase *tc_basic = tcase_create ("general");
63 gboolean have_instance;
64
65 suite_add_tcase (s, tc_basic);
66 tcase_add_checked_fixture (tc_basic, setup, teardown);
67
68 /* FIXME: CI doesn't have a software vulkan renderer (and none exists currently) */
69 instance = gst_vulkan_instance_new ();
70 have_instance = gst_vulkan_instance_open (instance, NULL);
71 gst_object_unref (instance);
72 if (have_instance) {
73 tcase_add_test (tc_basic, test_device_new);
74 }
75
76 return s;
77 }
78
79
80 GST_CHECK_MAIN (vkdevice);
81