[cogl/wip/rib/cogl-1.12: 96/139] Split test-point-sprite into two, one without checking orientation
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/rib/cogl-1.12: 96/139] Split test-point-sprite into two, one without checking orientation
- Date: Wed, 15 Aug 2012 13:11:30 +0000 (UTC)
commit 786d1b8e40e47c7a9cb70c01aee54e822d83fb8d
Author: Neil Roberts <neil linux intel com>
Date: Mon Jul 2 14:50:54 2012 +0100
Split test-point-sprite into two, one without checking orientation
There is currently a known bug where when rendering offscreen point
sprites will be rendered upside-down. For that reason
test-point-sprite is marked as a known failure because it checks the
orientation of the point sprites and the conformance test suite is
rendered to offscreen buffers by default. However this doesn't help to
catch more general failures that stop the point sprites being rendered
at all. To fix this the test-point-sprite test has been split into two
tests, one which verifies the orientation and one which does not. The
two tests are in the same source file and internally share the same
static function but pass a flag to specify whether to check the
orientation. If the orientation should be ignored then it will create
a 2x1 texture instead of a 2x2 texture so that it will appear the same
regardless of whether it is upside-down. The checks for the colors
have been altered accordingly.
Reviewed-by: Robert Bragg <robert linux intel com>
(cherry picked from commit 51b7fdbe17f300cf2edf42c2ca740ad748c9fd78)
tests/conform/test-conform-main.c | 2 ++
tests/conform/test-point-sprite.c | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index aa2f746..fc49635 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -94,6 +94,8 @@ main (int argc, char **argv)
ADD_TEST (test_point_size, 0);
ADD_TEST (test_point_sprite,
+ TEST_REQUIREMENT_POINT_SPRITE);
+ ADD_TEST (test_point_sprite_orientation,
TEST_KNOWN_FAILURE | TEST_REQUIREMENT_POINT_SPRITE);
ADD_TEST (test_version, 0);
diff --git a/tests/conform/test-point-sprite.c b/tests/conform/test-point-sprite.c
index e899017..d50611f 100644
--- a/tests/conform/test-point-sprite.c
+++ b/tests/conform/test-point-sprite.c
@@ -18,8 +18,8 @@ tex_data[3 * 2 * 2] =
0x00, 0xff, 0xff, 0xff, 0x00, 0x00
};
-void
-test_point_sprite (void)
+static void
+do_test (CoglBool check_orientation)
{
int fb_width = cogl_framebuffer_get_width (fb);
int fb_height = cogl_framebuffer_get_height (fb);
@@ -28,6 +28,7 @@ test_point_sprite (void)
CoglTexture2D *tex_2d;
CoglPipeline *pipeline, *solid_pipeline;
CoglBool res;
+ int tex_height;
cogl_framebuffer_orthographic (fb,
0, 0, /* x_1, y_1 */
@@ -39,8 +40,16 @@ test_point_sprite (void)
COGL_BUFFER_BIT_COLOR,
1.0f, 1.0f, 1.0f, 1.0f);
+ /* If we're not checking the orientation of the point sprite then
+ * we'll set the height of the texture to 1 so that the vertical
+ * orientation does not matter */
+ if (check_orientation)
+ tex_height = 2;
+ else
+ tex_height = 1;
+
tex_2d = cogl_texture_2d_new_from_data (ctx,
- 2, 2, /* width/height */
+ 2, tex_height, /* width/height */
COGL_PIXEL_FORMAT_RGB_888,
COGL_PIXEL_FORMAT_ANY,
6, /* row stride */
@@ -111,11 +120,15 @@ test_point_sprite (void)
test_utils_check_pixel (fb,
POINT_SIZE - POINT_SIZE / 4,
POINT_SIZE + POINT_SIZE / 4,
- 0x00ffffff);
+ check_orientation ?
+ 0x00ffffff :
+ 0x0000ffff);
test_utils_check_pixel (fb,
POINT_SIZE + POINT_SIZE / 4,
POINT_SIZE + POINT_SIZE / 4,
- 0xff0000ff);
+ check_orientation ?
+ 0xff0000ff :
+ 0x00ff00ff);
/* When rendering without the point sprites all of the texture
coordinates should be 0,0 so it should get the top-left texel
@@ -129,3 +142,15 @@ test_point_sprite (void)
if (cogl_test_verbose ())
g_print ("OK\n");
}
+
+void
+test_point_sprite (void)
+{
+ do_test (FALSE /* don't check orientation */);
+}
+
+void
+test_point_sprite_orientation (void)
+{
+ do_test (TRUE /* check orientation */);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]