[gdk-pixbuf] tests: Fix non-sensical error in reftest



commit d8ea84789810477aa130b2e5f7c8e27a5e3587ab
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Dec 29 14:00:42 2016 +0100

    tests: Fix non-sensical error in reftest
    
    The debug output was always printing the very first pixel of the line as
    both the reference and test data, leading to "useful" output like:
    Image data at 1x1 is #B16C42FF, but should be #B16C42FF
    
    Read the reference and test pixel values from the correct offset in the
    line to fix this.

 tests/test-common.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/tests/test-common.c b/tests/test-common.c
index a4ea4fa..cda9988 100644
--- a/tests/test-common.c
+++ b/tests/test-common.c
@@ -156,15 +156,15 @@ pixdata_equal (GdkPixbuf  *test,
                     {
                       g_set_error (error, GDK_PIXBUF_ERROR, 0, "Image data at %ux%u is #%02X%02X%02X%02X, 
but should be #%02X%02X%02X%02X",
                                    x, y,
-                                   test_pixels[0], test_pixels[1], test_pixels[2], test_pixels[3],
-                                   ref_pixels[0], ref_pixels[1], ref_pixels[2], ref_pixels[3]);
+                                   test_pixels[x * n_channels + 0], test_pixels[x * n_channels + 1], 
test_pixels[x * n_channels + 2], test_pixels[x * n_channels + 3],
+                                   ref_pixels[x * n_channels + 0], ref_pixels[x * n_channels + 1], 
ref_pixels[x * n_channels + 2], ref_pixels[x * n_channels + 3]);
                     }
                   else if (n_channels == 3)
                     {
                       g_set_error (error, GDK_PIXBUF_ERROR, 0, "Image data at %ux%u is #%02X%02X%02X, but 
should be #%02X%02X%02X",
                                    x, y,
-                                   test_pixels[0], test_pixels[1], test_pixels[2],
-                                   ref_pixels[0], ref_pixels[1], ref_pixels[2]);
+                                   test_pixels[x * n_channels + 0], test_pixels[x * n_channels + 1], 
test_pixels[x * n_channels + 2],
+                                   ref_pixels[x * n_channels + 0], ref_pixels[x * n_channels + 1], 
ref_pixels[x * n_channels + 2]);
                     }
                   else
                     {


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