[cogl] Convert the test-atlas-migration test to a standalone Cogl test
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] Convert the test-atlas-migration test to a standalone Cogl test
- Date: Wed, 16 May 2012 14:44:42 +0000 (UTC)
commit 32c5a3ed546effd2e2946f22f173a20cf36b2fdf
Author: Neil Roberts <neil linux intel com>
Date: Wed May 16 12:57:32 2012 +0100
Convert the test-atlas-migration test to a standalone Cogl test
This updates test-atlas-migration from being a Clutter-based test to a
Cogl-based test.
Reviewed-by: Robert Bragg <robert linux intel com>
tests/conform/Makefile.am | 2 +-
tests/conform/test-atlas-migration.c | 41 ++++++++++++++++++++++-----------
tests/conform/test-conform-main.c | 2 +-
3 files changed, 29 insertions(+), 16 deletions(-)
---
diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am
index 8379fe6..6b330b7 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -22,13 +22,13 @@ unported_test_sources = \
test-texture-mipmaps.c \
test-texture-pixmap-x11.c \
test-texture-rectangle.c \
- test-atlas-migration.c \
test-vertex-buffer-contiguous.c \
test-vertex-buffer-interleved.c \
test-vertex-buffer-mutability.c \
$(NULL)
test_sources = \
+ test-atlas-migration.c \
test-bitmask.c \
test-blend-strings.c \
test-depth-test.c \
diff --git a/tests/conform/test-atlas-migration.c b/tests/conform/test-atlas-migration.c
index 56be060..55660a8 100644
--- a/tests/conform/test-atlas-migration.c
+++ b/tests/conform/test-atlas-migration.c
@@ -1,6 +1,6 @@
-#include <clutter/clutter.h>
+#include <cogl/cogl.h>
-#include "test-conform-common.h"
+#include "test-utils.h"
#define N_TEXTURES 128
@@ -10,16 +10,21 @@
#define COLOR_FOR_SIZE(size) \
(colors + (size) % 3)
-static const ClutterColor colors[] =
+typedef struct
+{
+ uint8_t red, green, blue, alpha;
+} TestColor;
+
+static const TestColor colors[] =
{ { 0xff, 0x00, 0x00, 0xff },
{ 0x00, 0xff, 0x00, 0xff },
{ 0x00, 0x00, 0xff, 0xff } };
-static CoglHandle
+static CoglTexture *
create_texture (int size)
{
- CoglHandle texture;
- const ClutterColor *color;
+ CoglTexture *texture;
+ const TestColor *color;
uint8_t *data, *p;
int x, y;
@@ -65,11 +70,11 @@ create_texture (int size)
}
static void
-verify_texture (CoglHandle texture, int size)
+verify_texture (CoglTexture *texture, int size)
{
uint8_t *data, *p;
int x, y;
- const ClutterColor *color;
+ const TestColor *color;
color = COLOR_FOR_SIZE (size);
@@ -86,9 +91,18 @@ verify_texture (CoglHandle texture, int size)
for (x = 0; x < size; x++)
{
- g_assert_cmpint (p[0], ==, color->red * opacity / 255);
- g_assert_cmpint (p[1], ==, color->green * opacity / 255);
- g_assert_cmpint (p[2], ==, color->blue * opacity / 255);
+ TestColor real_color =
+ {
+ color->red * opacity / 255,
+ color->green * opacity / 255,
+ color->blue * opacity / 255
+ };
+
+ test_utils_compare_pixel (p,
+ (real_color.red << 24) |
+ (real_color.green << 16) |
+ (real_color.blue << 8) |
+ opacity);
g_assert_cmpint (p[3], ==, opacity);
p += 4;
@@ -99,10 +113,9 @@ verify_texture (CoglHandle texture, int size)
}
void
-test_atlas_migration (TestUtilsGTestFixture *fixture,
- void *data)
+test_atlas_migration (void)
{
- CoglHandle textures[N_TEXTURES];
+ CoglTexture *textures[N_TEXTURES];
int i, tex_num;
/* Create and destroy all of the textures a few times to increase
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index bb1c48c..08968c9 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -72,7 +72,7 @@ main (int argc, char **argv)
ADD_TEST (test_wrap_modes, 0);
UNPORTED_TEST (test_texture_pixmap_x11);
UNPORTED_TEST (test_texture_get_set_data);
- UNPORTED_TEST (test_atlas_migration);
+ ADD_TEST (test_atlas_migration, 0);
ADD_TEST (test_read_texture_formats, 0);
ADD_TEST (test_write_texture_formats, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]