ddraw/tests: Test focus loss style changes.

This commit is contained in:
Stefan Dösinger 2014-11-18 21:26:53 +01:00 committed by Alexandre Julliard
parent be01a7637d
commit a071587373
4 changed files with 144 additions and 4 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);