[1/2] comctl32/tests: Added tests for mouse events handling
Daniel Jelinski
djelinski1 at gmail.com
Sat Apr 7 13:52:51 CDT 2012
Tested on Linux with both native and builtin comctl32.dll. Not tested
on Windows.
-------------- next part --------------
From 48316cadf3926570e9a4f17536efe8aff18e5976 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 | 77 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 2246c79..a2a20e7 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -232,6 +232,40 @@ static const struct message parent_get_dispinfo_seq[] = {
{ 0 }
};
+static const struct message parent_rclick_seq[] = {
+ { WM_NOTIFY, sent|id, 0, 0, NM_RCLICK },
+ { WM_CONTEXTMENU, sent|optional },
+ { 0 }
+};
+
+static const struct message tree_rclick_seq[] = {
+ { WM_RBUTTONDOWN, sent },
+ { WM_CAPTURECHANGED, sent|defwinproc },
+ { 0 }
+};
+
+static const struct message parent_rdrag_seq[] = {
+ { WM_NOTIFY, sent|id, 0, 0, TVN_BEGINRDRAG },
+ { 0 }
+};
+
+static const struct message tree_rdrag_seq[] = {
+ { WM_RBUTTONDOWN, sent },
+ { 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 +1863,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 +1977,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