Module: wine Branch: master Commit: 440db38ebaa314f5a6878b59268db48b58af49ac URL: http://source.winehq.org/git/wine.git/?a=commit;h=440db38ebaa314f5a6878b5926...
Author: Dylan Smith dylan.ah.smith@gmail.com Date: Fri Oct 10 16:37:13 2008 -0400
richedit: Moved optional message loop in tests to its own function.
---
dlls/riched20/tests/editor.c | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index a34eada..cb96269 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -57,6 +57,26 @@ static HWND new_richedit(HWND parent) { return new_window(RICHEDIT_CLASS, ES_MULTILINE, parent); }
+/* Keeps the window reponsive for the deley_time in seconds. + * This is useful for debugging a test to see what is happening. */ +void keep_responsive(time_t delay_time) +{ + MSG msg; + time_t end; + + /* The message pump uses PeekMessage() to empty the queue and then + * sleeps for 50ms before retrying the queue. */ + end = time(NULL) + delay_time; + while (time(NULL) < end) { + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } else { + Sleep(50); + } + } +} + static void processPendingMessages(void) { MSG msg; @@ -5443,9 +5463,6 @@ static void test_EM_CHARFROMPOS(void)
START_TEST( editor ) { - MSG msg; - time_t end; - /* Must explicitly LoadLibrary(). The test has no references to functions in * RICHED20.DLL, so the linker doesn't actually link to it. */ hmoduleRichEdit = LoadLibrary("RICHED20.DLL"); @@ -5494,19 +5511,9 @@ START_TEST( editor )
/* Set the environment variable WINETEST_RICHED20 to keep windows * responsive and open for 30 seconds. This is useful for debugging. - * - * The message pump uses PeekMessage() to empty the queue and then sleeps for - * 50ms before retrying the queue. */ - end = time(NULL) + 30; + */ if (getenv( "WINETEST_RICHED20" )) { - while (time(NULL) < end) { - if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } else { - Sleep(50); - } - } + keep_responsive(30); }
OleFlushClipboard();