Signed-off-by: Francois Gouget fgouget@codeweavers.com --- dlls/user32/tests/clipboard.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index 6fc4325e985..1254b81d0c0 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -381,7 +381,7 @@ static void test_RegisterClipboardFormatA(void) format_id2 = RegisterClipboardFormatA("MY_COOL_CLIPBOARD_FORMAT"); ok(format_id2 == format_id, "invalid clipboard format id %04x\n", format_id2);
- len = GetClipboardFormatNameA(format_id, buf, 256); + len = GetClipboardFormatNameA(format_id, buf, ARRAY_SIZE(buf)); ok(len == lstrlenA("my_cool_clipboard_format"), "wrong format name length %d\n", len); ok(!lstrcmpA(buf, "my_cool_clipboard_format"), "wrong format name "%s"\n", buf);
@@ -390,7 +390,7 @@ static void test_RegisterClipboardFormatA(void)
lstrcpyA(buf, "foo"); SetLastError(0xdeadbeef); - len = GetAtomNameA((ATOM)format_id, buf, 256); + len = GetAtomNameA((ATOM)format_id, buf, ARRAY_SIZE(buf)); ok(len == 0, "GetAtomNameA should fail\n"); ok(GetLastError() == ERROR_INVALID_HANDLE, "err %d\n", GetLastError());
@@ -398,7 +398,7 @@ todo_wine { lstrcpyA(buf, "foo"); SetLastError(0xdeadbeef); - len = GlobalGetAtomNameA((ATOM)format_id, buf, 256); + len = GlobalGetAtomNameA((ATOM)format_id, buf, ARRAY_SIZE(buf)); ok(len == 0, "GlobalGetAtomNameA should fail\n"); ok(GetLastError() == ERROR_INVALID_HANDLE, "err %d\n", GetLastError()); } @@ -420,7 +420,7 @@ todo_wine for (format_id = 0; format_id < 0x10fff; format_id++) { SetLastError(0xdeadbeef); - len = GetClipboardFormatNameA(format_id, buf, 256); + len = GetClipboardFormatNameA(format_id, buf, ARRAY_SIZE(buf));
if (format_id < 0xc000 || format_id > 0xffff) ok(!len, "GetClipboardFormatNameA should fail, but it returned %d (%s)\n", len, buf); @@ -456,7 +456,7 @@ todo_wine while ((format_id = EnumClipboardFormats(format_id))) { ok(IsClipboardFormatAvailable(format_id), "format %04x was listed as available\n", format_id); - len = GetClipboardFormatNameA(format_id, buf, 256); + len = GetClipboardFormatNameA(format_id, buf, ARRAY_SIZE(buf)); trace("%04x: %s\n", format_id, len ? buf : ""); }
@@ -1920,12 +1920,12 @@ static void test_GetUpdatedClipboardFormats(void) ok( !count, "wrong count %u\n", count );
SetLastError( 0xdeadbeef ); - r = pGetUpdatedClipboardFormats( formats, 256, NULL ); + r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), NULL ); ok( !r, "succeeded\n" ); ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
count = 0xdeadbeef; - r = pGetUpdatedClipboardFormats( formats, 256, &count ); + r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count ); ok( r, "gle %d\n", GetLastError() ); ok( !count, "wrong count %u\n", count );
@@ -1935,7 +1935,7 @@ static void test_GetUpdatedClipboardFormats(void) ok( r, "gle %d\n", GetLastError() );
count = 0xdeadbeef; - r = pGetUpdatedClipboardFormats( formats, 256, &count ); + r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count ); ok( r, "gle %d\n", GetLastError() ); ok( !count, "wrong count %u\n", count );
@@ -1943,7 +1943,7 @@ static void test_GetUpdatedClipboardFormats(void)
count = 0xdeadbeef; memset( formats, 0xcc, sizeof(formats) ); - r = pGetUpdatedClipboardFormats( formats, 256, &count ); + r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count ); ok( r, "gle %d\n", GetLastError() ); ok( count == 1, "wrong count %u\n", count ); ok( formats[0] == CF_UNICODETEXT, "wrong format %u\n", formats[0] ); @@ -1952,7 +1952,7 @@ static void test_GetUpdatedClipboardFormats(void) SetClipboardData( CF_TEXT, 0 ); count = 0xdeadbeef; memset( formats, 0xcc, sizeof(formats) ); - r = pGetUpdatedClipboardFormats( formats, 256, &count ); + r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count ); ok( r, "gle %d\n", GetLastError() ); ok( count == 2, "wrong count %u\n", count ); ok( formats[0] == CF_UNICODETEXT, "wrong format %u\n", formats[0] ); @@ -1978,7 +1978,7 @@ static void test_GetUpdatedClipboardFormats(void)
count = 0xdeadbeef; memset( formats, 0xcc, sizeof(formats) ); - r = pGetUpdatedClipboardFormats( formats, 256, &count ); + r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count ); ok( r, "gle %d\n", GetLastError() ); ok( count == 4, "wrong count %u\n", count ); ok( formats[0] == CF_UNICODETEXT, "wrong format %u\n", formats[0] ); @@ -2097,7 +2097,7 @@ static void test_string_data_process( int i ) data = GetClipboardData( CF_UNICODETEXT ); ok( data != 0, "%u: could not get data\n", i ); len = GlobalSize( data ); - len2 = MultiByteToWideChar( CP_ACP, 0, bufferA, test_data[i].len, bufferW, 12 ); + len2 = MultiByteToWideChar( CP_ACP, 0, bufferA, test_data[i].len, bufferW, ARRAY_SIZE(bufferW) ); ok( len == len2 * sizeof(WCHAR), "%u: wrong size %u / %u\n", i, len, len2 ); ok( !memcmp( data, bufferW, len ), "%u: wrong data %s\n", i, wine_dbgstr_wn( data, len2 )); } @@ -2117,7 +2117,7 @@ static void test_string_data_process( int i ) ok( data != 0, "%u: could not get data\n", i ); len = GlobalSize( data ); len2 = WideCharToMultiByte( CP_ACP, 0, bufferW, test_data[i].len / sizeof(WCHAR), - bufferA, 12, NULL, NULL ); + bufferA, ARRAY_SIZE(bufferA), NULL, NULL ); bufferA[len2 - 1] = 0; ok( len == len2, "%u: wrong size %u / %u\n", i, len, len2 ); ok( !memcmp( data, bufferA, len ), "%u: wrong data %.*s\n", i, len, (char *)data );
One cannot assume that a random integer has zero chance of being a valid atom. Reenable the GlobalFindAtomA() check in a todo_wine.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- dlls/user32/tests/clipboard.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index 1254b81d0c0..7462ebac382 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -391,29 +391,33 @@ static void test_RegisterClipboardFormatA(void) lstrcpyA(buf, "foo"); SetLastError(0xdeadbeef); len = GetAtomNameA((ATOM)format_id, buf, ARRAY_SIZE(buf)); - ok(len == 0, "GetAtomNameA should fail\n"); - ok(GetLastError() == ERROR_INVALID_HANDLE, "err %d\n", GetLastError()); + ok(len == 0 || lstrcmpA(buf, "my_cool_clipboard_format") != 0, + "format_id should not be a valid local atom\n"); + ok(len != 0 || GetLastError() == ERROR_INVALID_HANDLE, + "err %d\n", GetLastError());
todo_wine { lstrcpyA(buf, "foo"); SetLastError(0xdeadbeef); len = GlobalGetAtomNameA((ATOM)format_id, buf, ARRAY_SIZE(buf)); - ok(len == 0, "GlobalGetAtomNameA should fail\n"); - ok(GetLastError() == ERROR_INVALID_HANDLE, "err %d\n", GetLastError()); + ok(len == 0 || lstrcmpA(buf, "my_cool_clipboard_format") != 0, + "format_id should not be a valid global atom\n"); + ok(len != 0 || GetLastError() == ERROR_INVALID_HANDLE, + "err %d\n", GetLastError()); }
SetLastError(0xdeadbeef); atom_id = FindAtomA("my_cool_clipboard_format"); - ok(atom_id == 0, "FindAtomA should fail\n"); + ok(atom_id == 0, "FindAtomA should fail, but it returned %x (format_id=%x)\n", atom_id, format_id); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "err %d\n", GetLastError());
- if (0) + todo_wine { /* this relies on the clipboard and global atom table being different */ SetLastError(0xdeadbeef); atom_id = GlobalFindAtomA("my_cool_clipboard_format"); - ok(atom_id == 0, "GlobalFindAtomA should fail\n"); + ok(atom_id == 0, "GlobalFindAtomA should fail, but it returned %x (format_id=%x)\n", atom_id, format_id); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "err %d\n", GetLastError()); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=90942
Your paranoid android.
=== w10pro64_ar (64 bit report) ===
user32: clipboard.c:785: Test failed: 0: CF_LOCALE 00000c01/00000409 clipboard.c:785: Test failed: 1: CF_LOCALE 00000c01/00000409 clipboard.c:785: Test failed: 2: CF_LOCALE 00000c01/00000409
=== w10pro64_he (64 bit report) ===
user32: clipboard.c:785: Test failed: 0: CF_LOCALE 0000040d/00000409 clipboard.c:785: Test failed: 1: CF_LOCALE 0000040d/00000409 clipboard.c:785: Test failed: 2: CF_LOCALE 0000040d/00000409
=== debiant2 (32 bit report) ===
user32: clipboard.c:406: Test succeeded inside todo block: err -559038737
=== debiant2 (32 bit French report) ===
user32: clipboard.c:406: Test succeeded inside todo block: err -559038737
=== debiant2 (32 bit Japanese:Japan report) ===
user32: clipboard.c:406: Test succeeded inside todo block: err -559038737
=== debiant2 (32 bit Chinese:China report) ===
user32: clipboard.c:406: Test succeeded inside todo block: err -559038737
=== debiant2 (32 bit WoW report) ===
user32: clipboard.c:406: Test succeeded inside todo block: err -559038737
=== debiant2 (64 bit WoW report) ===
user32: clipboard.c:406: Test succeeded inside todo block: err -559038737
On Thu, 20 May 2021, Francois Gouget wrote: [...]
todo_wine { lstrcpyA(buf, "foo"); SetLastError(0xdeadbeef); len = GlobalGetAtomNameA((ATOM)format_id, buf, ARRAY_SIZE(buf));
- ok(len == 0, "GlobalGetAtomNameA should fail\n");
- ok(GetLastError() == ERROR_INVALID_HANDLE, "err %d\n", GetLastError());
- ok(len == 0 || lstrcmpA(buf, "my_cool_clipboard_format") != 0,
"format_id should not be a valid global atom\n");
- ok(len != 0 || GetLastError() == ERROR_INVALID_HANDLE,
"err %d\n", GetLastError());
This last check does not work right with todo_wine(). Part 1 is independent and can go in. I'll resubmit part 2 later on.
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=90941
Your paranoid android.
=== w1064 (32 bit report) ===
user32: clipboard.c:402: Test failed: GlobalGetAtomNameA should fail clipboard.c:403: Test failed: err -559038737
=== w1064 (64 bit report) ===
user32: clipboard.c:402: Test failed: GlobalGetAtomNameA should fail clipboard.c:403: Test failed: err -559038737
=== w10pro64 (64 bit report) ===
user32: clipboard.c:1770: Test failed: gle 5 clipboard.c:1775: Test failed: gle 1418
=== w10pro64_ar (64 bit report) ===
user32: clipboard.c:781: Test failed: 0: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 1: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 2: CF_LOCALE 00000c01/00000409
=== w10pro64_he (64 bit report) ===
user32: clipboard.c:781: Test failed: 0: CF_LOCALE 0000040d/00000409 clipboard.c:781: Test failed: 1: CF_LOCALE 0000040d/00000409 clipboard.c:781: Test failed: 2: CF_LOCALE 0000040d/00000409
On Thu, 20 May 2021, Marvin wrote: [...]
=== w1064 (32 bit report) ===
user32: clipboard.c:402: Test failed: GlobalGetAtomNameA should fail clipboard.c:403: Test failed: err -559038737
This preexisting failure is fixed in part 2 which I'll have to resend.
=== w10pro64 (64 bit report) ===
user32: clipboard.c:1770: Test failed: gle 5 clipboard.c:1775: Test failed: gle 1418
This is the bane of the clipboard tests. It happens all the time on the cw-rx460 machine and from time to time on others. https://www.winehq.org/pipermail/wine-devel/2021-May/187234.html
=== w10pro64_ar (64 bit report) ===
user32: clipboard.c:781: Test failed: 0: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 1: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 2: CF_LOCALE 00000c01/00000409
I fixed this failure in another patch series. https://www.winehq.org/pipermail/wine-devel/2021-May/187222.html