[PATCH 3/6] comctl32/tests: Extend PGM_SETCHILD tests.
Stefan Dösinger
stefan at codeweavers.com
Wed Apr 5 02:15:41 CDT 2017
Show that child windows are not made visible.
---
dlls/comctl32/tests/msg.h | 8 ++++++++
dlls/comctl32/tests/pager.c | 43 ++++++++++++++++++++++++++++++++++++++++---
2 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/tests/msg.h b/dlls/comctl32/tests/msg.h
index a3c789b..42f3981 100644
--- a/dlls/comctl32/tests/msg.h
+++ b/dlls/comctl32/tests/msg.h
@@ -41,6 +41,7 @@ typedef enum
id = 0x400,
custdraw = 0x800,
child1 = 0x1000,
+ child2 = 0x2000,
} msg_flags_t;
struct message
@@ -311,6 +312,8 @@ static void ok_sequence_(struct msg_sequence **seq, int sequence_index,
expected_win = "parent";
else if (expected->flags & child1)
expected_win = "child 1";
+ else if (expected->flags & child2)
+ expected_win = "child 2";
else
expected_win = "pager";
@@ -324,6 +327,11 @@ static void ok_sequence_(struct msg_sequence **seq, int sequence_index,
context, expected->message, expected_win);
if ((expected->flags & child1) != (actual->flags & child1)) dump++;
+ ok_(file, line) ((expected->flags & child2) == (actual->flags & child2),
+ "%s: the msg 0x%04x was expected in %s\n",
+ context, expected->message, expected_win);
+ if ((expected->flags & child2) != (actual->flags & child2)) dump++;
+
ok_(file, line) ((expected->flags & hook) == (actual->flags & hook),
"%s: the msg 0x%04x should have been sent by a hook\n",
context, expected->message);
diff --git a/dlls/comctl32/tests/pager.c b/dlls/comctl32/tests/pager.c
index 74fb42d..e9fc2e7 100644
--- a/dlls/comctl32/tests/pager.c
+++ b/dlls/comctl32/tests/pager.c
@@ -27,7 +27,7 @@
#define NUM_MSG_SEQUENCES 1
#define PAGER_SEQ_INDEX 0
-static HWND parent_wnd, child1_wnd;
+static HWND parent_wnd, child1_wnd, child2_wnd;
static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);
@@ -40,10 +40,28 @@ static const struct message set_child_seq[] = {
{ WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE },
{ WM_WINDOWPOSCHANGED, sent },
{ WM_WINDOWPOSCHANGING, sent|child1 },
- { WM_NCCALCSIZE, sent|wparam|child1, TRUE },
+ { WM_NCCALCSIZE, sent|wparam|child1|optional, TRUE },
{ WM_CHILDACTIVATE, sent|child1 },
{ WM_WINDOWPOSCHANGED, sent|child1 },
- { WM_SIZE, sent|child1|defwinproc },
+ { WM_SIZE, sent|child1|defwinproc|optional },
+ { 0 }
+};
+
+/* This differs from the above message list only in the child window that is
+ * expected to receive the child messages. No message is sent to the old child.
+ * Also child 2 is hidden while child 1 is visible. The pager does not make the
+ * hidden child visible. */
+static const struct message switch_child_seq[] = {
+ { PGM_SETCHILD, sent },
+ { WM_WINDOWPOSCHANGING, sent },
+ { WM_NCCALCSIZE, sent|wparam, TRUE },
+ { WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE },
+ { WM_WINDOWPOSCHANGED, sent },
+ { WM_WINDOWPOSCHANGING, sent|child2 },
+ { WM_NCCALCSIZE, sent|wparam|child2, TRUE },
+ { WM_CHILDACTIVATE, sent|child2 },
+ { WM_WINDOWPOSCHANGED, sent|child2 },
+ { WM_SIZE, sent|child2|defwinproc },
{ 0 }
};
@@ -194,6 +212,8 @@ static LRESULT WINAPI child_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
msg.flags = sent | wparam | lparam;
if (hwnd == child1_wnd)
msg.flags |= child1;
+ else
+ msg.flags |= child2;
if (defwndproc_counter)
msg.flags |= defwinproc;
msg.wParam = wParam;
@@ -241,6 +261,8 @@ static void test_pager(void)
child1_wnd = CreateWindowA( "Pager test child class", "button", WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 300, 300,
pager, 0, GetModuleHandleA(0), 0 );
+ child2_wnd = CreateWindowA("Pager test child class", "button", WS_CHILD | WS_BORDER, 0, 0, 300, 300,
+ pager, 0, GetModuleHandleA(0), 0);
flush_sequences( sequences, NUM_MSG_SEQUENCES );
SendMessageA( pager, PGM_SETCHILD, 0, (LPARAM)child1_wnd );
@@ -249,6 +271,21 @@ static void test_pager(void)
ok( rect.right - rect.left == 100 && rect.bottom - rect.top == 100,
"pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top );
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ SendMessageA(pager, PGM_SETCHILD, 0, (LPARAM)child2_wnd);
+ ok_sequence(sequences, PAGER_SEQ_INDEX, switch_child_seq, "switch to invisible child", TRUE);
+ GetWindowRect(pager, &rect);
+ ok(rect.right - rect.left == 100 && rect.bottom - rect.top == 100,
+ "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top);
+ todo_wine ok(!IsWindowVisible(child2_wnd), "Child window 2 is visible\n");
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ SendMessageA(pager, PGM_SETCHILD, 0, (LPARAM)child1_wnd);
+ ok_sequence(sequences, PAGER_SEQ_INDEX, set_child_seq, "switch to visible child", TRUE);
+ GetWindowRect(pager, &rect);
+ ok(rect.right - rect.left == 100 && rect.bottom - rect.top == 100,
+ "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top);
+
flush_sequences( sequences, NUM_MSG_SEQUENCES );
SendMessageA( pager, PGM_SETPOS, 0, 10 );
ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_seq, "set pos", TRUE);
--
2.10.2
More information about the wine-patches
mailing list