Nikolay Sivov : comctl32/imagelist: Fix return value from IImageList_SetBkColor().

Alexandre Julliard julliard at winehq.org
Mon Aug 23 10:50:17 CDT 2010


Module: wine
Branch: master
Commit: 9b77425f6a2bdd968f2135142ef54ee7837fcac9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9b77425f6a2bdd968f2135142ef54ee7837fcac9

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Aug 21 19:22:34 2010 +0400

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 f110787..89333bf 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 dc1c0c8..ff3ada4 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();
 




More information about the wine-cvs mailing list