From: Zhiyi Zhang zzhang@codeweavers.com
Test that there is a ~1.5s timer after entering fullscreen mode and restores WS_EX_TOPMOST if it's missing when the timer times out. --- dlls/ddraw/tests/ddraw1.c | 30 ++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 30 ++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 30 ++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 120 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index f5fc7b04053..3ba738b1324 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2780,6 +2780,36 @@ static void test_window_style(void) expected_style = exstyle | WS_EX_TOPMOST; todo_wine ok(tmp == expected_style, "Expected window extended style %#lx, got %#lx.\n", expected_style, tmp);
+ /* Test that there is a ~1.5s timer that checks and restores WS_EX_TOPMOST if it's missing */ + ret = ShowWindow(window, SW_RESTORE); + ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#lx.\n", hr); + flush_events(); + + /* Remove WS_VISIBLE and WS_EX_TOPMOST */ + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp & WS_VISIBLE, "Expected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); + ret = ShowWindow(window, SW_HIDE); + ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); + ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + tmp = GetWindowLongA(window, GWL_STYLE); + ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + ok(!(tmp & WS_EX_TOPMOST), "Got unexpected WS_EX_TOPMOST.\n"); + + Sleep(1500); + flush_events(); + + /* WS_VISIBLE is not restored but WS_EX_TOPMOST is */ + tmp = GetWindowLongA(window, GWL_STYLE); + ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); + ref = IDirectDraw_Release(ddraw); ok(!ref, "Unexpected refcount %lu.\n", ref);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 1e33e7c7779..cacd1804869 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2866,6 +2866,36 @@ static void test_window_style(void) expected_style = exstyle | WS_EX_TOPMOST; todo_wine ok(tmp == expected_style, "Expected window extended style %#lx, got %#lx.\n", expected_style, tmp);
+ /* Test that there is a ~1.5s timer that checks and restores WS_EX_TOPMOST if it's missing */ + ret = ShowWindow(window, SW_RESTORE); + ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#lx.\n", hr); + flush_events(); + + /* Remove WS_VISIBLE and WS_EX_TOPMOST */ + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp & WS_VISIBLE, "Expected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); + ret = ShowWindow(window, SW_HIDE); + ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); + ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + tmp = GetWindowLongA(window, GWL_STYLE); + ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + ok(!(tmp & WS_EX_TOPMOST), "Got unexpected WS_EX_TOPMOST.\n"); + + Sleep(1500); + flush_events(); + + /* WS_VISIBLE is not restored but WS_EX_TOPMOST is */ + tmp = GetWindowLongA(window, GWL_STYLE); + ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); + ref = IDirectDraw2_Release(ddraw); ok(!ref, "Unexpected refcount %lu.\n", ref);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 379ba245571..ed7c8de3043 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -3104,6 +3104,36 @@ static void test_window_style(void) expected_style = exstyle | WS_EX_TOPMOST; todo_wine ok(tmp == expected_style, "Expected window extended style %#lx, got %#lx.\n", expected_style, tmp);
+ /* Test that there is a ~1.5s timer that checks and restores WS_EX_TOPMOST if it's missing */ + ret = ShowWindow(window, SW_RESTORE); + ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#lx.\n", hr); + flush_events(); + + /* Remove WS_VISIBLE and WS_EX_TOPMOST */ + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp & WS_VISIBLE, "Expected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); + ret = ShowWindow(window, SW_HIDE); + ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); + ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + tmp = GetWindowLongA(window, GWL_STYLE); + ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + ok(!(tmp & WS_EX_TOPMOST), "Got unexpected WS_EX_TOPMOST.\n"); + + Sleep(1500); + flush_events(); + + /* WS_VISIBLE is not restored but WS_EX_TOPMOST is */ + tmp = GetWindowLongA(window, GWL_STYLE); + ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); + ref = IDirectDraw4_Release(ddraw); ok(!ref, "Unexpected refcount %lu.\n", ref);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 779c8c982cf..896d304fd24 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2823,6 +2823,36 @@ static void test_window_style(void) expected_style = exstyle | WS_EX_TOPMOST; todo_wine ok(tmp == expected_style, "Expected window extended style %#lx, got %#lx.\n", expected_style, tmp);
+ /* Test that there is a ~1.5s timer that checks and restores WS_EX_TOPMOST if it's missing */ + ret = ShowWindow(window, SW_RESTORE); + ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#lx.\n", hr); + flush_events(); + + /* Remove WS_VISIBLE and WS_EX_TOPMOST */ + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp & WS_VISIBLE, "Expected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); + ret = ShowWindow(window, SW_HIDE); + ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); + ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + tmp = GetWindowLongA(window, GWL_STYLE); + ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + ok(!(tmp & WS_EX_TOPMOST), "Got unexpected WS_EX_TOPMOST.\n"); + + Sleep(1500); + flush_events(); + + /* WS_VISIBLE is not restored but WS_EX_TOPMOST is */ + tmp = GetWindowLongA(window, GWL_STYLE); + ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); + ref = IDirectDraw7_Release(ddraw); ok(!ref, "Unexpected refcount %lu.\n", ref);