From 1fac98d3c1f28346f1e4c273c4dacfb12cca12d8 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 3 May 2009 03:12:50 +0400 Subject: [PATCH] comctl32/listview: Test WM_ERASEBKGND forwarding to parent on CL_NONE background. --- dlls/comctl32/tests/listview.c | 47 +++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 6b575dcfb7a..42bb1894b5d 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -26,9 +26,10 @@ #include "wine/test.h" #include "msg.h" -#define PARENT_SEQ_INDEX 0 -#define LISTVIEW_SEQ_INDEX 1 -#define NUM_MSG_SEQUENCES 2 +#define PARENT_SEQ_INDEX 0 +#define PARENT_FULL_SEQ_INDEX 1 +#define LISTVIEW_SEQ_INDEX 2 +#define NUM_MSG_SEQUENCES 3 #define LISTVIEW_ID 0 #define HEADER_ID 1 @@ -162,6 +163,11 @@ static const struct message empty_seq[] = { { 0 } }; +static const struct message forward_erasebkgnd_parent_seq[] = { + { WM_ERASEBKGND, sent }, + { 0 } +}; + struct subclass_info { WNDPROC oldproc; @@ -173,6 +179,12 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP LRESULT ret; struct message msg; + msg.message = message; + msg.flags = sent|wparam|lparam; + if (defwndproc_counter) msg.flags |= defwinproc; + msg.wParam = wParam; + msg.lParam = lParam; + /* log system messages, except for painting */ if (message < WM_USER && message != WM_PAINT && @@ -185,13 +197,9 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP { trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); - msg.message = message; - msg.flags = sent|wparam|lparam; - if (defwndproc_counter) msg.flags |= defwinproc; - msg.wParam = wParam; - msg.lParam = lParam; add_message(sequences, PARENT_SEQ_INDEX, &msg); } + add_message(sequences, PARENT_FULL_SEQ_INDEX, &msg); defwndproc_counter++; ret = DefWindowProcA(hwnd, message, wParam, lParam); @@ -1058,6 +1066,8 @@ static void test_create(void) static void test_redraw(void) { HWND hwnd, hwndheader; + HDC hdc; + BOOL res; hwnd = create_listview_control(0); hwndheader = subclass_header(hwnd); @@ -1071,6 +1081,27 @@ static void test_redraw(void) flush_sequences(sequences, NUM_MSG_SEQUENCES); + /* forward WM_ERASEBKGND to parent on CLR_NONE background color */ + res = ListView_SetBkColor(hwnd, CLR_NONE); + expect(TRUE, res); + + hdc = GetWindowDC(hwndparent); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageA(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0); + ok_sequence(sequences, PARENT_FULL_SEQ_INDEX, forward_erasebkgnd_parent_seq, + "forward WM_ERASEBKGND on CLR_NONE", TRUE); + + res = ListView_SetBkColor(hwnd, CLR_DEFAULT); + expect(TRUE, res); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageA(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0); + ok_sequence(sequences, PARENT_FULL_SEQ_INDEX, empty_seq, + "don't forward WM_ERASEBKGND on non-CLR_NONE", FALSE); + + ReleaseDC(hwndparent, hdc); + DestroyWindow(hwnd); } -- 2.11.4.GIT