Destroying the editor window should render all the formats so they are still available after.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- Iirc there's a CoUninitialize() that gets called too early so that the riched20 content is lost before it had a chance to be rendered. --- dlls/riched20/tests/editor.c | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index ab74e0ef1ab..8b193eed6e5 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -4743,6 +4743,36 @@ static DWORD CALLBACK test_EM_GETMODIFY_esCallback(DWORD_PTR dwCookie, return 0; }
+#define open_clipboard(hwnd) open_clipboard_(__LINE__, hwnd) +static BOOL open_clipboard_(int line, HWND hwnd) +{ + DWORD start = GetTickCount(); + while (1) + { + BOOL ret = OpenClipboard(hwnd); + if (ret || GetLastError() != ERROR_ACCESS_DENIED) + return ret; + if (GetTickCount() - start > 100) + { + char classname[256]; + DWORD le = GetLastError(); + HWND clipwnd = GetOpenClipboardWindow(); + /* Provide a hint as to the source of interference: + * - The class name would typically be CLIPBRDWNDCLASS if the + * clipboard was opened by a Windows application using the + * ole32 API. + * - And it would be __wine_clipboard_manager if it was opened in + * response to a native application. + */ + GetClassNameA(clipwnd, classname, ARRAY_SIZE(classname)); + trace_(__FILE__, line)("%p (%s) opened the clipboard\n", clipwnd, classname); + SetLastError(le); + return ret; + } + Sleep(15); + } +} + static void test_EM_GETMODIFY(void) { HWND hwndRichEdit = new_richedit(NULL); @@ -4759,6 +4789,8 @@ static void test_EM_GETMODIFY(void) CHARFORMAT2A cf2; PARAFORMAT2 pf2; EDITSTREAM es; + BOOL r; + HANDLE hclip;
HFONT testFont = CreateFontA (0,0,0,0,FW_LIGHT, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | @@ -4905,7 +4937,28 @@ static void test_EM_GETMODIFY(void) ok (result != 0, "EM_GETMODIFY returned zero, instead of non-zero for EM_STREAM\n");
+ /* Check that the clipboard data is still available after destroying the + * editor window. + */ + SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"Stayin' alive"); + SendMessageA(hwndRichEdit, EM_SETSEL, 8, -1); + SendMessageA(hwndRichEdit, WM_COPY, 0, 0); + DestroyWindow(hwndRichEdit); + + r = open_clipboard(NULL); + ok(r, "OpenClipboard failed le=%u\n", GetLastError()); + + hclip = GetClipboardData(CF_TEXT); + todo_wine ok(hclip != NULL, "GetClipboardData() failed le=%u\n", GetLastError()); + if (hclip) + { + const char* str = GlobalLock(hclip); + ok(strcmp(str, "alive") == 0, "unexpected clipboard content: %s\n", str); + GlobalUnlock(hclip); + } + + CloseClipboard(); }
struct exsetsel_s {
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=97295
Your paranoid android.
=== w8 (32 bit report) ===
riched20: editor.c:6863: Test failed: cursor position set test 12: Expected hwnd 000601A2 got 23232323 editor.c:6865: Test failed: cursor position set test 12: Expected idFrom 0 got 0x23232323 editor.c:6867: Test failed: cursor position set test 12: Expected msg 0x20 got 0x23232323 editor.c:6871: Test failed: cursor position set test 12: Expected wParam 0 got 0x23232323 editor.c:6879: Test failed: cursor position set test 12: Expected lParam 0x50005 got 0x23232323 editor.c:6882: Test failed: cursor position set test 12: Expected link range [0,31) got [589505315,589505315) editor.c:6863: Test failed: cursor position set test 13: Expected hwnd 000601A2 got 23232323 editor.c:6865: Test failed: cursor position set test 13: Expected idFrom 0 got 0x23232323 editor.c:6867: Test failed: cursor position set test 13: Expected msg 0x20 got 0x23232323 editor.c:6871: Test failed: cursor position set test 13: Expected wParam 0 got 0x23232323 editor.c:6879: Test failed: cursor position set test 13: Expected lParam 0x50005 got 0x23232323 editor.c:6882: Test failed: cursor position set test 13: Expected link range [0,31) got [589505315,589505315) editor.c:6863: Test failed: cursor position set test 28: Expected hwnd 000601A2 got 23232323 editor.c:6865: Test failed: cursor position set test 28: Expected idFrom 0 got 0x23232323 editor.c:6867: Test failed: cursor position set test 28: Expected msg 0x20 got 0x23232323 editor.c:6871: Test failed: cursor position set test 28: Expected wParam 0 got 0x23232323 editor.c:6879: Test failed: cursor position set test 28: Expected lParam 0x50005 got 0x23232323 editor.c:6882: Test failed: cursor position set test 28: Expected link range [0,31) got [589505315,589505315) editor.c:6863: Test failed: cursor position set test 29: Expected hwnd 000601A2 got 23232323 editor.c:6865: Test failed: cursor position set test 29: Expected idFrom 0 got 0x23232323 editor.c:6867: Test failed: cursor position set test 29: Expected msg 0x20 got 0x23232323 editor.c:6871: Test failed: cursor position set test 29: Expected wParam 0 got 0x23232323 editor.c:6879: Test failed: cursor position set test 29: Expected lParam 0x50005 got 0x23232323 editor.c:6882: Test failed: cursor position set test 29: Expected link range [0,31) got [589505315,589505315) editor.c:6863: Test failed: cursor position set test 44: Expected hwnd 000601A2 got 23232323 editor.c:6865: Test failed: cursor position set test 44: Expected idFrom 0 got 0x23232323 editor.c:6867: Test failed: cursor position set test 44: Expected msg 0x20 got 0x23232323 editor.c:6871: Test failed: cursor position set test 44: Expected wParam 0 got 0x23232323 editor.c:6879: Test failed: cursor position set test 44: Expected lParam 0x50005 got 0x23232323 editor.c:6882: Test failed: cursor position set test 44: Expected link range [0,31) got [589505315,589505315) editor.c:6863: Test failed: cursor position set test 45: Expected hwnd 000601A2 got 23232323 editor.c:6865: Test failed: cursor position set test 45: Expected idFrom 0 got 0x23232323 editor.c:6867: Test failed: cursor position set test 45: Expected msg 0x20 got 0x23232323 editor.c:6871: Test failed: cursor position set test 45: Expected wParam 0 got 0x23232323 editor.c:6879: Test failed: cursor position set test 45: Expected lParam 0x50005 got 0x23232323 editor.c:6882: Test failed: cursor position set test 45: Expected link range [0,31) got [589505315,589505315)