Damjan Jovanovic : comctl32: Test treeview text trimming after label editing is complete.
Alexandre Julliard
julliard at winehq.org
Wed Nov 13 16:01:11 CST 2019
Module: wine
Branch: master
Commit: 8fd0ecc6cd0bf99803d8e8ac1a520d93b53b52f9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8fd0ecc6cd0bf99803d8e8ac1a520d93b53b52f9
Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date: Wed Nov 13 05:54:07 2019 +0200
comctl32: Test treeview text trimming after label editing is complete.
Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/tests/treeview.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 2380c5796e..34b016a236 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -1576,7 +1576,7 @@ static void test_itemedit(void)
DWORD r;
HWND edit;
TVITEMA item;
- CHAR buffA[20];
+ CHAR buffA[500];
HWND hTree;
hTree = create_treeview_control(0);
@@ -1675,8 +1675,41 @@ static void test_itemedit(void)
ok(IsWindow(edit), "Expected valid handle\n");
r = SendMessageA(edit, EM_GETLIMITTEXT, 0, 0);
expect(MAX_PATH - 1, r);
+ /* WM_SETTEXT can set more... */
+ memset(buffA, 'a', ARRAY_SIZE(buffA));
+ buffA[ARRAY_SIZE(buffA)-1] = 0;
+ r = SetWindowTextA(edit, buffA);
+ expect(TRUE, r);
+ r = GetWindowTextA(edit, buffA, ARRAY_SIZE(buffA));
+ expect(ARRAY_SIZE(buffA) - 1, r);
+ /* ...but it's trimmed to MAX_PATH chars when editing ends */
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
+ item.mask = TVIF_TEXT;
+ item.hItem = hRoot;
+ item.pszText = buffA;
+ item.cchTextMax = ARRAY_SIZE(buffA);
+ r = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+ expect(TRUE, r);
+ todo_wine expect(MAX_PATH - 1, strlen(item.pszText));
+
+ /* We can't get around that MAX_PATH limit by increasing EM_SETLIMITTEXT */
+ edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
+ ok(IsWindow(edit), "Expected valid handle\n");
+ SendMessageA(edit, EM_SETLIMITTEXT, ARRAY_SIZE(buffA)-1, 0);
+ memset(buffA, 'a', ARRAY_SIZE(buffA));
+ buffA[ARRAY_SIZE(buffA)-1] = 0;
+ r = SetWindowTextA(edit, buffA);
+ expect(TRUE, r);
+ r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
+ expect(0, r);
+ item.mask = TVIF_TEXT;
+ item.hItem = hRoot;
+ item.pszText = buffA;
+ item.cchTextMax = ARRAY_SIZE(buffA);
+ r = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+ expect(TRUE, r);
+ todo_wine expect(MAX_PATH - 1, strlen(item.pszText));
DestroyWindow(hTree);
}
More information about the wine-cvs
mailing list