Commit 8fd0ecc6 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

comctl32: Test treeview text trimming after label editing is complete.

parent 5e2e794a
...@@ -1576,7 +1576,7 @@ static void test_itemedit(void) ...@@ -1576,7 +1576,7 @@ static void test_itemedit(void)
DWORD r; DWORD r;
HWND edit; HWND edit;
TVITEMA item; TVITEMA item;
CHAR buffA[20]; CHAR buffA[500];
HWND hTree; HWND hTree;
hTree = create_treeview_control(0); hTree = create_treeview_control(0);
...@@ -1675,8 +1675,41 @@ static void test_itemedit(void) ...@@ -1675,8 +1675,41 @@ static void test_itemedit(void)
ok(IsWindow(edit), "Expected valid handle\n"); ok(IsWindow(edit), "Expected valid handle\n");
r = SendMessageA(edit, EM_GETLIMITTEXT, 0, 0); r = SendMessageA(edit, EM_GETLIMITTEXT, 0, 0);
expect(MAX_PATH - 1, r); 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); r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r); 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); DestroyWindow(hTree);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment