Francois Gouget : user32/tests: Fix the clipboard format id vs. atom table checks.
Alexandre Julliard
julliard at winehq.org
Fri May 21 14:19:44 CDT 2021
Module: wine
Branch: master
Commit: cf85253a9c3db2816b3ae1fc2c7c18fc005ffbd6
URL: https://source.winehq.org/git/wine.git/?a=commit;h=cf85253a9c3db2816b3ae1fc2c7c18fc005ffbd6
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Fri May 21 00:10:22 2021 +0200
user32/tests: Fix the clipboard format id vs. atom table checks.
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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/clipboard.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c
index 2fceab6c0f6..d75e8fc3c32 100644
--- a/dlls/user32/tests/clipboard.c
+++ b/dlls/user32/tests/clipboard.c
@@ -391,29 +391,30 @@ 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());
-}
+ todo_wine 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());
}
More information about the wine-cvs
mailing list