2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for DrawThemeParentBackground
5 * PROGRAMMERS: Giannis Adamopoulos
12 #include <undocuser.h>
14 #include <user32testhelpers.h>
18 static int get_iwnd(HWND hWnd
)
20 if(hWnd
== hWnd1
) return 1;
21 else if(hWnd
== hWnd2
) return 2;
25 static LRESULT CALLBACK
TestProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
27 int iwnd
= get_iwnd(hwnd
);
29 if(message
> WM_USER
|| !iwnd
|| message
== WM_GETICON
)
30 return DefWindowProc(hwnd
, message
, wParam
, lParam
);
32 RECORD_MESSAGE(iwnd
, message
, SENT
, 0,0);
33 return DefWindowProc(hwnd
, message
, wParam
, lParam
);
36 static void FlushMessages()
40 while (PeekMessage( &msg
, 0, 0, 0, PM_REMOVE
))
42 int iwnd
= get_iwnd(msg
.hwnd
);
43 if(iwnd
&& msg
.message
<= WM_USER
)
44 RECORD_MESSAGE(iwnd
, msg
.message
, POST
,0,0);
45 DispatchMessageW( &msg
);
49 MSG_ENTRY draw_parent_chain
[]={{1, WM_ERASEBKGND
},
58 RegisterSimpleClass(TestProc
, L
"testClass");
60 hWnd1
= CreateWindowW(L
"testClass", L
"Test parent", WS_OVERLAPPEDWINDOW
| WS_VISIBLE
, 100, 100, 200, 200, 0, NULL
, NULL
, NULL
);
61 ok (hWnd1
!= NULL
, "Expected CreateWindowW to succeed\n");
62 ShowWindow(hWnd1
, SW_SHOW
);
65 hWnd2
= CreateWindowW(L
"testClass", L
"test window", WS_CHILD
| WS_VISIBLE
, 0, 0, 100, 100, hWnd1
, NULL
, NULL
, NULL
);
66 ok (hWnd2
!= NULL
, "Expected CreateWindowW to succeed\n");
67 ShowWindow(hWnd2
, SW_SHOW
);
73 DrawThemeParentBackground(hWnd2
, NULL
, NULL
);
75 COMPARE_CACHE(empty_chain
);
77 DrawThemeParentBackground(hWnd1
, NULL
, NULL
);
79 COMPARE_CACHE(empty_chain
);
83 DrawThemeParentBackground(hWnd2
, hdc
, NULL
);
85 COMPARE_CACHE(draw_parent_chain
);
87 DrawThemeParentBackground(hWnd1
, hdc
, NULL
);
89 COMPARE_CACHE(empty_chain
);
91 memset(&rc
, 0, sizeof(rc
));
93 DrawThemeParentBackground(hWnd2
, hdc
, &rc
);
95 COMPARE_CACHE(draw_parent_chain
);
97 DrawThemeParentBackground(hWnd1
, hdc
, &rc
);
99 COMPARE_CACHE(empty_chain
);
102 START_TEST(DrawThemeParentBackground
)