Owen Rudge : comctl32/tests: Use SHIL_SYSSMALL instead of LARGE, and compare with system metrics.

Alexandre Julliard julliard at winehq.org
Thu Nov 19 10:15:20 CST 2009


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

Author: Owen Rudge <orudge at codeweavers.com>
Date:   Wed Nov 18 15:35:07 2009 -0600

comctl32/tests: Use SHIL_SYSSMALL instead of LARGE, and compare with system metrics.

This patch fixes a test failure if a user has a non-standard icon size 
set. Windows 7, for instance, offers more variation than previous 
versions of Windows in icon scaling. We should get the system icon 
metric and compare our icon size against that.

---

 dlls/comctl32/tests/imagelist.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index ef5034c..22286d3 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -998,6 +998,7 @@ static void test_shell_imagelist(void)
     HRESULT hr;
     int out = 0;
     RECT rect;
+    int cx, cy;
 
     /* Try to load function from shell32 */
     hShell32 = LoadLibrary("shell32.dll");
@@ -1010,7 +1011,7 @@ static void test_shell_imagelist(void)
     }
 
     /* Get system image list */
-    hr = (pSHGetImageList)(SHIL_LARGE, &IID_IImageList, (void**)&iml);
+    hr = (pSHGetImageList)(SHIL_SYSSMALL, &IID_IImageList, (void**)&iml);
 
     ok(SUCCEEDED(hr), "SHGetImageList failed, hr=%x\n", hr);
 
@@ -1020,11 +1021,13 @@ static void test_shell_imagelist(void)
     IImageList_GetImageCount(iml, &out);
     ok(out > 0, "IImageList_GetImageCount returned out <= 0\n");
 
-    /* right and bottom should be 32x32 for large icons, or 48x48 if larger
-       icons enabled in control panel */
+    /* Fetch the small icon size */
+    cx = GetSystemMetrics(SM_CXSMICON);
+    cy = GetSystemMetrics(SM_CYSMICON);
+
+    /* Check icon size matches */
     IImageList_GetImageRect(iml, 0, &rect);
-    ok((((rect.right == 32) && (rect.bottom == 32)) ||
-                  ((rect.right == 48) && (rect.bottom == 48))),
+    ok(((rect.right == cx) && (rect.bottom == cy)),
                  "IImageList_GetImageRect returned r:%d,b:%d\n",
                  rect.right, rect.bottom);
 




More information about the wine-cvs mailing list