[PATCH 6/6] comctl32/tests: Test WINDOWPOS structure contents.
Stefan Dösinger
stefan at codeweavers.com
Wed Apr 5 02:15:44 CDT 2017
In particular show that PGM_SETPOS changes the Z order (no SWP_NOZORDER
flag).
---
dlls/comctl32/tests/msg.h | 35 ++++++++++++++++++++++++++++
dlls/comctl32/tests/pager.c | 57 +++++++++++++++++++++++++++++++--------------
2 files changed, 74 insertions(+), 18 deletions(-)
diff --git a/dlls/comctl32/tests/msg.h b/dlls/comctl32/tests/msg.h
index 0a2140e..ca53cb1 100644
--- a/dlls/comctl32/tests/msg.h
+++ b/dlls/comctl32/tests/msg.h
@@ -43,6 +43,7 @@ typedef enum
child1 = 0x1000,
child2 = 0x2000,
todo_extra = 0x4000,
+ windowpos = 0x8000
} msg_flags_t;
struct message
@@ -54,6 +55,7 @@ struct message
UINT id; /* extra message data: id of the window,
notify code etc. */
DWORD stage; /* custom draw stage */
+ WINDOWPOS wp; /* expected WINDOWPOS structure in lparam */
};
struct msg_sequence
@@ -299,6 +301,39 @@ static void ok_sequence_(struct msg_sequence **seq, int sequence_index,
if ((expected->flags & defwinproc) != (actual->flags & defwinproc)) dump++;
}
+ if (expected->flags & windowpos)
+ {
+ int compare = memcmp(&expected->wp, &actual->wp, sizeof(expected->wp));
+ if (compare && todo)
+ {
+ todo_wine
+ {
+ failcount++;
+ dump++;
+ ok_(file, line) (FALSE,
+ "%s: in msg 0x%04x got incorrect WINDOWPOS contents "
+ "{x=%d, y=%d, cx=%d cy=%d, hwndInsertAfter=%p, flags=%#x}, expected "
+ "{x=%d, y=%d, cx=%d cy=%d, hwndInsertAfter=%p, flags=%#x}\n",
+ context, expected->message, actual->wp.x, actual->wp.y, actual->wp.cx,
+ actual->wp.cy, actual->wp.hwndInsertAfter, actual->wp.flags,
+ expected->wp.x, expected->wp.y, expected->wp.cx,
+ expected->wp.cy, expected->wp.hwndInsertAfter, expected->wp.flags);
+ }
+ }
+ else
+ {
+ ok_(file, line) (!compare,
+ "%s: in msg 0x%04x got incorrect WINDOWPOS contents "
+ "{x=%d, y=%d, cx=%d cy=%d, hwndInsertAfter=%p, flags=%#x, expected "
+ "{x=%d, y=%d, cx=%d cy=%d, hwndInsertAfter=%p, flags=%#x}\n",
+ context, expected->message, actual->wp.x, actual->wp.y, actual->wp.cx,
+ actual->wp.cy, actual->wp.hwndInsertAfter, actual->wp.flags,
+ expected->wp.x, expected->wp.y, expected->wp.cx,
+ expected->wp.cy, expected->wp.hwndInsertAfter, expected->wp.flags);
+ if (compare) dump++;
+ }
+ }
+
ok_(file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
"%s: the msg 0x%04x should %shave been sent by BeginPaint\n",
context, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
diff --git a/dlls/comctl32/tests/pager.c b/dlls/comctl32/tests/pager.c
index 4f16b11..ac939f9 100644
--- a/dlls/comctl32/tests/pager.c
+++ b/dlls/comctl32/tests/pager.c
@@ -40,7 +40,7 @@ static const struct message set_child_seq[] = {
{ WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE },
{ WM_WINDOWPOSCHANGED, sent },
{ WM_NOTIFY, sent|parent|todo_extra },
- { WM_WINDOWPOSCHANGING, sent|child1 },
+ { WM_WINDOWPOSCHANGING, sent|child1|windowpos, 0, 0, 0, 0, {NULL, HWND_TOP, 0, 0, 98, 98, 0} },
{ WM_NCCALCSIZE, sent|wparam|child1|optional, TRUE },
{ WM_CHILDACTIVATE, sent|child1 },
{ WM_WINDOWPOSCHANGED, sent|child1 },
@@ -59,7 +59,7 @@ static const struct message switch_child_seq[] = {
{ WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE },
{ WM_WINDOWPOSCHANGED, sent },
{ WM_NOTIFY, sent|parent|todo_extra },
- { WM_WINDOWPOSCHANGING, sent|child2 },
+ { WM_WINDOWPOSCHANGING, sent|child2|windowpos, 0, 0, 0, 0, {NULL, HWND_TOP, 0, 0, 98, 98, 0} },
{ WM_NCCALCSIZE, sent|wparam|child2, TRUE },
{ WM_CHILDACTIVATE, sent|child2 },
{ WM_WINDOWPOSCHANGED, sent|child2 },
@@ -67,27 +67,40 @@ static const struct message switch_child_seq[] = {
{ 0 }
};
-static const struct message set_pos_seq[] = {
+static const struct message set_pos_10_seq[] = {
{ PGM_SETPOS, sent },
{ WM_WINDOWPOSCHANGING, sent },
{ WM_NCCALCSIZE, sent|wparam, TRUE },
{ WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE },
{ WM_WINDOWPOSCHANGED, sent },
- { WM_MOVE, sent|optional },
- /* The WM_SIZE handler sends WM_WINDOWPOSCHANGING, WM_CHILDACTIVATE
+ { WM_MOVE, sent },
+ /* The pager's WM_SIZE handler sends WM_WINDOWPOSCHANGING, WM_CHILDACTIVATE
* and WM_WINDOWPOSCHANGED (which sends WM_MOVE) to the child.
- * Another WM_WINDOWPOSCHANGING is sent afterwards.
+ * Another WM_WINDOWPOSCHANGING is sent afterwards independently.
*
- * The 2nd WM_WINDOWPOSCHANGING is unconditional, but the comparison
- * function is too simple to roll back an accepted message, so we have
- * to mark the 2nd message optional. */
- { WM_SIZE, sent|optional },
- { WM_WINDOWPOSCHANGING, sent|child1 }, /* Actually optional. */
- { WM_CHILDACTIVATE, sent|child1 }, /* Actually optional. */
- { WM_WINDOWPOSCHANGED, sent|child1|optional, TRUE },
- { WM_MOVE, sent|child1|optional|defwinproc },
- { WM_WINDOWPOSCHANGING, sent|child1|optional }, /* Actually not optional. */
- { WM_CHILDACTIVATE, sent|child1|optional }, /* Actually not optional. */
+ * WM_SIZE is only triggered in the first PGM_SETPOS message, so the sequence
+ * below doesn't expect it and the messages it generates. */
+ { WM_SIZE, sent },
+ { WM_WINDOWPOSCHANGING, sent|child1|windowpos, 0, 0, 0, 0, {NULL, HWND_TOP, -10, 0, 98, 98, 0} },
+ { WM_CHILDACTIVATE, sent|child1 },
+ { WM_WINDOWPOSCHANGED, sent|child1, TRUE },
+ { WM_MOVE, sent|child1|defwinproc },
+ { WM_WINDOWPOSCHANGING, sent|child1|windowpos, 0, 0, 0, 0, {NULL, HWND_TOP, -10, 0, 98, 98, 0} },
+ { WM_CHILDACTIVATE, sent|child1 },
+ { 0 }
+};
+
+static const struct message set_pos_9_seq[] = {
+ { PGM_SETPOS, sent },
+ { WM_WINDOWPOSCHANGING, sent },
+ { WM_NCCALCSIZE, sent|wparam, TRUE },
+ { WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE },
+ { WM_WINDOWPOSCHANGED, sent },
+ { WM_MOVE, sent|optional },
+ { WM_WINDOWPOSCHANGING, sent|child1|windowpos, 0, 0, 0, 0, {NULL, HWND_TOP, -9, 0, 98, 98, 0} },
+ { WM_CHILDACTIVATE, sent|child1 },
+ { WM_WINDOWPOSCHANGED, sent|child1, TRUE },
+ { WM_MOVE, sent|child1|defwinproc },
{ 0 }
};
@@ -221,6 +234,14 @@ static LRESULT WINAPI child_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
msg.wParam = wParam;
msg.lParam = lParam;
msg.id = 0;
+
+ if (message == WM_WINDOWPOSCHANGED || message == WM_WINDOWPOSCHANGING)
+ {
+ const WINDOWPOS *wp = (WINDOWPOS *)lParam;
+ msg.wp = *wp;
+ msg.wp.hwnd = NULL;
+ }
+
add_message(sequences, PAGER_SEQ_INDEX, &msg);
defwndproc_counter++;
@@ -290,7 +311,7 @@ static void test_pager(void)
flush_sequences( sequences, NUM_MSG_SEQUENCES );
SendMessageA( pager, PGM_SETPOS, 0, 10 );
- ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_seq, "set pos", TRUE);
+ ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_10_seq, "set pos 10", 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 );
@@ -301,7 +322,7 @@ static void test_pager(void)
flush_sequences( sequences, NUM_MSG_SEQUENCES );
SendMessageA( pager, PGM_SETPOS, 0, 9 );
- ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_seq, "set pos", TRUE);
+ ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_9_seq, "set pos 9", TRUE);
DestroyWindow( pager );
--
2.10.2
More information about the wine-patches
mailing list