Commit 99f0f6b9 authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

riched20/tests: Test EM_LINELENGTH with multibyte character.

parent d9ead0c8
...@@ -46,6 +46,7 @@ static CHAR string1[MAX_PATH], string2[MAX_PATH], string3[MAX_PATH]; ...@@ -46,6 +46,7 @@ static CHAR string1[MAX_PATH], string2[MAX_PATH], string3[MAX_PATH];
format, string1, string2, string3); format, string1, string2, string3);
static HMODULE hmoduleRichEdit; static HMODULE hmoduleRichEdit;
static BOOL is_lang_japanese;
static HWND new_window(LPCSTR lpClassName, DWORD dwStyle, HWND parent) { static HWND new_window(LPCSTR lpClassName, DWORD dwStyle, HWND parent) {
HWND hwnd; HWND hwnd;
...@@ -486,6 +487,28 @@ static void test_EM_LINELENGTH(void) ...@@ -486,6 +487,28 @@ static void test_EM_LINELENGTH(void)
offset_test[i][0], result, offset_test[i][1]); offset_test[i][0], result, offset_test[i][1]);
} }
/* Test with multibyte character */
if (!is_lang_japanese)
skip("Skip multibyte character tests on non-Japanese platform\n");
else
{
const char *text1 =
"wine\n"
"richedit\x8e\xf0\n"
"wine";
int offset_test1[3][2] = {
{0, 4}, /* Line 1: |wine\n */
{5, 9}, /* Line 2: |richedit\x8e\xf0\n */
{15, 4}, /* Line 3: |wine */
};
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text1);
for (i = 0; i < sizeof(offset_test1)/sizeof(offset_test1[0]); i++) {
result = SendMessageA(hwndRichEdit, EM_LINELENGTH, offset_test1[i][0], 0);
ok(result == offset_test1[i][1], "Length of line at offset %d is %ld, expected %d\n",
offset_test1[i][0], result, offset_test1[i][1]);
}
}
DestroyWindow(hwndRichEdit); DestroyWindow(hwndRichEdit);
} }
...@@ -4009,7 +4032,7 @@ static void test_EM_SETTEXTEX(void) ...@@ -4009,7 +4032,7 @@ static void test_EM_SETTEXTEX(void)
ok(result == 0, "EM_SETTEXTEX: Test UTF8 with BOM set wrong text: Result: %s\n", bufACP); ok(result == 0, "EM_SETTEXTEX: Test UTF8 with BOM set wrong text: Result: %s\n", bufACP);
/* Test multibyte character */ /* Test multibyte character */
if (PRIMARYLANGID(GetUserDefaultLangID()) != LANG_JAPANESE) if (!is_lang_japanese)
skip("Skip multibyte character tests on non-Japanese platform\n"); skip("Skip multibyte character tests on non-Japanese platform\n");
else else
{ {
...@@ -4882,7 +4905,7 @@ static void test_EM_REPLACESEL(int redraw) ...@@ -4882,7 +4905,7 @@ static void test_EM_REPLACESEL(int redraw)
ok(r == 7, "EM_GETLINECOUNT returned %d, expected 7\n", r); ok(r == 7, "EM_GETLINECOUNT returned %d, expected 7\n", r);
/* Test with multibyte character */ /* Test with multibyte character */
if (PRIMARYLANGID(GetUserDefaultLangID()) != LANG_JAPANESE) if (!is_lang_japanese)
skip("Skip multibyte character tests on non-Japanese platform\n"); skip("Skip multibyte character tests on non-Japanese platform\n");
else else
{ {
...@@ -8160,6 +8183,7 @@ START_TEST( editor ) ...@@ -8160,6 +8183,7 @@ START_TEST( editor )
* RICHED20.DLL, so the linker doesn't actually link to it. */ * RICHED20.DLL, so the linker doesn't actually link to it. */
hmoduleRichEdit = LoadLibraryA("riched20.dll"); hmoduleRichEdit = LoadLibraryA("riched20.dll");
ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError()); ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
is_lang_japanese = (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE);
test_WM_CHAR(); test_WM_CHAR();
test_EM_FINDTEXT(FALSE); test_EM_FINDTEXT(FALSE);
......
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