[PATCH 1/2] edit: Test that EM_REPLACESEL works after EM_GETHANDLE.

Roman Pišl rpisl at seznam.cz
Wed Oct 26 17:41:43 CDT 2016


Signed-off-by: Roman Pišl <rpisl at seznam.cz>
---
 dlls/user32/tests/edit.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c
index b9aa1c9..9d710df 100644
--- a/dlls/user32/tests/edit.c
+++ b/dlls/user32/tests/edit.c
@@ -875,6 +875,8 @@ static void test_edit_control_3(void)
     HWND hWnd;
     HWND hParent;
     HDC hDC;
+    HLOCAL hBuf;
+    char* pBuf;
     int len, dpi;
     static const char *str = "this is a long string.";
     static const char *str2 = "this is a long string.\r\nthis is a long string.\r\nthis is a long string.\r\nthis is a long string.";
@@ -1117,6 +1119,25 @@ static void test_edit_control_3(void)
     ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
     test_notify(0, 0, 0);
 
+    /* EM_REPLACESEL should work after EM_GETHANDLE */
+    SendMessageA(hWnd, EM_SETLIMITTEXT, 0, 0);
+    SendMessageA(hWnd, EM_SETSEL, 0, -1);
+    hBuf = (HLOCAL)SendMessageA(hWnd, EM_GETHANDLE, 0, 0);
+    ok(hBuf != NULL, "should get a valid handle\n");
+    SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str);
+
+    len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
+    ok(len == lstrlenA(str), "text shouldn't have been truncated\n");
+    hBuf = (HLOCAL)SendMessageA(hWnd, EM_GETHANDLE, 0, 0);
+    ok(hBuf != NULL, "should get a valid handle\n");
+    pBuf = (char*)LocalLock(hBuf);
+    ok(pBuf != NULL, "should get a valid buffer\n");
+    if (pBuf)
+    {
+        ok(strcmp(str, pBuf) == 0, "strings don't match\n");
+        LocalUnlock(pBuf);
+    }
+
     DestroyWindow(hWnd);
 }
 
-- 
2.7.4




More information about the wine-patches mailing list