First change is to avoid creating and mapping windows concurrently, this is completely racy and can cause random results later on depending on which window ends up being focused and depending on the X11 events. In addition, FVWM focus tracking suffers from various race conditions already, which only makes it worse.
Second change is to avoid failing the tests because of spurious window resize messages on the dummy window. I'm not sure what the window is for exactly but I believe it's not meaningful in the message sequence as it never appears there. As it is maximized, the window is sometimes resized by some WMs when the display mode changes, which cause the spurious WM_SIZE messages.
-- v2: d3d8/tests: Use static class for the dummy window. d3d8/tests: Avoid creating visible windows concurrently. d3d9/tests: Use static class for the dummy window. d3d9/tests: Avoid creating visible windows concurrently.
From: Rémi Bernon rbernon@codeweavers.com
This causes a foreground window race condition and will cause spurious failures depending on how pending X11 events are processed concurrenly.
Some tests now fail consistently and more todo_wine are needed. --- dlls/d3d9/tests/d3d9ex.c | 81 +++++++++++++++------------------------- dlls/d3d9/tests/device.c | 48 ++++++++++-------------- 2 files changed, 50 insertions(+), 79 deletions(-)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index e946b960055..cb4ae92df52 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -2508,7 +2508,6 @@ struct wndproc_thread_param HWND dummy_window; HANDLE window_created; HANDLE test_finished; - BOOL running_in_foreground; };
static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) @@ -2584,7 +2583,7 @@ static DWORD WINAPI wndproc_thread(void *param) p->dummy_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, 0, 0, 0, 0); - p->running_in_foreground = SetForegroundWindow(p->dummy_window); + flush_events();
ret = SetEvent(p->window_created); ok(ret, "SetEvent failed, last error %#lx.\n", GetLastError()); @@ -2868,11 +2867,14 @@ static void test_wndproc(void) WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, user32_width, user32_height, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, user32_width, user32_height, 0, 0, 0, 0); + flush_events(); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#lx.\n", GetLastError());
res = WaitForSingleObject(thread_params.window_created, INFINITE); ok(res == WAIT_OBJECT_0, "Wait failed (%#lx), last error %#lx.\n", res, GetLastError()); + flush_events();
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#Ix, got %#Ix.\n", @@ -2885,15 +2887,10 @@ static void test_wndproc(void) device_window, focus_window, thread_params.dummy_window);
tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) - { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + ok(tmp == NULL, "Expected focus %p, got %p.\n", NULL, tmp); + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp);
flush_events();
@@ -2913,13 +2910,10 @@ static void test_wndproc(void) expect_messages->message, expect_messages->window, i); expect_messages = NULL;
- if (0) /* Disabled until we can make this work in a reliable way on Wine. */ - { - tmp = GetFocus(); - ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); - } + tmp = GetFocus(); + ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); + tmp = GetForegroundWindow(); + ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); SetForegroundWindow(focus_window); flush_events();
@@ -3027,28 +3021,12 @@ static void test_wndproc(void)
flush_events();
- /* Openbox accidentally sets focus to the device window, causing WM_ACTIVATEAPP to be sent to the focus - * window. d3d9ex then restores the screen mode. This only happens in the D3DCREATE_NOWINDOWCHANGES case. - * - * This appears to be a race condition - it goes away if openbox is started with --sync. d3d9:device and - * d3d8:device are affected too, but because in their case d3d does not automatically restore the screen - * mode (it needs a call to device::Reset), the EnumDisplaySettings check succeeds regardless. - * - * Note that this is not a case of focus follows mouse. This happens when Openbox is configured to use - * click to focus too. */ - if (GetForegroundWindow() == device_window) - { - skip("WM set focus to the device window, not checking screen mode.\n"); - } - else - { - ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); - ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, - "Got unexpected width %lu.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, - "Got unexpected height %lu.\n", devmode.dmPelsHeight); - } + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, + "Got unexpected width %lu.\n", devmode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Got unexpected height %lu.\n", devmode.dmPelsHeight);
/* SW_SHOWMINNOACTIVE is needed to make FVWM happy. SW_SHOWNOACTIVATE is needed to make windows * send SIZE_RESTORED after ShowWindow(SW_SHOWMINNOACTIVE). */ @@ -3165,6 +3143,7 @@ static void test_wndproc(void)
expect_messages = sc_maximize_messages; SendMessageA(focus_window, WM_SYSCOMMAND, SC_MAXIMIZE, 0); + todo_wine_if(tests[i].create_flags & CREATE_DEVICE_NOWINDOWCHANGES) ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", expect_messages->message, expect_messages->window, i); expect_messages = NULL; @@ -3207,6 +3186,7 @@ static void test_wndproc(void) * it is clear that the window has not been resized. In previous Windows version the window is resized. */
flush_events(); + todo_wine_if(!(tests[i].create_flags & CREATE_DEVICE_NOWINDOWCHANGES)) ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", expect_messages->message, expect_messages->window, i); expect_messages = NULL; @@ -3227,12 +3207,14 @@ static void test_wndproc(void) filter_messages = NULL;
flush_events(); + todo_wine_if(!(tests[i].create_flags & CREATE_DEVICE_NOWINDOWCHANGES)) ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", expect_messages->message, expect_messages->window, i); expect_messages = NULL;
if (!(tests[i].create_flags & CREATE_DEVICE_NOWINDOWCHANGES)) { + todo_wine_if(!(tests[i].create_flags & CREATE_DEVICE_NOWINDOWCHANGES)) ok(windowpos.hwnd == device_window && !windowpos.x && !windowpos.y && !windowpos.cx && !windowpos.cy && windowpos.flags == (SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE), @@ -3311,11 +3293,14 @@ static void test_wndproc_windowed(void) device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, 0, 0, 0, 0); + flush_events(); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#lx.\n", GetLastError());
res = WaitForSingleObject(thread_params.window_created, INFINITE); ok(res == WAIT_OBJECT_0, "Wait failed (%#lx), last error %#lx.\n", res, GetLastError()); + flush_events();
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#Ix, got %#Ix.\n", @@ -3328,16 +3313,10 @@ static void test_wndproc_windowed(void) device_window, focus_window, thread_params.dummy_window);
tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) - { - tmp = GetForegroundWindow(); - flaky - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + ok(tmp == NULL, "Expected focus %p, got %p.\n", NULL, tmp); + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp);
filter_messages = focus_window;
@@ -3352,7 +3331,7 @@ static void test_wndproc_windowed(void) }
tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); + ok(tmp == NULL, "Expected focus %p, got %p.\n", NULL, tmp); tmp = GetForegroundWindow(); ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", thread_params.dummy_window, tmp); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 62f308e0734..431cd3ba76e 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3762,7 +3762,6 @@ struct wndproc_thread_param HWND dummy_window; HANDLE window_created; HANDLE test_finished; - BOOL running_in_foreground; };
static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) @@ -3843,7 +3842,7 @@ static DWORD WINAPI wndproc_thread(void *param) p->dummy_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, 0, 0, 0, 0); - p->running_in_foreground = SetForegroundWindow(p->dummy_window); + flush_events();
ret = SetEvent(p->window_created); ok(ret, "SetEvent failed, last error %#lx.\n", GetLastError()); @@ -4147,11 +4146,14 @@ static void test_wndproc(void) WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, user32_width, user32_height, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, user32_width, user32_height, 0, 0, 0, 0); + flush_events(); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#lx.\n", GetLastError());
res = WaitForSingleObject(thread_params.window_created, INFINITE); ok(res == WAIT_OBJECT_0, "Wait failed (%#lx), last error %#lx.\n", res, GetLastError()); + flush_events();
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#Ix, got %#Ix.\n", @@ -4164,15 +4166,10 @@ static void test_wndproc(void) device_window, focus_window, thread_params.dummy_window);
tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) - { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + ok(tmp == NULL, "Expected focus %p, got %p.\n", NULL, tmp); + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp);
flush_events();
@@ -4193,13 +4190,10 @@ static void test_wndproc(void) expect_messages->message, expect_messages->window, i); expect_messages = NULL;
- if (0) /* Disabled until we can make this work in a reliable way on Wine. */ - { - tmp = GetFocus(); - ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); - } + tmp = GetFocus(); + ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); + tmp = GetForegroundWindow(); + ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); SetForegroundWindow(focus_window); flush_events();
@@ -4614,11 +4608,14 @@ static void test_wndproc_windowed(void) device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, 0, 0, 0, 0); + flush_events(); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#lx.\n", GetLastError());
res = WaitForSingleObject(thread_params.window_created, INFINITE); ok(res == WAIT_OBJECT_0, "Wait failed (%#lx), last error %#lx.\n", res, GetLastError()); + flush_events();
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#Ix, got %#Ix.\n", @@ -4631,15 +4628,10 @@ static void test_wndproc_windowed(void) device_window, focus_window, thread_params.dummy_window);
tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) - { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + ok(tmp == NULL, "Expected focus %p, got %p.\n", NULL, tmp); + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp);
filter_messages = focus_window;
@@ -4655,7 +4647,7 @@ static void test_wndproc_windowed(void) }
tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); + ok(tmp == NULL, "Expected focus %p, got %p.\n", NULL, tmp); tmp = GetForegroundWindow(); ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", thread_params.dummy_window, tmp);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/d3d9/tests/d3d9ex.c | 11 ++--------- dlls/d3d9/tests/device.c | 5 ++--- 2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index cb4ae92df52..ea477e2391b 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -2580,9 +2580,8 @@ static DWORD WINAPI wndproc_thread(void *param) DWORD res; BOOL ret;
- p->dummy_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); + p->dummy_window = CreateWindowA("static", "d3d9_test", WS_VISIBLE | WS_CAPTION, + 100, 100, 200, 200, 0, 0, 0, 0); flush_events();
ret = SetEvent(p->window_created); @@ -3007,9 +3006,6 @@ static void test_wndproc(void) SetForegroundWindow(GetDesktopWindow()); ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", expect_messages->message, expect_messages->window, i); - - /* kwin sometimes resizes hidden windows. */ - flaky ok(!windowposchanged_received, "Received WM_WINDOWPOSCHANGED but did not expect it, i=%u.\n", i);
expect_messages = NULL; @@ -3103,9 +3099,6 @@ static void test_wndproc(void) flaky_wine ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", expect_messages->message, expect_messages->window, i); - - /* kwin and Win8+ sometimes resize hidden windows. */ - flaky ok(!windowposchanged_received, "Received WM_WINDOWPOSCHANGED but did not expect it, i=%u.\n", i);
expect_messages = NULL; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 431cd3ba76e..df9d7c54d27 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3839,9 +3839,8 @@ static DWORD WINAPI wndproc_thread(void *param) DWORD res; BOOL ret;
- p->dummy_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); + p->dummy_window = CreateWindowA("static", "d3d9_test", WS_VISIBLE | WS_CAPTION, + 100, 100, 200, 200, 0, 0, 0, 0); flush_events();
ret = SetEvent(p->window_created);
From: Rémi Bernon rbernon@codeweavers.com
This causes a foreground window race condition and will cause spurious failures depending on how pending X11 events are processed concurrenly.
Some tests now fail consistently and more todo_wine are needed. --- dlls/d3d8/tests/device.c | 48 +++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 28 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 10c06b17ba7..580c54112da 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2773,7 +2773,6 @@ struct wndproc_thread_param HWND dummy_window; HANDLE window_created; HANDLE test_finished; - BOOL running_in_foreground; };
static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) @@ -2852,7 +2851,7 @@ static DWORD WINAPI wndproc_thread(void *param) p->dummy_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, 0, 0, 0, 0); - p->running_in_foreground = SetForegroundWindow(p->dummy_window); + flush_events();
ret = SetEvent(p->window_created); ok(ret, "SetEvent failed, last error %#lx.\n", GetLastError()); @@ -3110,11 +3109,14 @@ static void test_wndproc(void) WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, user32_width, user32_height, 0, 0, 0, 0); device_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, user32_width, user32_height, 0, 0, 0, 0); + flush_events(); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#lx.\n", GetLastError());
res = WaitForSingleObject(thread_params.window_created, INFINITE); ok(res == WAIT_OBJECT_0, "Wait failed (%#lx), last error %#lx.\n", res, GetLastError()); + flush_events();
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#Ix, got %#Ix.\n", @@ -3127,15 +3129,10 @@ static void test_wndproc(void) device_window, focus_window, thread_params.dummy_window);
tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) - { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + ok(tmp == NULL, "Expected focus %p, got %p.\n", NULL, tmp); + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp);
flush_events();
@@ -3156,13 +3153,10 @@ static void test_wndproc(void) expect_messages->message, expect_messages->window); expect_messages = NULL;
- if (0) /* Disabled until we can make this work in a reliable way on Wine. */ - { - tmp = GetFocus(); - ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); - } + tmp = GetFocus(); + ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); + tmp = GetForegroundWindow(); + ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); SetForegroundWindow(focus_window); flush_events();
@@ -3539,11 +3533,14 @@ static void test_wndproc_windowed(void) device_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, 0, 0, 0, 0); + flush_events(); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#lx.\n", GetLastError());
res = WaitForSingleObject(thread_params.window_created, INFINITE); ok(res == WAIT_OBJECT_0, "Wait failed (%#lx), last error %#lx.\n", res, GetLastError()); + flush_events();
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#Ix, got %#Ix.\n", @@ -3556,15 +3553,10 @@ static void test_wndproc_windowed(void) device_window, focus_window, thread_params.dummy_window);
tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) - { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + ok(tmp == NULL, "Expected focus %p, got %p.\n", NULL, tmp); + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp);
filter_messages = focus_window;
@@ -3580,7 +3572,7 @@ static void test_wndproc_windowed(void) }
tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); + ok(tmp == NULL, "Expected focus %p, got %p.\n", NULL, tmp); tmp = GetForegroundWindow(); ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", thread_params.dummy_window, tmp);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/d3d8/tests/device.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 580c54112da..7d638d2a61f 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2848,9 +2848,8 @@ static DWORD WINAPI wndproc_thread(void *param) DWORD res; BOOL ret;
- p->dummy_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); + p->dummy_window = CreateWindowA("static", "d3d9_test", WS_VISIBLE | WS_CAPTION, + 100, 100, 200, 200, 0, 0, 0, 0); flush_events();
ret = SetEvent(p->window_created);
v2: Updated with d3d8:device and d3d9:device adjusted as well, also changed the dummy window to be a non-maximized 100x100 window.
All of the added todos in d3d9:d3d9ex are succeeding for me, both with virtual desktop (my usual test environment) and with kwin directly. (The reference environment skips d3d9ex, so we can't compare there.)
On Wed Oct 23 16:35:43 2024 +0000, Elizabeth Figura wrote:
All of the added todos in d3d9:d3d9ex are succeeding for me, both with virtual desktop (my usual test environment) and with kwin directly. (The reference environment skips d3d9ex, so we can't compare there.)
They are randomly failing/passing with `fvwm` because of various race conditions with X11 window state/config events, `kwin`/`openbox` behave more consistently and don't trigger them, virtual desktop mode of course don't suffer from these problems.
I can remove the todo_wine, but I think they are more often failing on Gitlab for some reason, or make them flaky and hide the issue, what do you prefer?
Fwiw https://gitlab.winehq.org/wine/wine/-/merge_requests/6569 is meant to fix these window state/config race conditions. There's still some with input focus which are trickier but less frequent, and this MR is also needed to fix the racy dummy window creation in the test itself.
On Wed Oct 23 16:35:43 2024 +0000, Rémi Bernon wrote:
They are randomly failing/passing with `fvwm` because of various race conditions with X11 window state/config events, `kwin`/`openbox` behave more consistently and don't trigger them, virtual desktop mode of course don't suffer from these problems. I can remove the todo_wine, but I think they are more often failing on Gitlab for some reason, or make them flaky and hide the issue, what do you prefer? Fwiw https://gitlab.winehq.org/wine/wine/-/merge_requests/6569 is meant to fix these window state/config race conditions. There's still some with input focus which are trickier but less frequent, and this MR is also needed to fix the racy dummy window creation in the test itself.
If the tests pass inconsistently on fvwm, I would assert there's not much point picking one or the other result, since we can't rely on it and need to keep d3d9:d3d9ex disabled anyway until they're passing consistently.
Meanwhile, I do run tests regularly on virtual desktop (and occasionally kwin), both for development and always when reviewing patches.
So, given that the todos hamper review while not really fixing the CI, I'd advocate for removing them.