From: Francois Gouget fgouget@codeweavers.com
--- dlls/riched20/tests/editor.c | 4 ++-- dlls/riched20/tests/richole.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 7c959680e84..e7e79db1805 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -5094,7 +5094,7 @@ static void test_EM_EXSETSEL(void) cr.cpMin = 4; cr.cpMax = 8; result = SendMessageA(hwndRichEdit, EM_EXSETSEL, 0, (LPARAM)&cr); ok(result == 8, "EM_EXSETSEL return %Id expected 8\n", result); - result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, sizeof(bufA), (LPARAM)bufA); + result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)bufA); ok(!strcmp(bufA, "ef\x8e\xf0g"), "EM_GETSELTEXT return incorrect string\n"); SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr); ok(cr.cpMin == 4, "Selection start incorrectly: %ld expected 4\n", cr.cpMin); @@ -5169,7 +5169,7 @@ static void test_EM_SETSEL(void) /* 012345 6 78901 */ result = SendMessageA(hwndRichEdit, EM_SETSEL, 4, 8); ok(result == 8, "EM_SETSEL return %Id expected 8\n", result); - result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, sizeof(buffA), (LPARAM)buffA); + result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)buffA); ok(!strcmp(buffA, "ef\x8e\xf0g"), "EM_GETSELTEXT return incorrect string\n"); result = SendMessageA(hwndRichEdit, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end); ok(sel_start == 4, "Selection start incorrectly: %d expected 4\n", sel_start); diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index 1c19d36dc0d..7ec6036fea6 100644 --- a/dlls/riched20/tests/richole.c +++ b/dlls/riched20/tests/richole.c @@ -4068,7 +4068,7 @@ static void subtest_InsertObject(struct reolecb_obj *callback) expected_stringA = "abc d efg"; memset(bufferA, 0, sizeof(bufferA)); SendMessageA(hwnd, EM_SETSEL, 0, -1); - result = SendMessageA(hwnd, EM_GETSELTEXT, (WPARAM)sizeof(bufferA), (LPARAM)bufferA); + 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);
@@ -4151,7 +4151,7 @@ static void subtest_InsertObject(struct reolecb_obj *callback) expected_stringA = "abc d efg"; memset(bufferA, 0, sizeof(bufferA)); SendMessageA(hwnd, EM_SETSEL, 0, -1); - result = SendMessageA(hwnd, EM_GETSELTEXT, (WPARAM)sizeof(bufferA), (LPARAM)bufferA); + 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);
From: Francois Gouget fgouget@codeweavers.com
On Windows EM_GETSELTEXT fails to convert strings containing \xfffb to ANSI 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=54565 --- dlls/riched20/tests/richole.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index 7ec6036fea6..03873920cdd 100644 --- a/dlls/riched20/tests/richole.c +++ b/dlls/riched20/tests/richole.c @@ -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,20 @@ static void subtest_InsertObject(struct reolecb_obj *callback) ok( !!sendres, "EM_SETOLECALLBACK should succeed\n" ); }
+ *bufferA = '\0'; + string = L"a\xfffb"; + SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)string); + SendMessageA(hwnd, EM_SETSEL, 0, -1); + 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(\xfffb) failed: gle=%lu\n", gle); + bad_getsel = (gle != 0xdeadbeef); + if (bad_getsel) + trace("EM_GETSELTEXT(%s) is broken\n", wine_dbgstr_w(string)); + SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
hr = IRichEditOle_InsertObject(reole, NULL); @@ -4068,9 +4084,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 +4171,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;