comctl32/tests: Added tests for treeview TVM_HITTEST message
Daniel Jelinski
djelinski1 at gmail.com
Mon Apr 2 15:37:41 CDT 2012
Tested on Linux with builtin and native comctl32. Not tested on Windows.
-------------- next part --------------
From 53c287d8bff71d2c781cc0e49f2ae7273ed8d196 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Mon, 2 Apr 2012 22:30:04 +0200
Subject: comctl32/tests: Added tests for treeview TVM_HITTEST message
Current Wine implementation incorrectly returns TVHT_ONITEMBUTTON on items with no children, and so with no expand button.
Native comctl returns TVHT_ONITEMINDENT here. Added a test to reflect that.
---
dlls/comctl32/tests/treeview.c | 42 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 61a3ce6..2246c79 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -1788,6 +1788,47 @@ static void test_TVM_GETNEXTITEM(void)
DestroyWindow(hTree);
}
+static void test_TVM_HITTEST(void)
+{
+ HWND hTree;
+ LRESULT ret;
+ RECT rc;
+ TVHITTESTINFO ht;
+
+ hTree = create_treeview_control(0);
+ fill_tree(hTree);
+
+ *(HTREEITEM*)&rc = hRoot;
+ ret = SendMessage(hTree, TVM_GETITEMRECT, TRUE, (LPARAM)&rc);
+ expect(TRUE, (BOOL)ret);
+
+ ht.pt.x = rc.left-1;
+ ht.pt.y = rc.top;
+
+ ret = SendMessage(hTree, TVM_HITTEST, 0, (LPARAM)&ht);
+ ok((HTREEITEM)ret == hRoot, "got %p, expected %p\n", (HTREEITEM)ret, hRoot);
+ ok(ht.hItem == hRoot, "got %p, expected %p\n", ht.hItem, hRoot);
+ ok(ht.flags == TVHT_ONITEMBUTTON, "got %d, expected %d\n", ht.flags, TVHT_ONITEMBUTTON);
+
+ ret = SendMessageA(hTree, TVM_EXPAND, TVE_EXPAND, (LPARAM)hRoot);
+ expect(TRUE, (BOOL)ret);
+
+ *(HTREEITEM*)&rc = hChild;
+ ret = SendMessage(hTree, TVM_GETITEMRECT, TRUE, (LPARAM)&rc);
+ expect(TRUE, (BOOL)ret);
+
+ ht.pt.x = rc.left-1;
+ ht.pt.y = rc.top;
+
+ ret = SendMessage(hTree, TVM_HITTEST, 0, (LPARAM)&ht);
+ ok((HTREEITEM)ret == hChild, "got %p, expected %p\n", (HTREEITEM)ret, hChild);
+ ok(ht.hItem == hChild, "got %p, expected %p\n", ht.hItem, hChild);
+ /* Wine returns item button here, but this item has no button */
+ todo_wine ok(ht.flags == TVHT_ONITEMINDENT, "got %d, expected %d\n", ht.flags, TVHT_ONITEMINDENT);
+
+ DestroyWindow(hTree);
+}
+
START_TEST(treeview)
{
HMODULE hComctl32;
@@ -1859,6 +1900,7 @@ START_TEST(treeview)
test_htreeitem_layout();
test_TVS_CHECKBOXES();
test_TVM_GETNEXTITEM();
+ test_TVM_HITTEST();
if (!load_v6_module(&ctx_cookie, &hCtx))
{
--
1.7.5.4
More information about the wine-patches
mailing list