riched32/tests: Test WM_GETTEXTLENGTH with multibyte character.

Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2015-12-22 23:14:39 +08:00 committed by Alexandre Julliard
parent bb5974987e
commit 439e9c6a31
1 changed files with 21 additions and 10 deletions

View File

@ -130,22 +130,33 @@ static void test_WM_SETTEXT(void)
static void test_WM_GETTEXTLENGTH(void) static void test_WM_GETTEXTLENGTH(void)
{ {
HWND hwndRichEdit = new_richedit(NULL); HWND hwndRichEdit = new_richedit(NULL);
static const char text3[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee"; static const char text1[] = "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 text2[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee\r\n";
static const char text3[] = "abcdef\x8e\xf0";
int result; int result;
/* Test for WM_GETTEXTLENGTH */ /* 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); result = SendMessageA(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == lstrlenA(text3), ok(result == lstrlenA(text1),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n", "WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, lstrlenA(text3)); result, lstrlenA(text1));
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text4); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text2);
result = SendMessageA(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0); result = SendMessageA(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == lstrlenA(text4), ok(result == lstrlenA(text2),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n", "WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, lstrlenA(text4)); 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); DestroyWindow(hwndRichEdit);
} }