riched20/tests: Fix the EM_GETSELTEXT tests in Hindi on Windows.
On Windows EM_GETSELTEXT fails with an invalid parameter error in the Hindi locale but works in most other locales, including UTF-8 ones. So check for this issue and adjust the expected results accordingly. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54559 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54565
This commit is contained in:
parent
baa4197064
commit
37cd13abdf
2 changed files with 52 additions and 8 deletions
|
@ -1891,20 +1891,41 @@ static void test_EM_GETSELTEXT(void)
|
|||
const char * expect = "bar\rfoo";
|
||||
char buffer[1024] = {0};
|
||||
LRESULT result;
|
||||
BOOL bad_getsel;
|
||||
DWORD gle;
|
||||
|
||||
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"a");
|
||||
SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1);
|
||||
SetLastError(0xdeadbeef);
|
||||
result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)buffer);
|
||||
gle = GetLastError();
|
||||
ok((result > 0 && gle == 0xdeadbeef) ||
|
||||
broken(result == 0 && gle == ERROR_INVALID_PARAMETER /* Hindi */),
|
||||
"EM_GETSELTEXT returned %Id gle=%lu\n", result, gle);
|
||||
bad_getsel = (gle != 0xdeadbeef);
|
||||
if (bad_getsel)
|
||||
trace("EM_GETSELTEXT is broken, some tests will be ignored\n");
|
||||
|
||||
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text1);
|
||||
|
||||
SendMessageA(hwndRichEdit, EM_SETSEL, 4, 11);
|
||||
SetLastError(0xdeadbeef);
|
||||
result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)buffer);
|
||||
ok(result == 7, "EM_GETSELTEXT returned %Id\n", result);
|
||||
ok(!strcmp(expect, buffer), "EM_GETSELTEXT filled %s\n", buffer);
|
||||
gle = GetLastError();
|
||||
ok(result == 7 || broken(bad_getsel && result == 0),
|
||||
"EM_GETSELTEXT returned %Id gle=%lu\n", result, gle);
|
||||
ok(!strcmp(expect, buffer) || broken(bad_getsel && !*buffer),
|
||||
"EM_GETSELTEXT filled %s gle=%lu\n", buffer, gle);
|
||||
|
||||
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text2);
|
||||
|
||||
SendMessageA(hwndRichEdit, EM_SETSEL, 4, 11);
|
||||
SetLastError(0xdeadbeef);
|
||||
result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)buffer);
|
||||
ok(result == 7, "EM_GETSELTEXT returned %Id\n", result);
|
||||
ok(!strcmp(expect, buffer), "EM_GETSELTEXT filled %s\n", buffer);
|
||||
ok(result == 7 || broken(bad_getsel && result == 0),
|
||||
"EM_GETSELTEXT returned %Id gle=%lu\n", result, gle);
|
||||
ok(!strcmp(expect, buffer) || broken(bad_getsel && !*buffer),
|
||||
"EM_GETSELTEXT filled %s gle=%lu\n", buffer, gle);
|
||||
|
||||
/* Test with multibyte character */
|
||||
if (!is_lang_japanese)
|
||||
|
|
|
@ -3881,6 +3881,8 @@ static void subtest_InsertObject(struct reolecb_obj *callback)
|
|||
struct testoleobj *testobj;
|
||||
IOleClientSite *clientsite;
|
||||
REOBJECT reobj;
|
||||
BOOL bad_getsel;
|
||||
DWORD gle;
|
||||
|
||||
create_interfaces(&hwnd, &reole, &doc, &selection);
|
||||
if (callback)
|
||||
|
@ -3889,6 +3891,19 @@ static void subtest_InsertObject(struct reolecb_obj *callback)
|
|||
ok( !!sendres, "EM_SETOLECALLBACK should succeed\n" );
|
||||
}
|
||||
|
||||
SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"a");
|
||||
SendMessageA(hwnd, EM_SETSEL, 0, -1);
|
||||
*bufferA = '\0';
|
||||
SetLastError(0xdeadbeef);
|
||||
result = SendMessageA(hwnd, EM_GETSELTEXT, 0, (LPARAM)bufferA);
|
||||
gle = GetLastError();
|
||||
ok((result > 0 && gle == 0xdeadbeef) ||
|
||||
broken(result == 0 && gle == ERROR_INVALID_PARAMETER /* Hindi */),
|
||||
"EM_GETSELTEXT returned %ld gle=%lu\n", result, gle);
|
||||
bad_getsel = (gle != 0xdeadbeef);
|
||||
if (bad_getsel)
|
||||
trace("EM_GETSELTEXT is broken, some tests will be ignored\n");
|
||||
|
||||
SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
|
||||
|
||||
hr = IRichEditOle_InsertObject(reole, NULL);
|
||||
|
@ -4068,9 +4083,13 @@ static void subtest_InsertObject(struct reolecb_obj *callback)
|
|||
expected_stringA = "abc d efg";
|
||||
memset(bufferA, 0, sizeof(bufferA));
|
||||
SendMessageA(hwnd, EM_SETSEL, 0, -1);
|
||||
SetLastError(0xdeadbeef);
|
||||
result = SendMessageA(hwnd, EM_GETSELTEXT, 0, (LPARAM)bufferA);
|
||||
ok(result == strlen(expected_stringA), "Got wrong length: %ld.\n", result);
|
||||
ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
gle = GetLastError();
|
||||
ok(result == strlen(expected_stringA) || broken(bad_getsel && result == 0),
|
||||
"Got wrong length: %ld (gle %lu)\n", result, gle);
|
||||
ok(!strcmp(bufferA, expected_stringA) || broken(bad_getsel && !*bufferA),
|
||||
"Got wrong content: %s (gle %lu)\n", bufferA, gle);
|
||||
|
||||
memset(bufferA, 0, sizeof(bufferA));
|
||||
textrange.lpstrText = bufferA;
|
||||
|
@ -4151,9 +4170,13 @@ static void subtest_InsertObject(struct reolecb_obj *callback)
|
|||
expected_stringA = "abc d efg";
|
||||
memset(bufferA, 0, sizeof(bufferA));
|
||||
SendMessageA(hwnd, EM_SETSEL, 0, -1);
|
||||
SetLastError(0xdeadbeef);
|
||||
result = SendMessageA(hwnd, EM_GETSELTEXT, 0, (LPARAM)bufferA);
|
||||
ok(result == strlen(expected_stringA), "Got wrong length: %ld.\n", result);
|
||||
ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
gle = GetLastError();
|
||||
ok(result == strlen(expected_stringA) || broken(bad_getsel && result == 0),
|
||||
"Got wrong length: %ld (gle %lu)\n", result, gle);
|
||||
ok(!strcmp(bufferA, expected_stringA) || broken(bad_getsel && !*bufferA),
|
||||
"Got wrong content: %s (gle %lu)\n", bufferA, gle);
|
||||
|
||||
memset(bufferA, 0, sizeof(bufferA));
|
||||
textrange.lpstrText = bufferA;
|
||||
|
|
Loading…
Add table
Reference in a new issue