Owen Rudge : comctl32/tests: Add basic test for IImageList using SHGetImageList.
Alexandre Julliard
julliard at winehq.org
Thu Aug 13 10:41:07 CDT 2009
Module: wine
Branch: master
Commit: 1556fbf86c6dace66a6dbc7e49e6d4d1395aa933
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1556fbf86c6dace66a6dbc7e49e6d4d1395aa933
Author: Owen Rudge <orudge at codeweavers.com>
Date: Wed Aug 12 21:51:28 2009 +0100
comctl32/tests: Add basic test for IImageList using SHGetImageList.
---
dlls/comctl32/tests/imagelist.c | 58 +++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index 3fe249f..e1ad8da 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -4,6 +4,7 @@
* Copyright 2004 Michael Stefaniuc
* Copyright 2002 Mike McCormack for CodeWeavers
* Copyright 2007 Dmitry Timoshkov
+ * Copyright 2009 Owen Rudge for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,8 +34,12 @@
#include "winuser.h"
#include "objbase.h"
#include "commctrl.h" /* must be included after objbase.h to get ImageList_Write */
+#include "initguid.h"
+#include "commoncontrols.h"
+#include "shellapi.h"
#include "wine/test.h"
+#include "v6util.h"
#undef VISIBLE
@@ -981,8 +986,52 @@ static void test_imagelist_storage(void)
iml_clear_stream_data();
}
+static void test_shell_imagelist(void)
+{
+ BOOL (WINAPI *pSHGetImageList)(INT, REFIID, void**);
+ IImageList *iml = NULL;
+ HMODULE hShell32;
+ HRESULT hr;
+ int out = 0;
+ RECT rect;
+
+ /* Try to load function from shell32 */
+ hShell32 = LoadLibrary("shell32.dll");
+ pSHGetImageList = (void*)GetProcAddress(hShell32, (LPCSTR) 727);
+
+ if (!pSHGetImageList)
+ {
+ win_skip("SHGetImageList not available, skipping test\n");
+ return;
+ }
+
+ /* Get system image list */
+ hr = (pSHGetImageList)(SHIL_LARGE, &IID_IImageList, (void**)&iml);
+
+ todo_wine ok(SUCCEEDED(hr), "SHGetImageList failed, hr=%x\n", hr);
+
+ if (hr != S_OK)
+ return;
+
+ IImageList_GetImageCount(iml, &out);
+ todo_wine ok(out > 0, "IImageList_GetImageCount returned out <= 0");
+
+ /* right and bottom should be 32x32 for large icons, or 48x48 if larger
+ icons enabled in control panel */
+ IImageList_GetImageRect(iml, 0, &rect);
+ todo_wine ok((((rect.right == 32) && (rect.bottom == 32)) ||
+ ((rect.right == 48) && (rect.bottom == 48))),
+ "IImageList_GetImageRect returned r:%d,b:%d",
+ rect.right, rect.bottom);
+
+ IImageList_Release(iml);
+ FreeLibrary(hShell32);
+}
+
START_TEST(imagelist)
{
+ ULONG_PTR ctx_cookie;
+
HMODULE hComCtl32 = GetModuleHandle("comctl32.dll");
pImageList_DrawIndirect = (void*)GetProcAddress(hComCtl32, "ImageList_DrawIndirect");
pImageList_SetImageCount = (void*)GetProcAddress(hComCtl32, "ImageList_SetImageCount");
@@ -998,4 +1047,13 @@ START_TEST(imagelist)
DoTest3();
testMerge();
test_imagelist_storage();
+
+ /* Now perform v6 tests */
+
+ if (!load_v6_module(&ctx_cookie))
+ return;
+
+ test_shell_imagelist();
+
+ unload_v6_module(ctx_cookie);
}
More information about the wine-cvs
mailing list