ddraw/tests: Add a test for the "GDI" surface.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
26db17e90d
commit
5e677beef5
|
@ -12013,6 +12013,96 @@ static void test_killfocus(void)
|
||||||
UnregisterClassA("ddraw_killfocus_wndproc_wc", GetModuleHandleA(NULL));
|
UnregisterClassA("ddraw_killfocus_wndproc_wc", GetModuleHandleA(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_gdi_surface(void)
|
||||||
|
{
|
||||||
|
IDirectDrawSurface *primary, *backbuffer, *gdi_surface;
|
||||||
|
DDSCAPS caps = {DDSCAPS_BACKBUFFER};
|
||||||
|
DDSURFACEDESC surface_desc;
|
||||||
|
IDirectDraw *ddraw;
|
||||||
|
ULONG refcount;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
window = create_window();
|
||||||
|
ddraw = create_ddraw();
|
||||||
|
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||||
|
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* Retrieving the GDI surface requires a primary surface to exist. */
|
||||||
|
gdi_surface = (void *)0xc0dec0de;
|
||||||
|
hr = IDirectDraw_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(!gdi_surface, "Got unexpected surface %p.\n", gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw_FlipToGDISurface(ddraw);
|
||||||
|
todo_wine ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
|
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &primary, NULL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirectDraw_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface_Release(gdi_surface);
|
||||||
|
|
||||||
|
/* Flipping to the GDI surface requires the primary surface to be
|
||||||
|
* flippable. */
|
||||||
|
hr = IDirectDraw_FlipToGDISurface(ddraw);
|
||||||
|
todo_wine ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirectDrawSurface_Release(primary);
|
||||||
|
|
||||||
|
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
|
||||||
|
U5(surface_desc).dwBackBufferCount = 1;
|
||||||
|
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &primary, NULL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDrawSurface_GetAttachedSurface(primary, &caps, &backbuffer);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(backbuffer != primary, "Got unexpected backbuffer %p.\n", backbuffer);
|
||||||
|
|
||||||
|
hr = IDirectDraw_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDrawSurface_Flip(primary, NULL, DDFLIP_WAIT);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDraw_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
todo_wine ok(gdi_surface == backbuffer || broken(gdi_surface == primary),
|
||||||
|
"Got unexpected surface %p, expected %p.\n", gdi_surface, backbuffer);
|
||||||
|
IDirectDrawSurface_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw_FlipToGDISurface(ddraw);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirectDraw_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw_FlipToGDISurface(ddraw);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirectDrawSurface_Release(backbuffer);
|
||||||
|
IDirectDrawSurface_Release(primary);
|
||||||
|
|
||||||
|
refcount = IDirectDraw_Release(ddraw);
|
||||||
|
ok(!refcount, "%u references left.\n", refcount);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(ddraw1)
|
START_TEST(ddraw1)
|
||||||
{
|
{
|
||||||
DDDEVICEIDENTIFIER identifier;
|
DDDEVICEIDENTIFIER identifier;
|
||||||
|
@ -12119,4 +12209,5 @@ START_TEST(ddraw1)
|
||||||
test_viewport();
|
test_viewport();
|
||||||
test_find_device();
|
test_find_device();
|
||||||
test_killfocus();
|
test_killfocus();
|
||||||
|
test_gdi_surface();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13314,6 +13314,96 @@ static void test_killfocus(void)
|
||||||
UnregisterClassA("ddraw_killfocus_wndproc_wc", GetModuleHandleA(NULL));
|
UnregisterClassA("ddraw_killfocus_wndproc_wc", GetModuleHandleA(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_gdi_surface(void)
|
||||||
|
{
|
||||||
|
IDirectDrawSurface *primary, *backbuffer, *gdi_surface;
|
||||||
|
DDSCAPS caps = {DDSCAPS_BACKBUFFER};
|
||||||
|
DDSURFACEDESC surface_desc;
|
||||||
|
IDirectDraw2 *ddraw;
|
||||||
|
ULONG refcount;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
window = create_window();
|
||||||
|
ddraw = create_ddraw();
|
||||||
|
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||||
|
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* Retrieving the GDI surface requires a primary surface to exist. */
|
||||||
|
gdi_surface = (void *)0xc0dec0de;
|
||||||
|
hr = IDirectDraw2_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(!gdi_surface, "Got unexpected surface %p.\n", gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw2_FlipToGDISurface(ddraw);
|
||||||
|
todo_wine ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
|
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &primary, NULL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirectDraw2_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface_Release(gdi_surface);
|
||||||
|
|
||||||
|
/* Flipping to the GDI surface requires the primary surface to be
|
||||||
|
* flippable. */
|
||||||
|
hr = IDirectDraw2_FlipToGDISurface(ddraw);
|
||||||
|
todo_wine ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirectDrawSurface_Release(primary);
|
||||||
|
|
||||||
|
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
|
||||||
|
U5(surface_desc).dwBackBufferCount = 1;
|
||||||
|
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &primary, NULL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDrawSurface_GetAttachedSurface(primary, &caps, &backbuffer);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(backbuffer != primary, "Got unexpected backbuffer %p.\n", backbuffer);
|
||||||
|
|
||||||
|
hr = IDirectDraw2_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDrawSurface_Flip(primary, NULL, DDFLIP_WAIT);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDraw2_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
todo_wine ok(gdi_surface == backbuffer || broken(gdi_surface == primary),
|
||||||
|
"Got unexpected surface %p, expected %p.\n", gdi_surface, backbuffer);
|
||||||
|
IDirectDrawSurface_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw2_FlipToGDISurface(ddraw);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirectDraw2_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw2_FlipToGDISurface(ddraw);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirectDrawSurface_Release(backbuffer);
|
||||||
|
IDirectDrawSurface_Release(primary);
|
||||||
|
|
||||||
|
refcount = IDirectDraw2_Release(ddraw);
|
||||||
|
ok(!refcount, "%u references left.\n", refcount);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(ddraw2)
|
START_TEST(ddraw2)
|
||||||
{
|
{
|
||||||
DDDEVICEIDENTIFIER identifier;
|
DDDEVICEIDENTIFIER identifier;
|
||||||
|
@ -13428,4 +13518,5 @@ START_TEST(ddraw2)
|
||||||
test_viewport();
|
test_viewport();
|
||||||
test_find_device();
|
test_find_device();
|
||||||
test_killfocus();
|
test_killfocus();
|
||||||
|
test_gdi_surface();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15519,6 +15519,96 @@ static void test_sysmem_draw(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_gdi_surface(void)
|
||||||
|
{
|
||||||
|
IDirectDrawSurface4 *primary, *backbuffer, *gdi_surface;
|
||||||
|
DDSCAPS2 caps = {DDSCAPS_BACKBUFFER, 0, 0, {0}};
|
||||||
|
DDSURFACEDESC2 surface_desc;
|
||||||
|
IDirectDraw4 *ddraw;
|
||||||
|
ULONG refcount;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
window = create_window();
|
||||||
|
ddraw = create_ddraw();
|
||||||
|
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||||
|
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* Retrieving the GDI surface requires a primary surface to exist. */
|
||||||
|
gdi_surface = (void *)0xc0dec0de;
|
||||||
|
hr = IDirectDraw4_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(!gdi_surface, "Got unexpected surface %p.\n", gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw4_FlipToGDISurface(ddraw);
|
||||||
|
todo_wine ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
|
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &primary, NULL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirectDraw4_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface4_Release(gdi_surface);
|
||||||
|
|
||||||
|
/* Flipping to the GDI surface requires the primary surface to be
|
||||||
|
* flippable. */
|
||||||
|
hr = IDirectDraw4_FlipToGDISurface(ddraw);
|
||||||
|
todo_wine ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirectDrawSurface4_Release(primary);
|
||||||
|
|
||||||
|
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
|
||||||
|
U5(surface_desc).dwBackBufferCount = 1;
|
||||||
|
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &primary, NULL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDrawSurface4_GetAttachedSurface(primary, &caps, &backbuffer);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(backbuffer != primary, "Got unexpected backbuffer %p.\n", backbuffer);
|
||||||
|
|
||||||
|
hr = IDirectDraw4_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface4_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDrawSurface4_Flip(primary, NULL, DDFLIP_WAIT);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDraw4_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
todo_wine ok(gdi_surface == backbuffer || broken(gdi_surface == primary),
|
||||||
|
"Got unexpected surface %p, expected %p.\n", gdi_surface, backbuffer);
|
||||||
|
IDirectDrawSurface4_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw4_FlipToGDISurface(ddraw);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirectDraw4_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface4_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw4_FlipToGDISurface(ddraw);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirectDrawSurface4_Release(backbuffer);
|
||||||
|
IDirectDrawSurface4_Release(primary);
|
||||||
|
|
||||||
|
refcount = IDirectDraw4_Release(ddraw);
|
||||||
|
ok(!refcount, "%u references left.\n", refcount);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(ddraw4)
|
START_TEST(ddraw4)
|
||||||
{
|
{
|
||||||
DDDEVICEIDENTIFIER identifier;
|
DDDEVICEIDENTIFIER identifier;
|
||||||
|
@ -15648,4 +15738,5 @@ START_TEST(ddraw4)
|
||||||
test_find_device();
|
test_find_device();
|
||||||
test_killfocus();
|
test_killfocus();
|
||||||
test_sysmem_draw();
|
test_sysmem_draw();
|
||||||
|
test_gdi_surface();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15227,6 +15227,96 @@ static void test_sysmem_draw(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_gdi_surface(void)
|
||||||
|
{
|
||||||
|
IDirectDrawSurface7 *primary, *backbuffer, *gdi_surface;
|
||||||
|
DDSCAPS2 caps = {DDSCAPS_BACKBUFFER, 0, 0, {0}};
|
||||||
|
DDSURFACEDESC2 surface_desc;
|
||||||
|
IDirectDraw7 *ddraw;
|
||||||
|
ULONG refcount;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
window = create_window();
|
||||||
|
ddraw = create_ddraw();
|
||||||
|
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* Retrieving the GDI surface requires a primary surface to exist. */
|
||||||
|
gdi_surface = (void *)0xc0dec0de;
|
||||||
|
hr = IDirectDraw7_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(!gdi_surface, "Got unexpected surface %p.\n", gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw7_FlipToGDISurface(ddraw);
|
||||||
|
todo_wine ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
|
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &primary, NULL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirectDraw7_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface7_Release(gdi_surface);
|
||||||
|
|
||||||
|
/* Flipping to the GDI surface requires the primary surface to be
|
||||||
|
* flippable. */
|
||||||
|
hr = IDirectDraw7_FlipToGDISurface(ddraw);
|
||||||
|
todo_wine ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirectDrawSurface7_Release(primary);
|
||||||
|
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
|
||||||
|
U5(surface_desc).dwBackBufferCount = 1;
|
||||||
|
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &primary, NULL);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDrawSurface7_GetAttachedSurface(primary, &caps, &backbuffer);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(backbuffer != primary, "Got unexpected backbuffer %p.\n", backbuffer);
|
||||||
|
|
||||||
|
hr = IDirectDraw7_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface7_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDrawSurface7_Flip(primary, NULL, DDFLIP_WAIT);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDraw7_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
todo_wine ok(gdi_surface == backbuffer || broken(gdi_surface == primary),
|
||||||
|
"Got unexpected surface %p, expected %p.\n", gdi_surface, backbuffer);
|
||||||
|
IDirectDrawSurface7_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw7_FlipToGDISurface(ddraw);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirectDraw7_GetGDISurface(ddraw, &gdi_surface);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok(gdi_surface == primary, "Got unexpected surface %p, expected %p.\n", gdi_surface, primary);
|
||||||
|
IDirectDrawSurface7_Release(gdi_surface);
|
||||||
|
|
||||||
|
hr = IDirectDraw7_FlipToGDISurface(ddraw);
|
||||||
|
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirectDrawSurface7_Release(backbuffer);
|
||||||
|
IDirectDrawSurface7_Release(primary);
|
||||||
|
|
||||||
|
refcount = IDirectDraw7_Release(ddraw);
|
||||||
|
ok(!refcount, "%u references left.\n", refcount);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(ddraw7)
|
START_TEST(ddraw7)
|
||||||
{
|
{
|
||||||
DDDEVICEIDENTIFIER2 identifier;
|
DDDEVICEIDENTIFIER2 identifier;
|
||||||
|
@ -15367,4 +15457,5 @@ START_TEST(ddraw7)
|
||||||
test_color_vertex();
|
test_color_vertex();
|
||||||
test_killfocus();
|
test_killfocus();
|
||||||
test_sysmem_draw();
|
test_sysmem_draw();
|
||||||
|
test_gdi_surface();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue