Module: wine Branch: master Commit: acbd632039a96a02feebc911a88de3114094512b URL: http://source.winehq.org/git/wine.git/?a=commit;h=acbd632039a96a02feebc911a8...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sat Aug 21 19:31:29 2010 +0400
comctl32/imagelist: Fix return value for IImageList_GetIconSize().
---
dlls/comctl32/imagelist.c | 5 +--- dlls/comctl32/tests/imagelist.c | 48 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 89333bf..9396b95 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3431,7 +3431,7 @@ static HRESULT WINAPI ImageListImpl_GetIconSize(IImageList *iface, int *cx, { HIMAGELIST This = (HIMAGELIST) iface;
- return ImageList_GetIconSize(This, cx, cy) ? S_OK : E_FAIL; + return ImageList_GetIconSize(This, cx, cy) ? S_OK : E_INVALIDARG; }
static HRESULT WINAPI ImageListImpl_SetIconSize(IImageList *iface, int cx, @@ -3442,9 +3442,6 @@ static HRESULT WINAPI ImageListImpl_SetIconSize(IImageList *iface, int cx,
static HRESULT WINAPI ImageListImpl_GetImageCount(IImageList *iface, int *pi) { - if (!pi) - return E_FAIL; - *pi = ImageList_GetImageCount((HIMAGELIST) iface); return S_OK; } diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index ff3ada4..c5ea95f 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1863,6 +1863,52 @@ if (0) IImageList_Release(imgl); }
+static void test_IImageList_GetImageCount(void) +{ + IImageList *imgl; + HIMAGELIST himl; + int count; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + +if (0) +{ + /* crashes on native */ + hr = IImageList_GetImageCount(imgl, NULL); +} + + count = -1; + hr = IImageList_GetImageCount(imgl, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count == 0, "got %d\n", count); + + IImageList_Release(imgl); +} + +static void test_IImageList_GetIconSize(void) +{ + IImageList *imgl; + HIMAGELIST himl; + int cx, cy; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + + hr = IImageList_GetIconSize(imgl, NULL, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IImageList_GetIconSize(imgl, &cx, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IImageList_GetIconSize(imgl, NULL, &cy); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + IImageList_Release(imgl); +} + START_TEST(imagelist) { ULONG_PTR ctx_cookie; @@ -1918,6 +1964,8 @@ START_TEST(imagelist) test_IImageList_Clone(); test_IImageList_GetBkColor(); test_IImageList_SetBkColor(); + test_IImageList_GetImageCount(); + test_IImageList_GetIconSize();
CoUninitialize();