[1/2] oleaut32/tests: Testcase for IPicture_Render with icons, check for drawing size and position

Wilfried Pasquazzo wilfried.pasquazzo at gmail.com
Wed Oct 14 12:08:25 CDT 2009


Yet another testcase+fix for a regression introduced
by one of my previous patches.

---
[1/2] oleaut32/tests: ...

modified files: oleaut32/tests/olepicture.c

Draws a icon and checks if it is scaled and positioned correctly.
Windows XP passes all tests.
Wine fails at the scaling test (marked with todo_wine).
---
[2/2] oleaut32: ...

modified files: oleaut32/olepicture.c
modified files: oleaut32/tests/olepicture.c

Fix for Wine scaling of Icons when drawing.
Wine now passes the previously implemented scaling test.
todo_wine of scaling test removed.

Fixes Bug: http://bugs.winehq.org/show_bug.cgi?id=20365

Note: I didn't remove the FIXME-Message, because this
implementation seems still not completely right. It does only allow
to draw the whole icon, because it ignores the src width and height
parameters. However it worked well like this for over 8 years and
it is very unlikely that any real application will want to draw only a
part of an icon.
---


Wilfried Pasquazzo
-------------- next part --------------
From 82c26605aa16cc42f6272ab7943faf2d7c8567bf Mon Sep 17 00:00:00 2001
From: Wilfried Pasquazzo <wilfried.pasquazzo at gmail.com>
Date: Wed, 14 Oct 2009 18:54:39 +0200
Subject: [PATCH 1/2] Testcase for IPicture_Render, correct size and position

---
 dlls/oleaut32/tests/olepicture.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
index 2dc1b05..150fcf8 100644
--- a/dlls/oleaut32/tests/olepicture.c
+++ b/dlls/oleaut32/tests/olepicture.c
@@ -594,6 +594,9 @@ static void test_Render(void)
     HRESULT hres;
     short type;
     PICTDESC desc;
+    OLE_XSIZE_HIMETRIC pWidth;
+    OLE_YSIZE_HIMETRIC pHeight;
+    COLORREF result;
     HDC hdc = GetDC(0);
 
     /* test IPicture::Render return code on uninitialized picture */
@@ -646,8 +649,28 @@ static void test_Render(void)
     ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
     hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 10, 10, NULL);
     ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
-    IPicture_Release(pic);
 
+    /* Check if target size and position is respected */
+    IPicture_get_Width(pic, &pWidth);
+    IPicture_get_Height(pic, &pHeight);
+
+    SetPixelV(hdc, 0, 0, 0x00F0F0F0);
+    SetPixelV(hdc, 5, 5, 0x00F0F0F0);
+    SetPixelV(hdc, 10, 10, 0x00F0F0F0);
+
+    IPicture_Render(pic, hdc, 1, 1, 9, 9, 0, 0, pWidth, -pHeight, NULL);
+
+    result = GetPixel(hdc, 0, 0);
+    ok(result == 0x00F0F0F0,
+       "Color at 0,0 should be unchanged 0xF0F0F0, but was 0x%06X\n", result);
+    result = GetPixel(hdc, 5, 5);
+    ok(result != 0x00F0F0F0,
+       "Color at 5,5 should have changed, but still was 0x%06X\n", result);
+    result = GetPixel(hdc, 10, 10);
+    todo_wine ok(result == 0x00F0F0F0,
+       "Color at 10,10 should be unchanged 0xF0F0F0, but was 0x%06X\n", result);
+
+    IPicture_Release(pic);
     ReleaseDC(NULL, hdc);
 }
 
-- 
1.6.4.4


More information about the wine-patches mailing list