[mutter] tests/cogl: Migrate fence test



commit 5d40a5eeeaa072e240a77bd9988e23a20d2166de
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Aug 4 22:31:34 2022 +0200

    tests/cogl: Migrate fence test
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>

 cogl/tests/conform/meson.build                      |  1 -
 cogl/tests/conform/test-conform-main.c              |  2 --
 cogl/tests/conform/test-declarations.h              |  1 -
 src/tests/cogl/conform/meson.build                  |  1 +
 {cogl/tests => src/tests/cogl}/conform/test-fence.c | 16 ++++++++++++----
 5 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/cogl/tests/conform/meson.build b/cogl/tests/conform/meson.build
index b1ff85e1df..6162775dde 100644
--- a/cogl/tests/conform/meson.build
+++ b/cogl/tests/conform/meson.build
@@ -1,6 +1,5 @@
 cogl_test_conformance_sources = [
   'test-conform-main.c',
-  'test-fence.c',
 ]
 
 #unported = [
diff --git a/cogl/tests/conform/test-conform-main.c b/cogl/tests/conform/test-conform-main.c
index da214ce212..df89197cde 100644
--- a/cogl/tests/conform/test-conform-main.c
+++ b/cogl/tests/conform/test-conform-main.c
@@ -72,8 +72,6 @@ main (int argc, char **argv)
 
   UNPORTED_TEST (test_viewport);
 
-  ADD_TEST (test_fence, TEST_REQUIREMENT_FENCE, 0);
-
   g_printerr ("Unknown test name \"%s\"\n", argv[1]);
 
   return 1;
diff --git a/cogl/tests/conform/test-declarations.h b/cogl/tests/conform/test-declarations.h
index 75c568a798..3faa4effcb 100644
--- a/cogl/tests/conform/test-declarations.h
+++ b/cogl/tests/conform/test-declarations.h
@@ -8,6 +8,5 @@ void test_backface_culling (void);
 void test_gles2_context (void);
 void test_gles2_context_fbo (void);
 void test_gles2_context_copy_tex_image (void);
-void test_fence (void);
 
 #endif /* COGL_TEST_DECLARATIONS_H */
diff --git a/src/tests/cogl/conform/meson.build b/src/tests/cogl/conform/meson.build
index 1d44f1828d..03781774c0 100644
--- a/src/tests/cogl/conform/meson.build
+++ b/src/tests/cogl/conform/meson.build
@@ -38,6 +38,7 @@ cogl_tests = [
   [ 'test-texture-no-allocate', [] ],
   [ 'test-pipeline-shader-state', [] ],
   [ 'test-texture-rg', [] ],
+  [ 'test-fence', [] ],
 ]
 
 cogl_test_conformance_includes = [
diff --git a/cogl/tests/conform/test-fence.c b/src/tests/cogl/conform/test-fence.c
similarity index 86%
rename from cogl/tests/conform/test-fence.c
rename to src/tests/cogl/conform/test-fence.c
index 6c429c1d7e..b48abcc15e 100644
--- a/cogl/tests/conform/test-fence.c
+++ b/src/tests/cogl/conform/test-fence.c
@@ -1,8 +1,6 @@
 #include <cogl/cogl.h>
 
-#include "test-declarations.h"
-#include "test-utils.h"
-#include "cogl-config.h"
+#include "tests/cogl-test-utils.h"
 
 /* I'm writing this on the train after having dinner at a churrascuria. */
 #define MAGIC_CHUNK_O_DATA ((void *) 0xdeadbeef)
@@ -30,7 +28,7 @@ callback (CoglFence *fence,
   g_main_loop_quit (loop);
 }
 
-void
+static void
 test_fence (void)
 {
   GSource *cogl_source;
@@ -38,6 +36,12 @@ test_fence (void)
   int fb_height = cogl_framebuffer_get_height (test_fb);
   CoglFenceClosure *closure;
 
+  if (!cogl_has_feature (test_ctx, COGL_FEATURE_ID_FENCE))
+    {
+      g_test_skip ("Missing fence support");
+      return;
+    }
+
   cogl_source = cogl_glib_source_new (test_ctx, G_PRIORITY_DEFAULT);
   g_source_attach (cogl_source, NULL);
   loop = g_main_loop_new (NULL, TRUE);
@@ -58,3 +62,7 @@ test_fence (void)
   if (cogl_test_verbose ())
     g_print ("OK\n");
 }
+
+COGL_TEST_SUITE (
+  g_test_add_func ("/fence", test_fence);
+)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]