diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 49223cde289..82d8e94b5fc 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -13694,6 +13694,43 @@ static void test_window_position(void) EnumDisplayMonitors(NULL, NULL, test_window_position_cb, 0); } +static BOOL CALLBACK test_get_display_mode_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect, + LPARAM lparam) +{ + DDSURFACEDESC surface_desc; + IDirectDraw *ddraw; + HWND window; + HRESULT hr; + BOOL ret; + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + window = create_window(); + ok(!!window, "Failed to create a window.\n"); + + /* Test that DirectDraw doesn't use the device window to determine which monitor to use */ + ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0, + SWP_NOZORDER | SWP_NOSIZE); + ok(ret, "SetWindowPos failed, error %#x.\n", GetLastError()); + + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDraw_GetDisplayMode(ddraw, &surface_desc); + ok(hr == DD_OK, "GetDisplayMode failed, hr %#x.\n", hr); + ok(surface_desc.dwWidth == GetSystemMetrics(SM_CXSCREEN), "Expect width %d, got %d.\n", + GetSystemMetrics(SM_CXSCREEN), surface_desc.dwWidth); + ok(surface_desc.dwHeight == GetSystemMetrics(SM_CYSCREEN), "Expect height %d, got %d.\n", + GetSystemMetrics(SM_CYSCREEN), surface_desc.dwHeight); + + DestroyWindow(window); + IDirectDraw_Release(ddraw); + return TRUE; +} + +static void test_get_display_mode(void) +{ + EnumDisplayMonitors(NULL, NULL, test_get_display_mode_cb, 0); +} + START_TEST(ddraw1) { DDDEVICEIDENTIFIER identifier; @@ -13809,4 +13846,5 @@ START_TEST(ddraw1) test_cursor_clipping(); test_vtbl_protection(); test_window_position(); + test_get_display_mode(); } diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index c4549d95e7c..25cbe8fa921 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -14466,6 +14466,43 @@ static void test_window_position(void) EnumDisplayMonitors(NULL, NULL, test_window_position_cb, 0); } +static BOOL CALLBACK test_get_display_mode_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect, + LPARAM lparam) +{ + DDSURFACEDESC surface_desc; + IDirectDraw2 *ddraw; + HWND window; + HRESULT hr; + BOOL ret; + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + window = create_window(); + ok(!!window, "Failed to create a window.\n"); + + /* Test that DirectDraw doesn't use the device window to determine which monitor to use */ + ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0, + SWP_NOZORDER | SWP_NOSIZE); + ok(ret, "SetWindowPos failed, error %#x.\n", GetLastError()); + + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDraw2_GetDisplayMode(ddraw, &surface_desc); + ok(hr == DD_OK, "GetDisplayMode failed, hr %#x.\n", hr); + ok(surface_desc.dwWidth == GetSystemMetrics(SM_CXSCREEN), "Expect width %d, got %d.\n", + GetSystemMetrics(SM_CXSCREEN), surface_desc.dwWidth); + ok(surface_desc.dwHeight == GetSystemMetrics(SM_CYSCREEN), "Expect height %d, got %d.\n", + GetSystemMetrics(SM_CYSCREEN), surface_desc.dwHeight); + + DestroyWindow(window); + IDirectDraw2_Release(ddraw); + return TRUE; +} + +static void test_get_display_mode(void) +{ + EnumDisplayMonitors(NULL, NULL, test_get_display_mode_cb, 0); +} + START_TEST(ddraw2) { DDDEVICEIDENTIFIER identifier; @@ -14587,4 +14624,5 @@ START_TEST(ddraw2) test_d32_support(); test_cursor_clipping(); test_window_position(); + test_get_display_mode(); } diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 09fe7e1e92b..5dc2b4e7e52 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -17493,6 +17493,43 @@ static void test_window_position(void) EnumDisplayMonitors(NULL, NULL, test_window_position_cb, 0); } +static BOOL CALLBACK test_get_display_mode_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect, + LPARAM lparam) +{ + DDSURFACEDESC2 surface_desc; + IDirectDraw4 *ddraw; + HWND window; + HRESULT hr; + BOOL ret; + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + window = create_window(); + ok(!!window, "Failed to create a window.\n"); + + /* Test that DirectDraw doesn't use the device window to determine which monitor to use */ + ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0, + SWP_NOZORDER | SWP_NOSIZE); + ok(ret, "SetWindowPos failed, error %#x.\n", GetLastError()); + + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDraw4_GetDisplayMode(ddraw, &surface_desc); + ok(hr == DD_OK, "GetDisplayMode failed, hr %#x.\n", hr); + ok(surface_desc.dwWidth == GetSystemMetrics(SM_CXSCREEN), "Expect width %d, got %d.\n", + GetSystemMetrics(SM_CXSCREEN), surface_desc.dwWidth); + ok(surface_desc.dwHeight == GetSystemMetrics(SM_CYSCREEN), "Expect height %d, got %d.\n", + GetSystemMetrics(SM_CYSCREEN), surface_desc.dwHeight); + + DestroyWindow(window); + IDirectDraw4_Release(ddraw); + return TRUE; +} + +static void test_get_display_mode(void) +{ + EnumDisplayMonitors(NULL, NULL, test_get_display_mode_cb, 0); +} + START_TEST(ddraw4) { DDDEVICEIDENTIFIER identifier; @@ -17630,4 +17667,5 @@ START_TEST(ddraw4) test_surface_format_conversion_alpha(); test_cursor_clipping(); test_window_position(); + test_get_display_mode(); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 5cf197998eb..53e47250e3d 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -17728,6 +17728,43 @@ static void test_window_position(void) EnumDisplayMonitors(NULL, NULL, test_window_position_cb, 0); } +static BOOL CALLBACK test_get_display_mode_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect, + LPARAM lparam) +{ + DDSURFACEDESC2 surface_desc; + IDirectDraw7 *ddraw; + HWND window; + HRESULT hr; + BOOL ret; + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + window = create_window(); + ok(!!window, "Failed to create a window.\n"); + + /* Test that DirectDraw doesn't use the device window to determine which monitor to use */ + ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0, + SWP_NOZORDER | SWP_NOSIZE); + ok(ret, "SetWindowPos failed, error %#x.\n", GetLastError()); + + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDraw7_GetDisplayMode(ddraw, &surface_desc); + ok(hr == DD_OK, "GetDisplayMode failed, hr %#x.\n", hr); + ok(surface_desc.dwWidth == GetSystemMetrics(SM_CXSCREEN), "Expect width %d, got %d.\n", + GetSystemMetrics(SM_CXSCREEN), surface_desc.dwWidth); + ok(surface_desc.dwHeight == GetSystemMetrics(SM_CYSCREEN), "Expect height %d, got %d.\n", + GetSystemMetrics(SM_CYSCREEN), surface_desc.dwHeight); + + DestroyWindow(window); + IDirectDraw7_Release(ddraw); + return TRUE; +} + +static void test_get_display_mode(void) +{ + EnumDisplayMonitors(NULL, NULL, test_get_display_mode_cb, 0); +} + START_TEST(ddraw7) { DDDEVICEIDENTIFIER2 identifier; @@ -17880,4 +17917,5 @@ START_TEST(ddraw7) test_compressed_surface_stretch(); test_cursor_clipping(); test_window_position(); + test_get_display_mode(); }