[PATCH 6/6] ddraw/tests: Test focus loss style changes.
Stefan Dösinger
stefan at codeweavers.com
Wed Nov 12 15:15:39 CST 2014
---
dlls/ddraw/tests/ddraw1.c | 37 ++++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw2.c | 37 ++++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw4.c | 37 ++++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw7.c | 37 ++++++++++++++++++++++++++++++++++++-
4 files changed, 144 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index b31e25e..569aa94 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -2009,12 +2009,13 @@ static void test_wndproc(void)
static void test_window_style(void)
{
- LONG style, exstyle, tmp;
+ LONG style, exstyle, tmp, expected_style;
RECT fullscreen_rect, r;
IDirectDraw *ddraw;
HWND window;
HRESULT hr;
ULONG ref;
+ BOOL ret;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 100, 100, 0, 0, 0, 0);
@@ -2040,6 +2041,20 @@ static void test_window_style(void)
GetClientRect(window, &r);
todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+
+ ret = SetForegroundWindow(window);
+ ok(ret, "Failed to set foreground window.\n");
+ /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again,
+ * the next tests expect this. */
+ ShowWindow(window, SW_HIDE);
+
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
@@ -2048,6 +2063,26 @@ static void test_window_style(void)
tmp = GetWindowLongA(window, GWL_EXSTYLE);
todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ ShowWindow(window, SW_SHOW);
+ hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
+ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
+
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ expected_style = style | WS_VISIBLE;
+ todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ expected_style = exstyle | WS_EX_TOPMOST;
+ todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ expected_style = style | WS_VISIBLE | WS_MINIMIZE;
+ todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ expected_style = exstyle | WS_EX_TOPMOST;
+ todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp);
+
ref = IDirectDraw_Release(ddraw);
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 84dd17a..61cf668 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -2197,12 +2197,13 @@ static void test_wndproc(void)
static void test_window_style(void)
{
- LONG style, exstyle, tmp;
+ LONG style, exstyle, tmp, expected_style;
RECT fullscreen_rect, r;
IDirectDraw2 *ddraw;
HWND window;
HRESULT hr;
ULONG ref;
+ BOOL ret;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 100, 100, 0, 0, 0, 0);
@@ -2228,6 +2229,20 @@ static void test_window_style(void)
GetClientRect(window, &r);
todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+
+ ret = SetForegroundWindow(window);
+ ok(ret, "Failed to set foreground window.\n");
+ /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again,
+ * the next tests expect this. */
+ ShowWindow(window, SW_HIDE);
+
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
@@ -2236,6 +2251,26 @@ static void test_window_style(void)
tmp = GetWindowLongA(window, GWL_EXSTYLE);
todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ ShowWindow(window, SW_SHOW);
+ hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
+ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
+
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ expected_style = style | WS_VISIBLE;
+ todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ expected_style = exstyle | WS_EX_TOPMOST;
+ todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ expected_style = style | WS_VISIBLE | WS_MINIMIZE;
+ todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ expected_style = exstyle | WS_EX_TOPMOST;
+ todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp);
+
ref = IDirectDraw2_Release(ddraw);
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index fa8309d..eca99fa 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -2384,12 +2384,13 @@ static void test_wndproc(void)
static void test_window_style(void)
{
- LONG style, exstyle, tmp;
+ LONG style, exstyle, tmp, expected_style;
RECT fullscreen_rect, r;
IDirectDraw4 *ddraw;
HWND window;
HRESULT hr;
ULONG ref;
+ BOOL ret;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 100, 100, 0, 0, 0, 0);
@@ -2415,6 +2416,20 @@ static void test_window_style(void)
GetClientRect(window, &r);
todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+
+ ret = SetForegroundWindow(window);
+ ok(ret, "Failed to set foreground window.\n");
+ /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again,
+ * the next tests expect this. */
+ ShowWindow(window, SW_HIDE);
+
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
@@ -2423,6 +2438,26 @@ static void test_window_style(void)
tmp = GetWindowLongA(window, GWL_EXSTYLE);
todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ ShowWindow(window, SW_SHOW);
+ hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
+ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
+
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ expected_style = style | WS_VISIBLE;
+ todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ expected_style = exstyle | WS_EX_TOPMOST;
+ todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ expected_style = style | WS_VISIBLE | WS_MINIMIZE;
+ todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ expected_style = exstyle | WS_EX_TOPMOST;
+ todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp);
+
ref = IDirectDraw4_Release(ddraw);
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index adbecc2..9cf56a3 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -2062,12 +2062,13 @@ static void test_wndproc(void)
static void test_window_style(void)
{
- LONG style, exstyle, tmp;
+ LONG style, exstyle, tmp, expected_style;
RECT fullscreen_rect, r;
IDirectDraw7 *ddraw;
HWND window;
HRESULT hr;
ULONG ref;
+ BOOL ret;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 100, 100, 0, 0, 0, 0);
@@ -2093,6 +2094,20 @@ static void test_window_style(void)
GetClientRect(window, &r);
todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+
+ ret = SetForegroundWindow(window);
+ ok(ret, "Failed to set foreground window.\n");
+ /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again,
+ * the next tests expect this. */
+ ShowWindow(window, SW_HIDE);
+
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
@@ -2101,6 +2116,26 @@ static void test_window_style(void)
tmp = GetWindowLongA(window, GWL_EXSTYLE);
todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ ShowWindow(window, SW_SHOW);
+ hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
+ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
+
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ expected_style = style | WS_VISIBLE;
+ todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ expected_style = exstyle | WS_EX_TOPMOST;
+ todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ tmp = GetWindowLongA(window, GWL_STYLE);
+ expected_style = style | WS_VISIBLE | WS_MINIMIZE;
+ todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp);
+ tmp = GetWindowLongA(window, GWL_EXSTYLE);
+ expected_style = exstyle | WS_EX_TOPMOST;
+ todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp);
+
ref = IDirectDraw7_Release(ddraw);
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
--
2.0.4
More information about the wine-patches
mailing list