comctl32: Return previously set colors for PBM_SETBKCOLOR and PBM_SETBARCOLOR.

This commit is contained in:
Nikolay Sivov 2013-05-25 20:12:12 +04:00 committed by Alexandre Julliard
parent 589b48e495
commit 65a47e3df6
2 changed files with 45 additions and 4 deletions

View File

@ -690,17 +690,25 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
return infoPtr->CurVal; return infoPtr->CurVal;
case PBM_SETBARCOLOR: case PBM_SETBARCOLOR:
{
COLORREF clr = infoPtr->ColorBar;
infoPtr->ColorBar = (COLORREF)lParam; infoPtr->ColorBar = (COLORREF)lParam;
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
return 0; return clr;
}
case PBM_GETBARCOLOR: case PBM_GETBARCOLOR:
return infoPtr->ColorBar; return infoPtr->ColorBar;
case PBM_SETBKCOLOR: case PBM_SETBKCOLOR:
{
COLORREF clr = infoPtr->ColorBk;
infoPtr->ColorBk = (COLORREF)lParam; infoPtr->ColorBk = (COLORREF)lParam;
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
return 0; return clr;
}
case PBM_GETBKCOLOR: case PBM_GETBKCOLOR:
return infoPtr->ColorBk; return infoPtr->ColorBk;

View File

@ -32,6 +32,11 @@
static HWND hProgressParentWnd, hProgressWnd; static HWND hProgressParentWnd, hProgressWnd;
static const char progressTestClass[] = "ProgressBarTestClass"; static const char progressTestClass[] = "ProgressBarTestClass";
static HWND create_progress(DWORD style)
{
return CreateWindowExA(0, PROGRESS_CLASSA, "", WS_VISIBLE | style,
0, 0, 100, 20, NULL, NULL, GetModuleHandleA(NULL), 0);
}
/* try to make sure pending X events have been processed before continuing */ /* try to make sure pending X events have been processed before continuing */
static void flush_events(void) static void flush_events(void)
@ -224,12 +229,40 @@ static void test_redraw(void)
ok(erased, "Progress bar should have erased the background\n"); ok(erased, "Progress bar should have erased the background\n");
} }
static void test_setcolors(void)
{
HWND progress;
COLORREF clr;
progress = create_progress(PBS_SMOOTH);
clr = SendMessageA(progress, PBM_SETBARCOLOR, 0, 0);
ok(clr == CLR_DEFAULT, "got %x\n", clr);
clr = SendMessageA(progress, PBM_SETBARCOLOR, 0, RGB(0, 255, 0));
ok(clr == 0, "got %x\n", clr);
clr = SendMessageA(progress, PBM_SETBARCOLOR, 0, CLR_DEFAULT);
ok(clr == RGB(0, 255, 0), "got %x\n", clr);
clr = SendMessageA(progress, PBM_SETBKCOLOR, 0, 0);
ok(clr == CLR_DEFAULT, "got %x\n", clr);
clr = SendMessageA(progress, PBM_SETBKCOLOR, 0, RGB(255, 0, 0));
ok(clr == 0, "got %x\n", clr);
clr = SendMessageA(progress, PBM_SETBKCOLOR, 0, CLR_DEFAULT);
ok(clr == RGB(255, 0, 0), "got %x\n", clr);
DestroyWindow(progress);
}
START_TEST(progress) START_TEST(progress)
{ {
init(); init();
test_redraw(); test_redraw();
test_setcolors();
cleanup(); cleanup();
} }