Nikolay Sivov : comctl32/rebar: Fix default just inserted band colors.

Alexandre Julliard julliard at winehq.org
Wed Dec 23 10:04:11 CST 2009


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

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Wed Dec 23 02:18:06 2009 +0300

comctl32/rebar: Fix default just inserted band colors.

---

 dlls/comctl32/rebar.c       |    6 ++++--
 dlls/comctl32/tests/rebar.c |   21 +++++++++++++++++++--
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index dd385af..90e79d5 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -2409,8 +2409,10 @@ REBAR_InsertBandT(REBAR_INFO *infoPtr, INT iIndex, LPREBARBANDINFOW lprbbi, BOOL
 
     /* initialize band */
     memset(lpBand, 0, sizeof(lpBand));
-    lpBand->clrFore = infoPtr->clrText;
-    lpBand->clrBack = infoPtr->clrBk;
+    lpBand->clrFore = infoPtr->clrText == CLR_NONE ? infoPtr->clrBtnText :
+                                                     infoPtr->clrText;
+    lpBand->clrBack = infoPtr->clrBk == CLR_NONE ? infoPtr->clrBtnFace :
+                                                   infoPtr->clrBk;
     lpBand->iImage = -1;
 
     REBAR_CommonSetupBand(infoPtr->hwndSelf, lprbbi, lpBand);
diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c
index df5a93d..e2021d1 100644
--- a/dlls/comctl32/tests/rebar.c
+++ b/dlls/comctl32/tests/rebar.c
@@ -764,8 +764,8 @@ static void expect_band_content(HWND hRebar, UINT uBand, INT fStyle, COLORREF cl
     rb.cch = MAX_PATH;
     ok(SendMessageA(hRebar, RB_GETBANDINFOA, uBand, (LPARAM)&rb), "RB_GETBANDINFO failed\n");
     expect_eq(rb.fStyle, fStyle, int, "%x");
-    todo_wine expect_eq(rb.clrFore, clrFore, COLORREF, "%x");
-    todo_wine expect_eq(rb.clrBack, clrBack, unsigned, "%x");
+    expect_eq(rb.clrFore, clrFore, COLORREF, "%x");
+    expect_eq(rb.clrBack, clrBack, COLORREF, "%x");
     expect_eq(strcmp(rb.lpText, lpText), 0, int, "%d");
     expect_eq(rb.iImage, iImage, int, "%x");
     expect_eq(rb.hwndChild, hwndChild, HWND, "%p");
@@ -850,6 +850,7 @@ static void test_colors(void)
     COLORREF clr;
     BOOL ret;
     HWND hRebar;
+    REBARBANDINFOA bi;
 
     hRebar = create_rebar_control();
 
@@ -871,6 +872,22 @@ static void test_colors(void)
     else
         skip("RB_GETCOLORSCHEME not supported\n");
 
+    /* check default band colors */
+    add_band_w(hRebar, "", 0, 10, 10);
+    bi.cbSize = REBARBANDINFOA_V6_SIZE;
+    bi.fMask = RBBIM_COLORS;
+    bi.clrFore = bi.clrBack = 0xc0ffe;
+    ret = SendMessage(hRebar, RB_GETBANDINFO, 0, (LPARAM)&bi);
+    ok(ret, "RB_GETBANDINFO failed\n");
+    compare(bi.clrFore, RGB(0, 0, 0), "%x");
+    compare(bi.clrBack, GetSysColor(COLOR_3DFACE), "%x");
+
+    SendMessage(hRebar, RB_SETTEXTCOLOR, 0, RGB(255, 0, 0));
+    bi.clrFore = bi.clrBack = 0xc0ffe;
+    ret = SendMessage(hRebar, RB_GETBANDINFO, 0, (LPARAM)&bi);
+    ok(ret, "RB_GETBANDINFO failed\n");
+    compare(bi.clrFore, RGB(0, 0, 0), "%x");
+
     DestroyWindow(hRebar);
 }
 




More information about the wine-cvs mailing list