From e65bb38720c8990684ce24bda08b78d8da49cc1b Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 16 Feb 2010 11:38:51 +0000 Subject: [PATCH] conform: Use g_assert_cmpint() in cogl-readpixels test The g_assert_cmpint() macro prints out not just the assertion condition but also the assertion contents; this is useful to catch wrong values without incrementing the verbosity of the test itself. --- tests/conform/test-cogl-readpixels.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/conform/test-cogl-readpixels.c b/tests/conform/test-cogl-readpixels.c index eb29da0f9..e83071c8a 100644 --- a/tests/conform/test-cogl-readpixels.c +++ b/tests/conform/test-cogl-readpixels.c @@ -73,11 +73,10 @@ on_paint (ClutterActor *actor, void *state) COGL_PIXEL_FORMAT_RGBA_8888, (guchar *)pixels); - g_assert (pixels[0] == 0xff0000ff); - g_assert (pixels[FRAMEBUFFER_WIDTH - 1] == 0xff00ff00); - g_assert (pixels[(FRAMEBUFFER_HEIGHT - 1) * FRAMEBUFFER_WIDTH] == 0xffff0000); - g_assert (pixels[(FRAMEBUFFER_HEIGHT - 1) * FRAMEBUFFER_WIDTH + - FRAMEBUFFER_WIDTH - 1] == 0xffffffff); + g_assert_cmpint (pixels[0], ==, 0xff0000ff); + g_assert_cmpint (pixels[FRAMEBUFFER_WIDTH - 1], ==, 0xff00ff00); + g_assert_cmpint (pixels[(FRAMEBUFFER_HEIGHT - 1) * FRAMEBUFFER_WIDTH], ==, 0xffff0000); + g_assert_cmpint (pixels[(FRAMEBUFFER_HEIGHT - 1) * FRAMEBUFFER_WIDTH + FRAMEBUFFER_WIDTH - 1], ==, 0xffffffff); g_free (pixels); cogl_pop_framebuffer (); @@ -95,11 +94,10 @@ on_paint (ClutterActor *actor, void *state) COGL_PIXEL_FORMAT_RGBA_8888, (guchar *)pixels); - g_assert (pixels[0] == 0xff0000ff); - g_assert (pixels[FRAMEBUFFER_WIDTH - 1] == 0xff00ff00); - g_assert (pixels[(FRAMEBUFFER_HEIGHT - 1) * FRAMEBUFFER_WIDTH] == 0xffff0000); - g_assert (pixels[(FRAMEBUFFER_HEIGHT - 1) * FRAMEBUFFER_WIDTH + - FRAMEBUFFER_WIDTH - 1] == 0xffffffff); + g_assert_cmpint (pixels[0], ==, 0xff0000ff); + g_assert_cmpint (pixels[FRAMEBUFFER_WIDTH - 1], ==, 0xff00ff00); + g_assert_cmpint (pixels[(FRAMEBUFFER_HEIGHT - 1) * FRAMEBUFFER_WIDTH], ==, 0xffff0000); + g_assert_cmpint (pixels[(FRAMEBUFFER_HEIGHT - 1) * FRAMEBUFFER_WIDTH + FRAMEBUFFER_WIDTH - 1], ==, 0xffffffff); g_free (pixels); cogl_handle_unref (tex);