Paul Vriens : gdiplus/tests: Fix a test failure.

Alexandre Julliard julliard at winehq.org
Wed Feb 3 09:33:07 CST 2010


Module: wine
Branch: master
Commit: 73c244052e13700d71f2a07369c89455e24f86ca
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=73c244052e13700d71f2a07369c89455e24f86ca

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Wed Feb  3 14:19:02 2010 +0100

gdiplus/tests: Fix a test failure.

---

 dlls/gdiplus/tests/image.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 10dc21e..d752f16 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -30,6 +30,18 @@
 #define expect(expected, got) ok((UINT)(got) == (UINT)(expected), "Expected %.8x, got %.8x\n", (UINT)(expected), (UINT)(got))
 #define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
 
+static BOOL color_match(ARGB c1, ARGB c2, BYTE max_diff)
+{
+    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
+    c1 >>= 8; c2 >>= 8;
+    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
+    c1 >>= 8; c2 >>= 8;
+    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
+    c1 >>= 8; c2 >>= 8;
+    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
+    return TRUE;
+}
+
 static void expect_guid(REFGUID expected, REFGUID got, int line, BOOL todo)
 {
     WCHAR bufferW[39];
@@ -1468,7 +1480,7 @@ static void test_gamma(void)
 
     stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
     expect(Ok, stat);
-    todo_wine expect(0xff20ffff, color);
+    todo_wine ok(color_match(0xff20ffff, color, 1), "Expected ff20ffff, got %.8x\n", color);
 
     GdipDeleteGraphics(graphics);
     GdipDisposeImage((GpImage*)bitmap1);




More information about the wine-cvs mailing list