[PATCH 1/2] user32/tests: Test for correct scaling of DrawIcon

Wilfried Pasquazzo wilfried.pasquazzo at gmail.com
Tue Sep 22 12:05:07 CDT 2009


Hi,

current behaviour of Wine's DrawIcon: Draw Icon in its own dimensions.
correct behaviour of DrawIcon: Stretch/Shrink Icon to
GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) dimension,
  as described at the end of:
http://msdn.microsoft.com/en-us/library/ms997538.aspx

Crosstest passes in WindowsXP Prof. SP2

modified file(s): dlls/user32/tests/cursoricon.c

Best Regards



Wilfried Pasquazzo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20090922/476f9d5d/attachment.htm>
-------------- next part --------------
From ffb7ce910a00f23d173c18baae71a0b93ffaa1f1 Mon Sep 17 00:00:00 2001
From: Wilfried Pasquazzo <wilfried.pasquazzo at gmail.com>
Date: Tue, 22 Sep 2009 15:56:06 +0000
Subject: [PATCH 1/2] user32/tests: Test for correct scaling of DrawIcon

---
 dlls/user32/tests/cursoricon.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c
index 3f8bd82..d007335 100644
--- a/dlls/user32/tests/cursoricon.c
+++ b/dlls/user32/tests/cursoricon.c
@@ -1039,6 +1039,8 @@ static void check_DrawIcon(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, COLOR
     HICON hicon = create_test_icon(hdc, 1, 1, bpp, maskvalue, &color, sizeof(color));
     if (!hicon) return;
     SetPixelV(hdc, 0, 0, background);
+    SetPixelV(hdc, GetSystemMetrics(SM_CXICON)-1, GetSystemMetrics(SM_CYICON)-1, background);
+    SetPixelV(hdc, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), background);
     DrawIcon(hdc, 0, 0, hicon);
     result = GetPixel(hdc, 0, 0);
 
@@ -1047,6 +1049,21 @@ static void check_DrawIcon(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, COLOR
         "Overlaying Mask %d on Color %06X with DrawIcon. "
         "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n",
         maskvalue, color, modern_expected, legacy_expected, result, line);
+
+    result = GetPixel(hdc, GetSystemMetrics(SM_CXICON)-1, GetSystemMetrics(SM_CYICON)-1);
+
+    ok (color_match(result, modern_expected) ||         /* Windows 2000 and up */
+        broken(color_match(result, legacy_expected)),   /* Windows NT 4.0, 9X and below */
+        "Overlaying Mask %d on Color %06X with DrawIcon. "
+        "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n",
+        maskvalue, color, modern_expected, legacy_expected, result, line);
+
+    result = GetPixel(hdc, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
+
+    ok (color_match(result, background),  
+        "Overlaying Mask %d on Color %06X with DrawIcon. "
+        "Expected unchanged background color %06X. Got %06X from line %d\n",
+        maskvalue, color, background, result, line);
 }
 
 static void test_DrawIcon(void)
@@ -1070,8 +1087,8 @@ static void test_DrawIcon(void)
 
     memset(&bitmapInfo, 0, sizeof(bitmapInfo));
     bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-    bitmapInfo.bmiHeader.biWidth = 1;
-    bitmapInfo.bmiHeader.biHeight = 1;
+    bitmapInfo.bmiHeader.biWidth = GetSystemMetrics(SM_CXICON)+1;
+    bitmapInfo.bmiHeader.biHeight = GetSystemMetrics(SM_CYICON)+1;
     bitmapInfo.bmiHeader.biBitCount = 32;
     bitmapInfo.bmiHeader.biPlanes = 1;
     bitmapInfo.bmiHeader.biCompression = BI_RGB;
-- 
1.6.3.3


More information about the wine-patches mailing list