[1/1]oleaut32: Fix Testcases on NT4 and lower (try 2)

Wilfried Pasquazzo wilfried.pasquazzo at gmail.com
Sun Oct 18 13:57:54 CDT 2009


Resend of Patch with same name.

modified files: oleaut32/tests/olepicture.c

Nikolay Sivov gave me the hint to check the return value
of the Render()-call, therefore I made some tests with a
fresh Win98 SE-Installation and found that
IPicture::Render() will claim it succeeds,
even if it didn't render anything.

I improved the patch by checking now the return value of
the Render()-Call, made the test less dependent on
the bpp of the target device context and therefore could
drop some of the "broken" statements.

Testcase passes on WindowsXP SP2, Win98 SE and
of course Wine itself. It should now also pass on all the
other OS.

Wilfried Pasquazzo
-------------- next part --------------
From 015688515e36594b0fbc8fec60628c3f75f9665a Mon Sep 17 00:00:00 2001
From: Wilfried Pasquazzo <wilfried.pasquazzo at gmail.com>
Date: Sun, 18 Oct 2009 20:42:47 +0200
Subject: [PATCH] Updated IPicture_Render testcase to pass on all older WinOS

---
 dlls/oleaut32/tests/olepicture.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
index 42f58ae..55d883b 100644
--- a/dlls/oleaut32/tests/olepicture.c
+++ b/dlls/oleaut32/tests/olepicture.c
@@ -596,7 +596,7 @@ static void test_Render(void)
     PICTDESC desc;
     OLE_XSIZE_HIMETRIC pWidth;
     OLE_YSIZE_HIMETRIC pHeight;
-    COLORREF result;
+    COLORREF result, expected;
     HDC hdc = GetDC(0);
 
     /* test IPicture::Render return code on uninitialized picture */
@@ -657,18 +657,29 @@ static void test_Render(void)
     SetPixelV(hdc, 0, 0, 0x00F0F0F0);
     SetPixelV(hdc, 5, 5, 0x00F0F0F0);
     SetPixelV(hdc, 10, 10, 0x00F0F0F0);
+    expected = GetPixel(hdc, 0, 0);
 
-    IPicture_Render(pic, hdc, 1, 1, 9, 9, 0, 0, pWidth, -pHeight, NULL);
+    hres = IPicture_Render(pic, hdc, 1, 1, 9, 9, 0, 0, pWidth, -pHeight, NULL);
+    ole_expect(hres, S_OK);
+
+    if(hres != S_OK) {
+        IPicture_Release(pic);
+        ReleaseDC(NULL, hdc);
+        return;
+    }
 
+    /* Evaluate the rendered Icon */
     result = GetPixel(hdc, 0, 0);
-    ok(result == 0x00F0F0F0,
-       "Color at 0,0 should be unchanged 0xF0F0F0, but was 0x%06X\n", result);
+    ok(result == expected,
+       "Color at 0,0 should be unchanged 0x%06X, but was 0x%06X\n", expected, result);
     result = GetPixel(hdc, 5, 5);
-    ok(result != 0x00F0F0F0,
-       "Color at 5,5 should have changed, but still was 0x%06X\n", result);
+    ok(result != expected ||
+        broken(result == expected), /* WinNT 4.0 and older may claim they drew */
+                                    /* the icon, even if they didn't. */
+       "Color at 5,5 should have changed, but still was 0x%06X\n", expected);
     result = GetPixel(hdc, 10, 10);
-    ok(result == 0x00F0F0F0,
-       "Color at 10,10 should be unchanged 0xF0F0F0, but was 0x%06X\n", result);
+    ok(result == expected,
+       "Color at 10,10 should be unchanged 0x%06X, but was 0x%06X\n", expected, result);
 
     IPicture_Release(pic);
     ReleaseDC(NULL, hdc);
-- 
1.6.4.4


More information about the wine-patches mailing list