[mutter] tests/cogl: Migrate map buffer range test



commit 33c582d33a7331468e06cde8ad33cd629d404f14
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Aug 4 21:58:27 2022 +0200

    tests/cogl: Migrate map buffer range 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 +
 .../tests/cogl}/conform/test-map-buffer-range.c           | 15 ++++++++++++---
 5 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/cogl/tests/conform/meson.build b/cogl/tests/conform/meson.build
index 32b98cdf95..f105f41289 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-map-buffer-range.c',
   'test-npot-texture.c',
   'test-alpha-textures.c',
   'test-texture-get-set-data.c',
diff --git a/cogl/tests/conform/test-conform-main.c b/cogl/tests/conform/test-conform-main.c
index 559ceed536..f5960a3046 100644
--- a/cogl/tests/conform/test-conform-main.c
+++ b/cogl/tests/conform/test-conform-main.c
@@ -77,8 +77,6 @@ main (int argc, char **argv)
             TEST_REQUIREMENT_GL,
             0);
 
-  ADD_TEST (test_map_buffer_range, TEST_REQUIREMENT_MAP_WRITE, 0);
-
   ADD_TEST (test_primitive_and_journal, 0, 0);
 
   ADD_TEST (test_copy_replace_texture, 0, 0);
diff --git a/cogl/tests/conform/test-declarations.h b/cogl/tests/conform/test-declarations.h
index 4b52911038..b0323fb009 100644
--- a/cogl/tests/conform/test-declarations.h
+++ b/cogl/tests/conform/test-declarations.h
@@ -9,7 +9,6 @@ void test_npot_texture (void);
 void test_texture_get_set_data (void);
 void test_alpha_textures (void);
 void test_framebuffer_get_bits (void);
-void test_map_buffer_range (void);
 void test_primitive_and_journal (void);
 void test_copy_replace_texture (void);
 void test_pipeline_cache_unrefs_texture (void);
diff --git a/src/tests/cogl/conform/meson.build b/src/tests/cogl/conform/meson.build
index 3fe80658f4..de4f56f053 100644
--- a/src/tests/cogl/conform/meson.build
+++ b/src/tests/cogl/conform/meson.build
@@ -27,6 +27,7 @@ cogl_tests = [
   [ 'test-no-gl-header', [] ],
   [ 'test-layer-remove', [] ],
   [ 'test-alpha-test', [] ],
+  [ 'test-map-buffer-range', [] ],
 ]
 
 cogl_test_conformance_includes = [
diff --git a/cogl/tests/conform/test-map-buffer-range.c b/src/tests/cogl/conform/test-map-buffer-range.c
similarity index 93%
rename from cogl/tests/conform/test-map-buffer-range.c
rename to src/tests/cogl/conform/test-map-buffer-range.c
index c4d28aaace..92ac397527 100644
--- a/cogl/tests/conform/test-map-buffer-range.c
+++ b/src/tests/cogl/conform/test-map-buffer-range.c
@@ -2,8 +2,7 @@
 
 #include <string.h>
 
-#include "test-declarations.h"
-#include "test-utils.h"
+#include "tests/cogl-test-utils.h"
 
 static uint8_t
 tex_data[2 * 2 * 4] =
@@ -23,7 +22,7 @@ vertex_data[4] =
     { 1, 1, 0, 0 }
   };
 
-void
+static void
 test_map_buffer_range (void)
 {
   CoglTexture2D *tex;
@@ -35,6 +34,12 @@ test_map_buffer_range (void)
   CoglAttribute *tex_coord_attribute;
   CoglPrimitive *primitive;
 
+  if (!cogl_has_feature (test_ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE))
+    {
+      g_test_skip ("Missing map buffer for write capability");
+      return;
+    }
+
   tex = cogl_texture_2d_new_from_data (test_ctx,
                                        2, 2, /* width/height */
                                        COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -122,3 +127,7 @@ test_map_buffer_range (void)
   if (cogl_test_verbose ())
     g_print ("OK\n");
 }
+
+COGL_TEST_SUITE (
+  g_test_add_func ("/map-buffer-range", test_map_buffer_range);
+)


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