Henri Verbeet : ddraw/tests: Add test_window_style() for older ddraw versions.
Alexandre Julliard
julliard at winehq.org
Tue May 29 13:58:02 CDT 2012
Module: wine
Branch: master
Commit: 7a52db09e3b61acbd185ee0d88af4257b04a7536
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7a52db09e3b61acbd185ee0d88af4257b04a7536
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Mon May 28 18:17:27 2012 +0200
ddraw/tests: Add test_window_style() for older ddraw versions.
---
dlls/ddraw/tests/ddraw1.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
dlls/ddraw/tests/ddraw2.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
dlls/ddraw/tests/ddraw4.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 132 insertions(+), 0 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index cb681bf..e53a1cd 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -1834,6 +1834,49 @@ static void test_wndproc(void)
UnregisterClassA("ddraw_test_wndproc_wc", GetModuleHandleA(NULL));
}
+static void test_window_style(void)
+{
+ LONG style, exstyle, tmp;
+ RECT fullscreen_rect, r;
+ IDirectDraw *ddraw;
+ HWND window;
+ HRESULT hr;
+ ULONG ref;
+
+ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 100, 100, 0, 0, 0, 0);
+ if (!(ddraw = create_ddraw()))
+ {
+ skip("Failed to create a ddraw object, skipping test.\n");
+ DestroyWindow(window);
+ return;
+ }
+
+ style = GetWindowLongA(window, GWL_STYLE);
+ exstyle = GetWindowLongA(window, GWL_EXSTYLE);
+ SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
+
+ hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
+ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
+
+ 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);
+
+ GetWindowRect(window, &r);
+ ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
+ fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
+ r.left, r.top, r.right, r.bottom);
+ GetClientRect(window, &r);
+ todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
+
+ ref = IDirectDraw_Release(ddraw);
+ ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
+
+ DestroyWindow(window);
+}
+
START_TEST(ddraw1)
{
test_coop_level_create_device_window();
@@ -1848,4 +1891,5 @@ START_TEST(ddraw1)
test_surface_qi();
test_device_qi();
test_wndproc();
+ test_window_style();
}
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index ca3536a..7f1ae88 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -1971,6 +1971,49 @@ static void test_wndproc(void)
UnregisterClassA("ddraw_test_wndproc_wc", GetModuleHandleA(NULL));
}
+static void test_window_style(void)
+{
+ LONG style, exstyle, tmp;
+ RECT fullscreen_rect, r;
+ IDirectDraw2 *ddraw;
+ HWND window;
+ HRESULT hr;
+ ULONG ref;
+
+ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 100, 100, 0, 0, 0, 0);
+ if (!(ddraw = create_ddraw()))
+ {
+ skip("Failed to create a ddraw object, skipping test.\n");
+ DestroyWindow(window);
+ return;
+ }
+
+ style = GetWindowLongA(window, GWL_STYLE);
+ exstyle = GetWindowLongA(window, GWL_EXSTYLE);
+ SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
+
+ hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
+ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
+
+ 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);
+
+ GetWindowRect(window, &r);
+ ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
+ fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
+ r.left, r.top, r.right, r.bottom);
+ GetClientRect(window, &r);
+ todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
+
+ ref = IDirectDraw2_Release(ddraw);
+ ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
+
+ DestroyWindow(window);
+}
+
START_TEST(ddraw2)
{
test_coop_level_create_device_window();
@@ -1987,4 +2030,5 @@ START_TEST(ddraw2)
test_surface_qi();
test_device_qi();
test_wndproc();
+ test_window_style();
}
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index c19cd4b..6f00b41 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -2095,6 +2095,49 @@ static void test_wndproc(void)
UnregisterClassA("ddraw_test_wndproc_wc", GetModuleHandleA(NULL));
}
+static void test_window_style(void)
+{
+ LONG style, exstyle, tmp;
+ RECT fullscreen_rect, r;
+ IDirectDraw4 *ddraw;
+ HWND window;
+ HRESULT hr;
+ ULONG ref;
+
+ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 100, 100, 0, 0, 0, 0);
+ if (!(ddraw = create_ddraw()))
+ {
+ skip("Failed to create a ddraw object, skipping test.\n");
+ DestroyWindow(window);
+ return;
+ }
+
+ style = GetWindowLongA(window, GWL_STYLE);
+ exstyle = GetWindowLongA(window, GWL_EXSTYLE);
+ SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
+
+ hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
+ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
+
+ 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);
+
+ GetWindowRect(window, &r);
+ ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
+ fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
+ r.left, r.top, r.right, r.bottom);
+ GetClientRect(window, &r);
+ todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
+
+ ref = IDirectDraw4_Release(ddraw);
+ ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
+
+ DestroyWindow(window);
+}
+
START_TEST(ddraw4)
{
test_process_vertices();
@@ -2112,4 +2155,5 @@ START_TEST(ddraw4)
test_surface_qi();
test_device_qi();
test_wndproc();
+ test_window_style();
}
More information about the wine-cvs
mailing list