Commit f637c229 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw/tests: Add a test for primary surface capabilities.

parent 8797a9ed
...@@ -3322,6 +3322,162 @@ done: ...@@ -3322,6 +3322,162 @@ done:
DestroyWindow(window); DestroyWindow(window);
} }
static void test_primary_caps(void)
{
const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
IDirectDrawSurface *surface;
DDSURFACEDESC surface_desc;
IDirectDraw *ddraw;
unsigned int i;
ULONG refcount;
HWND window;
HRESULT hr;
static const struct
{
DWORD coop_level;
DWORD caps_in;
DWORD back_buffer_count;
HRESULT hr;
DWORD caps_out;
}
test_data[] =
{
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE,
~0u,
DD_OK,
DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_TEXTURE,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER,
~0u,
DD_OK,
DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
0,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
1,
DDERR_NOEXCLUSIVEMODE,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
0,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
1,
DD_OK,
DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP | DDSCAPS_COMPLEX,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_FRONTBUFFER,
1,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_BACKBUFFER,
1,
DDERR_INVALIDCAPS,
~0u,
},
};
if (!(ddraw = create_ddraw()))
{
skip("Failed to create a ddraw object, skipping test.\n");
return;
}
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
{
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, test_data[i].coop_level);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS;
if (test_data[i].back_buffer_count != ~0u)
surface_desc.dwFlags |= DDSD_BACKBUFFERCOUNT;
surface_desc.ddsCaps.dwCaps = test_data[i].caps_in;
surface_desc.dwBackBufferCount = test_data[i].back_buffer_count;
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
ok((surface_desc.ddsCaps.dwCaps & ~placement) == test_data[i].caps_out,
"Test %u: Got unexpected caps %#x, expected %#x.\n",
i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
IDirectDrawSurface_Release(surface);
}
refcount = IDirectDraw_Release(ddraw);
ok(refcount == 0, "The ddraw object was not properly freed, refcount %u.\n", refcount);
DestroyWindow(window);
}
static void test_surface_lock(void) static void test_surface_lock(void)
{ {
IDirectDraw *ddraw; IDirectDraw *ddraw;
...@@ -3741,6 +3897,7 @@ START_TEST(ddraw1) ...@@ -3741,6 +3897,7 @@ START_TEST(ddraw1)
test_coop_level_activateapp(); test_coop_level_activateapp();
test_unsupported_formats(); test_unsupported_formats();
test_rt_caps(); test_rt_caps();
test_primary_caps();
test_surface_lock(); test_surface_lock();
test_surface_discard(); test_surface_discard();
test_flip(); test_flip();
......
...@@ -4004,6 +4004,162 @@ done: ...@@ -4004,6 +4004,162 @@ done:
DestroyWindow(window); DestroyWindow(window);
} }
static void test_primary_caps(void)
{
const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
IDirectDrawSurface *surface;
DDSURFACEDESC surface_desc;
IDirectDraw2 *ddraw;
unsigned int i;
ULONG refcount;
HWND window;
HRESULT hr;
static const struct
{
DWORD coop_level;
DWORD caps_in;
DWORD back_buffer_count;
HRESULT hr;
DWORD caps_out;
}
test_data[] =
{
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE,
~0u,
DD_OK,
DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_TEXTURE,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
0,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
1,
DDERR_NOEXCLUSIVEMODE,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
0,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
1,
DD_OK,
DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP | DDSCAPS_COMPLEX,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_FRONTBUFFER,
1,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_BACKBUFFER,
1,
DDERR_INVALIDCAPS,
~0u,
},
};
if (!(ddraw = create_ddraw()))
{
skip("Failed to create a ddraw object, skipping test.\n");
return;
}
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
{
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, test_data[i].coop_level);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS;
if (test_data[i].back_buffer_count != ~0u)
surface_desc.dwFlags |= DDSD_BACKBUFFERCOUNT;
surface_desc.ddsCaps.dwCaps = test_data[i].caps_in;
surface_desc.dwBackBufferCount = test_data[i].back_buffer_count;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
ok((surface_desc.ddsCaps.dwCaps & ~placement) == test_data[i].caps_out,
"Test %u: Got unexpected caps %#x, expected %#x.\n",
i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
IDirectDrawSurface_Release(surface);
}
refcount = IDirectDraw2_Release(ddraw);
ok(refcount == 0, "The ddraw object was not properly freed, refcount %u.\n", refcount);
DestroyWindow(window);
}
static void test_surface_lock(void) static void test_surface_lock(void)
{ {
IDirectDraw2 *ddraw; IDirectDraw2 *ddraw;
...@@ -4735,6 +4891,7 @@ START_TEST(ddraw2) ...@@ -4735,6 +4891,7 @@ START_TEST(ddraw2)
test_coop_level_activateapp(); test_coop_level_activateapp();
test_unsupported_formats(); test_unsupported_formats();
test_rt_caps(); test_rt_caps();
test_primary_caps();
test_surface_lock(); test_surface_lock();
test_surface_discard(); test_surface_discard();
test_flip(); test_flip();
......
...@@ -4569,6 +4569,162 @@ done: ...@@ -4569,6 +4569,162 @@ done:
DestroyWindow(window); DestroyWindow(window);
} }
static void test_primary_caps(void)
{
const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
IDirectDrawSurface4 *surface;
DDSURFACEDESC2 surface_desc;
IDirectDraw4 *ddraw;
unsigned int i;
ULONG refcount;
HWND window;
HRESULT hr;
static const struct
{
DWORD coop_level;
DWORD caps_in;
DWORD back_buffer_count;
HRESULT hr;
DWORD caps_out;
}
test_data[] =
{
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE,
~0u,
DD_OK,
DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_TEXTURE,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
0,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
1,
DDERR_NOEXCLUSIVEMODE,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
0,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
1,
DD_OK,
DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP | DDSCAPS_COMPLEX,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_FRONTBUFFER,
1,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_BACKBUFFER,
1,
DDERR_INVALIDCAPS,
~0u,
},
};
if (!(ddraw = create_ddraw()))
{
skip("Failed to create a ddraw object, skipping test.\n");
return;
}
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
{
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, test_data[i].coop_level);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS;
if (test_data[i].back_buffer_count != ~0u)
surface_desc.dwFlags |= DDSD_BACKBUFFERCOUNT;
surface_desc.ddsCaps.dwCaps = test_data[i].caps_in;
surface_desc.dwBackBufferCount = test_data[i].back_buffer_count;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
ok((surface_desc.ddsCaps.dwCaps & ~placement) == test_data[i].caps_out,
"Test %u: Got unexpected caps %#x, expected %#x.\n",
i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
IDirectDrawSurface4_Release(surface);
}
refcount = IDirectDraw4_Release(ddraw);
ok(refcount == 0, "The ddraw object was not properly freed, refcount %u.\n", refcount);
DestroyWindow(window);
}
static void test_surface_lock(void) static void test_surface_lock(void)
{ {
IDirectDraw4 *ddraw; IDirectDraw4 *ddraw;
...@@ -5342,6 +5498,7 @@ START_TEST(ddraw4) ...@@ -5342,6 +5498,7 @@ START_TEST(ddraw4)
test_block_formats_creation(); test_block_formats_creation();
test_unsupported_formats(); test_unsupported_formats();
test_rt_caps(); test_rt_caps();
test_primary_caps();
test_surface_lock(); test_surface_lock();
test_surface_discard(); test_surface_discard();
test_flip(); test_flip();
......
...@@ -4390,6 +4390,162 @@ done: ...@@ -4390,6 +4390,162 @@ done:
DestroyWindow(window); DestroyWindow(window);
} }
static void test_primary_caps(void)
{
const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
IDirectDrawSurface7 *surface;
DDSURFACEDESC2 surface_desc;
IDirectDraw7 *ddraw;
unsigned int i;
ULONG refcount;
HWND window;
HRESULT hr;
static const struct
{
DWORD coop_level;
DWORD caps_in;
DWORD back_buffer_count;
HRESULT hr;
DWORD caps_out;
}
test_data[] =
{
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE,
~0u,
DD_OK,
DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_TEXTURE,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
~0u,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
0,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_NORMAL,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
1,
DDERR_NOEXCLUSIVEMODE,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
0,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP,
1,
DD_OK,
DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP | DDSCAPS_COMPLEX,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_FRONTBUFFER,
1,
DDERR_INVALIDCAPS,
~0u,
},
{
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN,
DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_BACKBUFFER,
1,
DDERR_INVALIDCAPS,
~0u,
},
};
if (!(ddraw = create_ddraw()))
{
skip("Failed to create a ddraw object, skipping test.\n");
return;
}
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
{
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, test_data[i].coop_level);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS;
if (test_data[i].back_buffer_count != ~0u)
surface_desc.dwFlags |= DDSD_BACKBUFFERCOUNT;
surface_desc.ddsCaps.dwCaps = test_data[i].caps_in;
surface_desc.dwBackBufferCount = test_data[i].back_buffer_count;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
ok((surface_desc.ddsCaps.dwCaps & ~placement) == test_data[i].caps_out,
"Test %u: Got unexpected caps %#x, expected %#x.\n",
i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
IDirectDrawSurface7_Release(surface);
}
refcount = IDirectDraw7_Release(ddraw);
ok(refcount == 0, "The ddraw object was not properly freed, refcount %u.\n", refcount);
DestroyWindow(window);
}
static void test_surface_lock(void) static void test_surface_lock(void)
{ {
IDirectDraw7 *ddraw; IDirectDraw7 *ddraw;
...@@ -5238,6 +5394,7 @@ START_TEST(ddraw7) ...@@ -5238,6 +5394,7 @@ START_TEST(ddraw7)
test_block_formats_creation(); test_block_formats_creation();
test_unsupported_formats(); test_unsupported_formats();
test_rt_caps(); test_rt_caps();
test_primary_caps();
test_surface_lock(); test_surface_lock();
test_surface_discard(); test_surface_discard();
test_flip(); test_flip();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment