From 9b77425f6a2bdd968f2135142ef54ee7837fcac9 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sat, 21 Aug 2010 19:22:34 +0400 Subject: [PATCH] comctl32/imagelist: Fix return value from IImageList_SetBkColor(). --- dlls/comctl32/imagelist.c | 5 +---- dlls/comctl32/tests/imagelist.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index f110787bac4..89333bfa8c5 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3458,11 +3458,8 @@ static HRESULT WINAPI ImageListImpl_SetImageCount(IImageList *iface, static HRESULT WINAPI ImageListImpl_SetBkColor(IImageList *iface, COLORREF clrBk, COLORREF *pclr) { - if (!pclr) - return E_FAIL; - *pclr = ImageList_SetBkColor((HIMAGELIST) iface, clrBk); - return *pclr == CLR_NONE ? E_FAIL : S_OK; + return S_OK; } static HRESULT WINAPI ImageListImpl_GetBkColor(IImageList *iface, COLORREF *pclr) diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index dc1c0c8a9e3..ff3ada4f5b5 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1833,6 +1833,36 @@ if (0) IImageList_Release(imgl); } +static void test_IImageList_SetBkColor(void) +{ + IImageList *imgl; + HIMAGELIST himl; + COLORREF color; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + +if (0) +{ + /* crashes on native */ + hr = IImageList_SetBkColor(imgl, RGB(0, 0, 0), NULL); +} + + hr = IImageList_SetBkColor(imgl, CLR_NONE, &color); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IImageList_SetBkColor(imgl, CLR_NONE, &color); + ok(hr == S_OK, "got 0x%08x\n", hr); + + color = 0xdeadbeef; + hr = IImageList_GetBkColor(imgl, &color); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(color == CLR_NONE, "got %x\n", color); + + IImageList_Release(imgl); +} + START_TEST(imagelist) { ULONG_PTR ctx_cookie; @@ -1887,6 +1917,7 @@ START_TEST(imagelist) test_IImageList_Merge(); test_IImageList_Clone(); test_IImageList_GetBkColor(); + test_IImageList_SetBkColor(); CoUninitialize();