[1/2] comctl32/tests: Added tests for mouse events handling (try 5)
Daniel Jelinski
djelinski1 at gmail.com
Tue Apr 10 13:58:35 CDT 2012
Updated tests for WinNT (again)
-------------- next part --------------
From d4e974f5692082d9611c7c8b31ecdcdedbb60204 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Sat, 7 Apr 2012 19:49:50 +0200
Subject: comctl32/tests: Added tests for mouse events handling
Current Wine implementation sends incorrect WM_CONTEXTMENU message on right click. Added a test to reflect that.
---
dlls/comctl32/tests/treeview.c | 83 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 2246c79..bd6eadc 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -232,6 +232,46 @@ static const struct message parent_get_dispinfo_seq[] = {
{ 0 }
};
+static const struct message parent_rclick_seq[] = {
+ { WM_CTLCOLOREDIT, sent|optional }, /* comctl32 older than 5.80 only */
+ { WM_NOTIFY, sent|id|optional, 0, 0, NM_CUSTOMDRAW }, /* comctl32 older than 5.80 only */
+ { WM_NOTIFY, sent|id, 0, 0, NM_RCLICK },
+ { WM_CONTEXTMENU, sent|optional },
+ { 0 }
+};
+
+static const struct message tree_rclick_seq[] = {
+ { WM_RBUTTONDOWN, sent },
+ { WM_PAINT, sent|optional|defwinproc }, /* comctl32 older than 5.80 only */
+ { WM_CAPTURECHANGED, sent|defwinproc },
+ { 0 }
+};
+
+static const struct message parent_rdrag_seq[] = {
+ { WM_CTLCOLOREDIT, sent|optional }, /* comctl32 older than 5.80 only */
+ { WM_NOTIFY, sent|id|optional, 0, 0, NM_CUSTOMDRAW }, /* comctl32 older than 5.80 only */
+ { WM_NOTIFY, sent|id, 0, 0, TVN_BEGINRDRAG },
+ { 0 }
+};
+
+static const struct message tree_rdrag_seq[] = {
+ { WM_RBUTTONDOWN, sent },
+ { WM_PAINT, sent|optional|defwinproc }, /* comctl32 older than 5.80 only */
+ { WM_CAPTURECHANGED, sent|defwinproc },
+ { 0 }
+};
+
+static const struct message parent_rdrop_seq[] = {
+ { WM_CONTEXTMENU, sent },
+ { 0 }
+};
+
+static const struct message tree_rdrop_seq[] = {
+ { WM_RBUTTONUP, sent },
+ { WM_CONTEXTMENU, sent|defwinproc },
+ { 0 }
+};
+
static const struct message empty_seq[] = {
{ 0 }
};
@@ -1829,6 +1869,48 @@ static void test_TVM_HITTEST(void)
DestroyWindow(hTree);
}
+static void test_mouse(void)
+{
+ HWND hTree;
+ INT cxDrag = GetSystemMetrics(SM_CXDRAG);
+
+ hTree = create_treeview_control(0);
+ fill_tree(hTree);
+
+ /* WM_RBUTTONDOWN does not return until it gets another mouse event.
+ Make sure it gets one by posting WM_RBUTTONUP to message queue */
+ PostMessageA(hTree, WM_RBUTTONUP, 0, (LPARAM)0x10001);
+ /* this sequence should NOT send WM_CONTEXTMENU */
+ SendMessageA(hTree, WM_RBUTTONDOWN, 2, (LPARAM)0x10001);
+
+ /* ditch the first sequence as it processed more messages than we need. Redo */
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+ PostMessageA(hTree, WM_RBUTTONUP, 0, (LPARAM)0x10001);
+ SendMessageA(hTree, WM_RBUTTONDOWN, 2, (LPARAM)0x10001);
+
+ /* rclick should send NM_RCLICK and then, only if it returns 0, WM_CONTEXTMENU to parent.
+ Instead it sends WM_CONTEXTMENU to self, and then NM_RCLICK to parent */
+ ok_sequence(sequences, PARENT_SEQ_INDEX, parent_rclick_seq, "right click (parent)", TRUE);
+ ok_sequence(sequences, TREEVIEW_SEQ_INDEX, tree_rclick_seq, "right click (tree)", TRUE);
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ /* now test dragging - rbuttondown, mousemove, rbuttonup */
+ PostMessageA(hTree, WM_MOUSEMOVE, 2, (LPARAM)0x10002 + cxDrag);
+ SendMessageA(hTree, WM_RBUTTONDOWN, 2, (LPARAM)0x10001);
+
+ ok_sequence(sequences, PARENT_SEQ_INDEX, parent_rdrag_seq, "right drag (parent)", FALSE);
+ ok_sequence(sequences, TREEVIEW_SEQ_INDEX, tree_rdrag_seq, "right drag (tree)", FALSE);
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ SendMessageA(hTree, WM_RBUTTONUP, 0, (LPARAM)0x10002 + cxDrag);
+
+ ok_sequence(sequences, PARENT_SEQ_INDEX, parent_rdrop_seq, "right drop (parent)", FALSE);
+ ok_sequence(sequences, TREEVIEW_SEQ_INDEX, tree_rdrop_seq, "right drop (tree)", FALSE);
+
+ DestroyWindow(hTree);
+}
+
START_TEST(treeview)
{
HMODULE hComctl32;
@@ -1901,6 +1983,7 @@ START_TEST(treeview)
test_TVS_CHECKBOXES();
test_TVM_GETNEXTITEM();
test_TVM_HITTEST();
+ test_mouse();
if (!load_v6_module(&ctx_cookie, &hCtx))
{
--
1.7.5.4
More information about the wine-patches
mailing list