Damjan Jovanovic : comctl32: Test overwriting of pszText pointer in TVN_ENDLABELEDIT.

Alexandre Julliard julliard at winehq.org
Wed Nov 13 16:01:11 CST 2019


Module: wine
Branch: master
Commit: 59bb622088b967aef7d1cdebe0ac6a2fbd5a84f3
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=59bb622088b967aef7d1cdebe0ac6a2fbd5a84f3

Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date:   Wed Nov 13 05:54:13 2019 +0200

comctl32: Test overwriting of pszText pointer in TVN_ENDLABELEDIT.

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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 19ba40c64a..82db67d5d0 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -43,6 +43,7 @@ static BOOL g_disp_A_to_W;
 static BOOL g_disp_set_stateimage;
 static BOOL g_beginedit_alter_text;
 static const char *g_endedit_overwrite_contents;
+static char *g_endedit_overwrite_ptr;
 static HFONT g_customdraw_font;
 static BOOL g_v6;
 
@@ -1329,6 +1330,8 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
                     todo_wine ok(disp->item.cchTextMax == MAX_PATH, "cchTextMax is %d\n", disp->item.cchTextMax);
                     if (g_endedit_overwrite_contents)
                         strcpy(disp->item.pszText, g_endedit_overwrite_contents);
+                    if (g_endedit_overwrite_ptr)
+                        disp->item.pszText = g_endedit_overwrite_ptr;
                 }
                 return TRUE;
               }
@@ -1739,6 +1742,23 @@ static void test_itemedit(void)
     expect(TRUE, r);
     expect(0, strcmp(item.pszText, "<new_contents>"));
 
+    /* Overwriting of pszText pointer in TVN_ENDLABELEDIT */
+    edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
+    ok(IsWindow(edit), "Expected valid handle\n");
+    r = SetWindowTextA(edit, "old");
+    expect(TRUE, r);
+    g_endedit_overwrite_ptr = (char*) "<new_ptr>";
+    r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
+    expect(0, r);
+    g_endedit_overwrite_ptr = NULL;
+    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(0, strcmp(item.pszText, "<new_ptr>"));
+
     DestroyWindow(hTree);
 }
 




More information about the wine-cvs mailing list