• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 GstVulkanDisplay *display;
30 static GstVulkanInstance *instance;
31 
32 static void
setup(void)33 setup (void)
34 {
35   instance = gst_vulkan_instance_new ();
36   fail_unless (gst_vulkan_instance_open (instance, NULL));
37   display = gst_vulkan_display_new (instance);
38 }
39 
40 static void
teardown(void)41 teardown (void)
42 {
43   gst_object_unref (display);
44   gst_object_unref (instance);
45 }
46 
GST_START_TEST(test_window_new)47 GST_START_TEST (test_window_new)
48 {
49   GstVulkanWindow *window;
50   GstVulkanDisplay *win_display;
51 
52   window = gst_vulkan_window_new (display);
53   g_object_get (window, "display", &win_display, NULL);
54   fail_unless (win_display == display);
55   gst_object_unref (win_display);
56   gst_object_unref (window);
57 }
58 
59 GST_END_TEST;
60 
61 static Suite *
vkwindow_suite(void)62 vkwindow_suite (void)
63 {
64   Suite *s = suite_create ("vkwindow");
65   TCase *tc_basic = tcase_create ("general");
66   gboolean have_instance;
67 
68   suite_add_tcase (s, tc_basic);
69   tcase_add_checked_fixture (tc_basic, setup, teardown);
70 
71   /* FIXME: CI doesn't have a software vulkan renderer (and none exists currently) */
72   instance = gst_vulkan_instance_new ();
73   have_instance = gst_vulkan_instance_open (instance, NULL);
74   gst_object_unref (instance);
75   if (have_instance) {
76     tcase_add_test (tc_basic, test_window_new);
77   }
78 
79   return s;
80 }
81 
82 
83 GST_CHECK_MAIN (vkwindow);
84