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.
This commit is contained in:
Owen Rudge 2009-11-18 15:35:07 -06:00 committed by Alexandre Julliard
parent 8d93b9cee8
commit 5ce3af5b37
1 changed files with 8 additions and 5 deletions

View File

@ -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);