From 856dda32882f08a63c0456759c5af506d9de9c4a Mon Sep 17 00:00:00 2001 From: Owen Rudge Date: Thu, 12 Nov 2009 10:27:44 -0600 Subject: [PATCH] comctl32/tests: Add IImageList creation test. --- dlls/comctl32/tests/imagelist.c | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index 944e4ecf7ca..dd02c332806 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -74,6 +74,9 @@ static HIMAGELIST (WINAPI *pImageList_Create)(int, int, UINT, int, int); static int (WINAPI *pImageList_Add)(HIMAGELIST, HBITMAP, HBITMAP); static BOOL (WINAPI *pImageList_DrawIndirect)(IMAGELISTDRAWPARAMS*); static BOOL (WINAPI *pImageList_SetImageCount)(HIMAGELIST,UINT); +static HRESULT (WINAPI *pImageList_CoCreateInstance)(REFCLSID,const IUnknown *, + REFIID,void **); +static HRESULT (WINAPI *pHIMAGELIST_QueryInterface)(HIMAGELIST,REFIID,void **); static HDC desktopDC; static HINSTANCE hinst; @@ -1244,6 +1247,38 @@ cleanup: } } +static void test_iimagelist(void) +{ + IImageList *imgl; + HIMAGELIST himl; + HRESULT hr; + + if (!pImageList_CoCreateInstance || !pHIMAGELIST_QueryInterface) + { + win_skip("Vista imagelist functions not available\n"); + return; + } + + hr = pImageList_CoCreateInstance(&CLSID_ImageList, NULL, &IID_IImageList, (void **) &imgl); + ok(SUCCEEDED(hr), "ImageList_CoCreateInstance failed, hr=%x\n", hr); + + if (hr == S_OK) + IImageList_Release(imgl); + + himl = createImageList(32, 32); + + if (!himl) + return; + + hr = (pHIMAGELIST_QueryInterface)(himl, &IID_IImageList, (void **) &imgl); + ok(SUCCEEDED(hr), "HIMAGELIST_QueryInterface failed, hr=%x\n", hr); + + if (hr == S_OK) + IImageList_Release(imgl); + + ImageList_Destroy(himl); +} + START_TEST(imagelist) { ULONG_PTR ctx_cookie; @@ -1280,10 +1315,17 @@ START_TEST(imagelist) pImageList_Add = (void*)GetProcAddress(hComCtl32, "ImageList_Add"); pImageList_DrawIndirect = (void*)GetProcAddress(hComCtl32, "ImageList_DrawIndirect"); pImageList_SetImageCount = (void*)GetProcAddress(hComCtl32, "ImageList_SetImageCount"); + pImageList_CoCreateInstance = (void*)GetProcAddress(hComCtl32, "ImageList_CoCreateInstance"); + pHIMAGELIST_QueryInterface = (void*)GetProcAddress(hComCtl32, "HIMAGELIST_QueryInterface"); + + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); /* Do v6.0 tests */ test_ImageList_DrawIndirect(); test_shell_imagelist(); + test_iimagelist(); + + CoUninitialize(); unload_v6_module(ctx_cookie, hCtx); }