server: Don't clear the QS_POSTMESSAGE flag if there is a
pending quit message
Dmitry Timoshkov
dmitry at codeweavers.com
Wed May 24 01:53:24 CDT 2006
Hello,
here is an improved PostQuitMessage/queue status test. I didn't move it
to test_quit_message() test because it really belongs to the queue status
tests IMO and I didn't want to duplicate a test for not supported QS_xxxx
flags. The test shows that current behaviour with message queue status still
is not entirely correct.
This test passes on Win98 as well as on XP SP2.
Changelog:
Add a test to check the queue status if there is a pending posted
message and the quit flag is set.
--- cvs/hq/wine/dlls/user/tests/msg.c 2006-05-24 13:16:28.000000000 +0900
+++ wine/dlls/user/tests/msg.c 2006-05-24 15:22:48.000000000 +0900
@@ -6363,7 +6363,12 @@ static void test_winevents(void)
/****** start of MOUSE_LL hook test *************/
hCBT_global_hook = SetWindowsHookExA(WH_MOUSE_LL, cbt_global_hook_proc, GetModuleHandleA(0), 0);
- assert(hCBT_global_hook);
+ /* WH_MOUSE_LL is not supported on Win9x platforms */
+ if (!hCBT_global_hook)
+ {
+ trace("Skipping WH_MOUSE_LL test on this platform\n");
+ goto skip_mouse_ll_hook_test;
+ }
hevent = CreateEventA(NULL, 0, 0, NULL);
assert(hevent);
@@ -6393,6 +6398,7 @@ static void test_winevents(void)
CloseHandle(hevent);
ok(!IsWindow(hwnd2), "window should be destroyed on thread exit\n");
/****** end of MOUSE_LL hook test *************/
+skip_mouse_ll_hook_test:
ok(DestroyWindow(hwnd), "failed to destroy window\n");
}
@@ -7183,18 +7189,22 @@ static void test_PeekMessage(void)
DWORD tid, qstatus;
UINT qs_all_input = QS_ALLINPUT;
UINT qs_input = QS_INPUT;
+ BOOL ret;
struct peekmsg_info info;
info.hwnd = CreateWindowA("TestWindowClass", NULL, WS_OVERLAPPEDWINDOW,
100, 100, 200, 200, 0, 0, 0, NULL);
+ assert(info.hwnd);
ShowWindow(info.hwnd, SW_SHOW);
UpdateWindow(info.hwnd);
+ SetFocus(info.hwnd);
info.hevent[EV_START_STOP] = CreateEventA(NULL, 0, 0, NULL);
info.hevent[EV_SENDMSG] = CreateEventA(NULL, 0, 0, NULL);
info.hevent[EV_ACK] = CreateEventA(NULL, 0, 0, NULL);
hthread = CreateThread(NULL, 0, send_msg_thread_2, &info, 0, &tid);
+ Sleep(100);
trace("signalling to start looping\n");
SetEvent(info.hevent[EV_START_STOP]);
@@ -7379,6 +7389,52 @@ todo_wine {
ok(qstatus == 0,
"wrong qstatus %08lx\n", qstatus);
+ /* test whether presence of the quit flag in the queue affects
+ * the queue state
+ */
+ PostQuitMessage(0x1234abcd);
+
+ qstatus = GetQueueStatus(qs_all_input);
+ ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE),
+ "wrong qstatus %08lx\n", qstatus);
+
+ PostMessageA(info.hwnd, WM_USER, 0, 0);
+
+ qstatus = GetQueueStatus(qs_all_input);
+ ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE),
+ "wrong qstatus %08lx\n", qstatus);
+
+ msg.message = 0;
+ ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+ ok(ret && msg.message == WM_USER,
+ "got %d and %x instead of TRUE and WM_USER\n", ret, msg.message);
+
+ qstatus = GetQueueStatus(qs_all_input);
+ ok(qstatus == MAKELONG(0, QS_POSTMESSAGE),
+ "wrong qstatus %08lx\n", qstatus);
+
+ msg.message = 0;
+ ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+ ok(ret && msg.message == WM_QUIT,
+ "got %d and %x instead of TRUE and WM_QUIT\n", ret, msg.message);
+ ok(msg.wParam == 0x1234abcd, "got wParam %x instead of 0x1234abcd\n", msg.wParam);
+ ok(msg.lParam == 0, "got lParam %lx instead of 0\n", msg.lParam);
+
+ qstatus = GetQueueStatus(qs_all_input);
+todo_wine {
+ ok(qstatus == MAKELONG(0, QS_POSTMESSAGE),
+ "wrong qstatus %08lx\n", qstatus);
+}
+
+ ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+ ok(!ret,
+ "PeekMessageA should have returned FALSE instead of msg %x\n",
+ msg.message);
+
+ qstatus = GetQueueStatus(qs_all_input);
+ ok(qstatus == 0,
+ "wrong qstatus %08lx\n", qstatus);
+
trace("signalling to exit\n");
SetEvent(info.hevent[EV_START_STOP]);
More information about the wine-patches
mailing list