Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/user32/tests/input.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index e52f7d2..2185cda 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -848,16 +848,7 @@ static LRESULT CALLBACK WndProc2(HWND hWnd, UINT Msg, WPARAM wParam, { if (winetest_debug > 1) trace("MSG: %8x W:%8lx L:%8lx\n", Msg, wParam, lParam);
- if (Msg != WM_PAINT && - Msg != WM_NCPAINT && - Msg != WM_SYNCPAINT && - Msg != WM_ERASEBKGND && - Msg != WM_NCHITTEST && - Msg != WM_GETTEXT && - Msg != WM_GETICON && - Msg != WM_IME_SELECT && - Msg != WM_DEVICECHANGE && - Msg != WM_TIMECHANGE) + if ((Msg >= WM_KEYFIRST && Msg <= WM_KEYLAST) || Msg == WM_SYSCOMMAND) { ok(sent_messages_cnt < MAXKEYMESSAGES, "Too many messages\n"); if (sent_messages_cnt < MAXKEYMESSAGES)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- This should be a better way of checking for failure since it addresses the root cause, and should hopefully also fix an intermittent test failure on Wine.
dlls/user32/tests/input.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 2185cda..8fa1de2 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -691,14 +691,17 @@ static struct message sent_messages[MAXKEYMESSAGES]; static UINT sent_messages_cnt;
/* Verify that only specified key state transitions occur */ -static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, const struct sendinput_test_s *test) +static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, + const struct sendinput_test_s *test, BOOL foreground) { int i, failcount = 0; const struct transition_s *t = test->expected_transitions; UINT actual_cnt = 0; const struct message *expected = test->expected_messages;
- while (t->wVk) { + while (t->wVk && foreground) { + /* We won't receive any information from GetKeyboardState() if we're + * not the foreground window. */ BOOL matched = ((ks1[t->wVk]&0x80) == (t->before_state&0x80) && (ks2[t->wVk]&0x80) == (~t->before_state&0x80));
@@ -781,6 +784,13 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, const struct sendinp expected++; continue; } + else if (!(expected->flags & hook) && !foreground) + { + /* If we weren't able to receive foreground status, we won't get + * any window messages. */ + expected++; + continue; + } /* NT4 doesn't send SYSKEYDOWN/UP to hooks, only KEYDOWN/UP */ else if ((expected->flags & hook) && (expected->message == WM_SYSKEYDOWN || expected->message == WM_SYSKEYUP) && @@ -817,7 +827,7 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, const struct sendinp expected++; } /* skip all optional trailing messages */ - while (expected->message && (expected->flags & optional)) + while (expected->message && ((expected->flags & optional) || (!(expected->flags & hook) && !foreground))) expected++;
@@ -897,6 +907,7 @@ static void test_Input_blackbox(void) int ii; BYTE ks1[256], ks2[256]; LONG_PTR prevWndProc; + BOOL foreground; HWND window; HHOOK hook;
@@ -910,7 +921,9 @@ static void test_Input_blackbox(void) NULL, NULL); ok(window != NULL, "error: %d\n", (int) GetLastError()); SetWindowPos( window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE ); - SetForegroundWindow( window ); + foreground = SetForegroundWindow( window ); + if (!foreground) + skip("Failed to set foreground window; some tests will be skipped.\n");
if (!(hook = SetWindowsHookExA(WH_KEYBOARD_LL, hook_proc, GetModuleHandleA( NULL ), 0))) { @@ -939,15 +952,7 @@ static void test_Input_blackbox(void) pSendInput(1, (INPUT*)&i, sizeof(TEST_INPUT)); empty_message_queue(); GetKeyboardState(ks2); - if (!ii && sent_messages_cnt <= 1 && !memcmp( ks1, ks2, sizeof(ks1) )) - { - win_skip( "window doesn't receive the queued input\n" ); - /* release the key */ - i.u.ki.dwFlags |= KEYEVENTF_KEYUP; - pSendInput(1, (INPUT*)&i, sizeof(TEST_INPUT)); - break; - } - compare_and_check(ii, ks1, ks2, &sendinput_test[ii]); + compare_and_check(ii, ks1, ks2, &sendinput_test[ii], foreground); }
empty_message_queue();
Hi,
While running your changed tests on Windows, 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=39204
Your paranoid android.
=== w7pro64 (64 bit input) === input.c:2055: Test failed: expected WM_NCHITTEST message input.c:2082: Test failed: expected loop with WM_NCHITTEST messages input.c:2135: Test failed: expected WM_LBUTTONDOWN message input.c:2136: Test failed: expected WM_LBUTTONUP message
On 17/06/18 16:20, Marvin wrote:
Hi,
While running your changed tests on Windows, 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=39204
Your paranoid android.
=== w7pro64 (64 bit input) === input.c:2055: Test failed: expected WM_NCHITTEST message input.c:2082: Test failed: expected loop with WM_NCHITTEST messages input.c:2135: Test failed: expected WM_LBUTTONDOWN message input.c:2136: Test failed: expected WM_LBUTTONUP message
This failure is in a different test, and should not be affected by my changes. A similar failure can be seen here:
http://test.winehq.org/data/8e9ea7a8a163147012908bad696a539454654d8f/win7_ne...