src/test/SDL_test_compare.c
changeset 9254 6c469ea796e4
parent 8149 681eb46b8ac4
child 9619 b94b6d0bff0f
     1.1 --- a/src/test/SDL_test_compare.c	Sun Nov 30 22:17:12 2014 +0100
     1.2 +++ b/src/test/SDL_test_compare.c	Sun Nov 30 20:55:27 2014 -0800
     1.3 @@ -43,6 +43,7 @@
     1.4     int bpp, bpp_reference;
     1.5     Uint8 *p, *p_reference;
     1.6     int dist;
     1.7 +   int sampleErrorX, sampleErrorY, sampleDist;
     1.8     Uint8 R, G, B, A;
     1.9     Uint8 Rd, Gd, Bd, Ad;
    1.10     char imageFilename[128];
    1.11 @@ -86,6 +87,11 @@
    1.12           /* Allow some difference in blending accuracy */
    1.13           if (dist > allowable_error) {
    1.14              ret++;
    1.15 +            if (ret == 1) {
    1.16 +               sampleErrorX = i;
    1.17 +               sampleErrorY = j;
    1.18 +               sampleDist = dist;
    1.19 +            }
    1.20           }
    1.21        }
    1.22     }
    1.23 @@ -96,6 +102,8 @@
    1.24     /* Save test image and reference for analysis on failures */
    1.25     _CompareSurfaceCount++;
    1.26     if (ret != 0) {
    1.27 +      SDLTest_LogError("Comparison of pixels with allowable error of %i failed %i times.", allowable_error, ret);
    1.28 +      SDLTest_LogError("First detected occurrence at position %i,%i with a squared RGB-difference of %i.", sampleErrorX, sampleErrorY, sampleDist); 
    1.29        SDL_snprintf(imageFilename, 127, "CompareSurfaces%04d_TestOutput.bmp", _CompareSurfaceCount);
    1.30        SDL_SaveBMP(surface, imageFilename);
    1.31        SDL_snprintf(referenceFilename, 127, "CompareSurfaces%04d_Reference.bmp", _CompareSurfaceCount);