ddraw/tests: Test window position.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a637370de6
commit
5f0608396c
|
@ -13633,6 +13633,67 @@ static void test_vtbl_protection(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect,
|
||||
LPARAM lparam)
|
||||
{
|
||||
RECT primary_rect, window_rect;
|
||||
IDirectDraw *ddraw;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
BOOL ret;
|
||||
|
||||
ddraw = create_ddraw();
|
||||
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||
window = CreateWindowA("static", "ddraw_test", WS_POPUP | WS_VISIBLE, monitor_rect->left,
|
||||
monitor_rect->top, monitor_rect->right - monitor_rect->left,
|
||||
monitor_rect->bottom - monitor_rect->top, NULL, NULL, NULL, NULL);
|
||||
ok(!!window, "Failed to create a window.\n");
|
||||
flush_events();
|
||||
|
||||
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||
ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||
flush_events();
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
SetRect(&primary_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
/* Window activation should restore the window to fit the whole primary monitor */
|
||||
ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0,
|
||||
SWP_NOZORDER | SWP_NOSIZE);
|
||||
ok(ret, "SetWindowPos failed, error %#x.\n", GetLastError());
|
||||
ret = SetForegroundWindow(GetDesktopWindow());
|
||||
ok(ret, "Failed to set foreground window.\n");
|
||||
flush_events();
|
||||
ret = ShowWindow(window, SW_RESTORE);
|
||||
ok(ret, "Failed to restore window, error %#x.\n", GetLastError());
|
||||
flush_events();
|
||||
ret = SetForegroundWindow(window);
|
||||
ok(ret, "SetForegroundWindow failed, error %#x.\n", GetLastError());
|
||||
flush_events();
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||
ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
DestroyWindow(window);
|
||||
IDirectDraw_Release(ddraw);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_window_position(void)
|
||||
{
|
||||
EnumDisplayMonitors(NULL, NULL, test_window_position_cb, 0);
|
||||
}
|
||||
|
||||
START_TEST(ddraw1)
|
||||
{
|
||||
DDDEVICEIDENTIFIER identifier;
|
||||
|
@ -13747,4 +13808,5 @@ START_TEST(ddraw1)
|
|||
test_d32_support();
|
||||
test_cursor_clipping();
|
||||
test_vtbl_protection();
|
||||
test_window_position();
|
||||
}
|
||||
|
|
|
@ -14405,6 +14405,67 @@ done:
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect,
|
||||
LPARAM lparam)
|
||||
{
|
||||
RECT primary_rect, window_rect;
|
||||
IDirectDraw2 *ddraw;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
BOOL ret;
|
||||
|
||||
ddraw = create_ddraw();
|
||||
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||
window = CreateWindowA("static", "ddraw_test", WS_POPUP | WS_VISIBLE, monitor_rect->left,
|
||||
monitor_rect->top, monitor_rect->right - monitor_rect->left,
|
||||
monitor_rect->bottom - monitor_rect->top, NULL, NULL, NULL, NULL);
|
||||
ok(!!window, "Failed to create a window.\n");
|
||||
flush_events();
|
||||
|
||||
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||
ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||
flush_events();
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
SetRect(&primary_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
/* Window activation should restore the window to fit the whole primary monitor */
|
||||
ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0,
|
||||
SWP_NOZORDER | SWP_NOSIZE);
|
||||
ok(ret, "SetWindowPos failed, error %#x.\n", GetLastError());
|
||||
ret = SetForegroundWindow(GetDesktopWindow());
|
||||
ok(ret, "Failed to set foreground window.\n");
|
||||
flush_events();
|
||||
ret = ShowWindow(window, SW_RESTORE);
|
||||
ok(ret, "Failed to restore window, error %#x.\n", GetLastError());
|
||||
flush_events();
|
||||
ret = SetForegroundWindow(window);
|
||||
ok(ret, "SetForegroundWindow failed, error %#x.\n", GetLastError());
|
||||
flush_events();
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||
ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
DestroyWindow(window);
|
||||
IDirectDraw2_Release(ddraw);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_window_position(void)
|
||||
{
|
||||
EnumDisplayMonitors(NULL, NULL, test_window_position_cb, 0);
|
||||
}
|
||||
|
||||
START_TEST(ddraw2)
|
||||
{
|
||||
DDDEVICEIDENTIFIER identifier;
|
||||
|
@ -14525,4 +14586,5 @@ START_TEST(ddraw2)
|
|||
test_caps();
|
||||
test_d32_support();
|
||||
test_cursor_clipping();
|
||||
test_window_position();
|
||||
}
|
||||
|
|
|
@ -17432,6 +17432,67 @@ done:
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect,
|
||||
LPARAM lparam)
|
||||
{
|
||||
RECT primary_rect, window_rect;
|
||||
IDirectDraw4 *ddraw;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
BOOL ret;
|
||||
|
||||
ddraw = create_ddraw();
|
||||
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||
window = CreateWindowA("static", "ddraw_test", WS_POPUP | WS_VISIBLE, monitor_rect->left,
|
||||
monitor_rect->top, monitor_rect->right - monitor_rect->left,
|
||||
monitor_rect->bottom - monitor_rect->top, NULL, NULL, NULL, NULL);
|
||||
ok(!!window, "Failed to create a window.\n");
|
||||
flush_events();
|
||||
|
||||
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||
ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||
flush_events();
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
SetRect(&primary_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
/* Window activation should restore the window to fit the whole primary monitor */
|
||||
ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0,
|
||||
SWP_NOZORDER | SWP_NOSIZE);
|
||||
ok(ret, "SetWindowPos failed, error %#x.\n", GetLastError());
|
||||
ret = SetForegroundWindow(GetDesktopWindow());
|
||||
ok(ret, "Failed to set foreground window.\n");
|
||||
flush_events();
|
||||
ret = ShowWindow(window, SW_RESTORE);
|
||||
ok(ret, "Failed to restore window, error %#x.\n", GetLastError());
|
||||
flush_events();
|
||||
ret = SetForegroundWindow(window);
|
||||
ok(ret, "SetForegroundWindow failed, error %#x.\n", GetLastError());
|
||||
flush_events();
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||
ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
DestroyWindow(window);
|
||||
IDirectDraw4_Release(ddraw);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_window_position(void)
|
||||
{
|
||||
EnumDisplayMonitors(NULL, NULL, test_window_position_cb, 0);
|
||||
}
|
||||
|
||||
START_TEST(ddraw4)
|
||||
{
|
||||
DDDEVICEIDENTIFIER identifier;
|
||||
|
@ -17568,4 +17629,5 @@ START_TEST(ddraw4)
|
|||
test_d32_support();
|
||||
test_surface_format_conversion_alpha();
|
||||
test_cursor_clipping();
|
||||
test_window_position();
|
||||
}
|
||||
|
|
|
@ -17667,6 +17667,67 @@ done:
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect,
|
||||
LPARAM lparam)
|
||||
{
|
||||
RECT primary_rect, window_rect;
|
||||
IDirectDraw7 *ddraw;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
BOOL ret;
|
||||
|
||||
ddraw = create_ddraw();
|
||||
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||
window = CreateWindowA("static", "ddraw_test", WS_POPUP | WS_VISIBLE, monitor_rect->left,
|
||||
monitor_rect->top, monitor_rect->right - monitor_rect->left,
|
||||
monitor_rect->bottom - monitor_rect->top, NULL, NULL, NULL, NULL);
|
||||
ok(!!window, "Failed to create a window.\n");
|
||||
flush_events();
|
||||
|
||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||
ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||
flush_events();
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
SetRect(&primary_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
/* Window activation should restore the window to fit the whole primary monitor */
|
||||
ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0,
|
||||
SWP_NOZORDER | SWP_NOSIZE);
|
||||
ok(ret, "SetWindowPos failed, error %#x.\n", GetLastError());
|
||||
ret = SetForegroundWindow(GetDesktopWindow());
|
||||
ok(ret, "Failed to set foreground window.\n");
|
||||
flush_events();
|
||||
ret = ShowWindow(window, SW_RESTORE);
|
||||
ok(ret, "Failed to restore window, error %#x.\n", GetLastError());
|
||||
flush_events();
|
||||
ret = SetForegroundWindow(window);
|
||||
ok(ret, "SetForegroundWindow failed, error %#x.\n", GetLastError());
|
||||
flush_events();
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||
ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||
ret = GetWindowRect(window, &window_rect);
|
||||
ok(ret, "GetWindowRect failed, error %#x.\n", GetLastError());
|
||||
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
|
||||
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
|
||||
|
||||
DestroyWindow(window);
|
||||
IDirectDraw7_Release(ddraw);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_window_position(void)
|
||||
{
|
||||
EnumDisplayMonitors(NULL, NULL, test_window_position_cb, 0);
|
||||
}
|
||||
|
||||
START_TEST(ddraw7)
|
||||
{
|
||||
DDDEVICEIDENTIFIER2 identifier;
|
||||
|
@ -17818,4 +17879,5 @@ START_TEST(ddraw7)
|
|||
test_surface_format_conversion_alpha();
|
||||
test_compressed_surface_stretch();
|
||||
test_cursor_clipping();
|
||||
test_window_position();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue