Jactry Zeng : riched32/tests: Test WM_GETTEXTLENGTH with multibyte character.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Dec 23 18:22:07 CST 2015


Module: wine
Branch: master
Commit: 439e9c6a31422fa3c4d336d5f7d6c1e54d890b20
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=439e9c6a31422fa3c4d336d5f7d6c1e54d890b20

Author: Jactry Zeng <jzeng at codeweavers.com>
Date:   Tue Dec 22 23:14:39 2015 +0800

riched32/tests: Test WM_GETTEXTLENGTH with multibyte character.

Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched32/tests/editor.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c
index 62c0d00..c299348 100644
--- a/dlls/riched32/tests/editor.c
+++ b/dlls/riched32/tests/editor.c
@@ -130,22 +130,33 @@ static void test_WM_SETTEXT(void)
 static void test_WM_GETTEXTLENGTH(void)
 {
     HWND hwndRichEdit = new_richedit(NULL);
-    static const char text3[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee";
-    static const char text4[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee\r\n";
+    static const char text1[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee";
+    static const char text2[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee\r\n";
+    static const char text3[] = "abcdef\x8e\xf0";
     int result;
 
     /* Test for WM_GETTEXTLENGTH */
-    SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text3);
+    SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text1);
     result = SendMessageA(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
-    ok(result == lstrlenA(text3),
-        "WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
-        result, lstrlenA(text3));
+    ok(result == lstrlenA(text1),
+       "WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
+       result, lstrlenA(text1));
 
-    SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text4);
+    SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text2);
     result = SendMessageA(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
-    ok(result == lstrlenA(text4),
-        "WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
-        result, lstrlenA(text4));
+    ok(result == lstrlenA(text2),
+       "WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
+       result, lstrlenA(text2));
+
+    /* Test with multibyte character */
+    if (!is_lang_japanese)
+        skip("Skip multibyte character tests on non-Japanese platform\n");
+    else
+    {
+        SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text3);
+        result = SendMessageA(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
+        ok(result == 8, "WM_GETTEXTLENGTH returned %d, expected 8\n", result);
+    }
 
     DestroyWindow(hwndRichEdit);
 }




More information about the wine-cvs mailing list