comctl32/listview: Test WM_ERASEBKGND forwarding to parent on CL_NONE background.

This commit is contained in:
Nikolay Sivov 2009-05-03 03:12:50 +04:00 committed by Alexandre Julliard
parent 59b08cc1e3
commit 1fac98d3c1
1 changed files with 39 additions and 8 deletions

View File

@ -26,9 +26,10 @@
#include "wine/test.h" #include "wine/test.h"
#include "msg.h" #include "msg.h"
#define PARENT_SEQ_INDEX 0 #define PARENT_SEQ_INDEX 0
#define LISTVIEW_SEQ_INDEX 1 #define PARENT_FULL_SEQ_INDEX 1
#define NUM_MSG_SEQUENCES 2 #define LISTVIEW_SEQ_INDEX 2
#define NUM_MSG_SEQUENCES 3
#define LISTVIEW_ID 0 #define LISTVIEW_ID 0
#define HEADER_ID 1 #define HEADER_ID 1
@ -162,6 +163,11 @@ static const struct message empty_seq[] = {
{ 0 } { 0 }
}; };
static const struct message forward_erasebkgnd_parent_seq[] = {
{ WM_ERASEBKGND, sent },
{ 0 }
};
struct subclass_info struct subclass_info
{ {
WNDPROC oldproc; WNDPROC oldproc;
@ -173,6 +179,12 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
LRESULT ret; LRESULT ret;
struct message msg; 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 */ /* log system messages, except for painting */
if (message < WM_USER && if (message < WM_USER &&
message != WM_PAINT && 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); 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_SEQ_INDEX, &msg);
} }
add_message(sequences, PARENT_FULL_SEQ_INDEX, &msg);
defwndproc_counter++; defwndproc_counter++;
ret = DefWindowProcA(hwnd, message, wParam, lParam); ret = DefWindowProcA(hwnd, message, wParam, lParam);
@ -1058,6 +1066,8 @@ static void test_create(void)
static void test_redraw(void) static void test_redraw(void)
{ {
HWND hwnd, hwndheader; HWND hwnd, hwndheader;
HDC hdc;
BOOL res;
hwnd = create_listview_control(0); hwnd = create_listview_control(0);
hwndheader = subclass_header(hwnd); hwndheader = subclass_header(hwnd);
@ -1071,6 +1081,27 @@ static void test_redraw(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES); 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); DestroyWindow(hwnd);
} }