ddraw/tests: Add a test for mipmap palettes.

This commit is contained in:
Stefan Dösinger 2014-04-24 14:36:10 +02:00 committed by Alexandre Julliard
parent 590582e6bc
commit e2bf5163ec
4 changed files with 420 additions and 0 deletions

View file

@ -4587,6 +4587,103 @@ static void test_mipmap_lock(void)
DestroyWindow(window);
}
static void test_palette_complex(void)
{
IDirectDrawSurface *surface, *mipmap, *tmp;
DDSURFACEDESC surface_desc;
IDirectDraw *ddraw;
IDirectDrawPalette *palette, *palette2;
ULONG refcount;
HWND window;
HRESULT hr;
DDSCAPS caps = {DDSCAPS_COMPLEX};
DDCAPS hal_caps;
PALETTEENTRY palette_entries[256];
unsigned int i;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps));
hal_caps.dwSize = sizeof(hal_caps);
hr = IDirectDraw_GetCaps(ddraw, &hal_caps, NULL);
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
{
skip("Mipmapped textures not supported, skipping mipmap palette test.\n");
IDirectDraw_Release(ddraw);
DestroyWindow(window);
return;
}
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
surface_desc.dwWidth = 128;
surface_desc.dwHeight = 128;
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
surface_desc.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 8;
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
palette_entries, &palette, NULL);
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
palette2 = (void *)0xdeadbeef;
hr = IDirectDrawSurface_GetPalette(surface, &palette2);
ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x.\n", hr);
ok(!palette2, "Got unexpected palette %p.\n", palette2);
hr = IDirectDrawSurface_SetPalette(surface, palette);
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
hr = IDirectDrawSurface_GetPalette(surface, &palette2);
ok(SUCCEEDED(hr), "Failed to get palette, hr %#x.\n", hr);
ok(palette == palette2, "Got unexpected palette %p.\n", palette2);
IDirectDrawPalette_Release(palette2);
mipmap = surface;
IDirectDrawSurface_AddRef(mipmap);
for (i = 0; i < 7; ++i)
{
hr = IDirectDrawSurface_GetAttachedSurface(mipmap, &caps, &tmp);
ok(SUCCEEDED(hr), "Failed to get attached surface, i %u, hr %#x.\n", i, hr);
palette2 = (void *)0xdeadbeef;
hr = IDirectDrawSurface_GetPalette(tmp, &palette2);
ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x, i %u.\n", hr, i);
ok(!palette2, "Got unexpected palette %p, i %u.\n", palette2, i);
hr = IDirectDrawSurface_SetPalette(tmp, palette);
ok(SUCCEEDED(hr), "Failed to set palette, i %u, hr %#x.\n", i, hr);
hr = IDirectDrawSurface_GetPalette(tmp, &palette2);
ok(SUCCEEDED(hr), "Failed to get palette, i %u, hr %#x.\n", i, hr);
ok(palette == palette2, "Got unexpected palette %p.\n", palette2);
IDirectDrawPalette_Release(palette2);
IDirectDrawSurface_Release(mipmap);
mipmap = tmp;
}
hr = IDirectDrawSurface_GetAttachedSurface(mipmap, &caps, &tmp);
ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface_Release(mipmap);
refcount = IDirectDrawSurface_Release(surface);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
refcount = IDirectDrawPalette_Release(palette);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
refcount = IDirectDraw_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
DestroyWindow(window);
}
START_TEST(ddraw1)
{
IDirectDraw *ddraw;
@ -4632,4 +4729,5 @@ START_TEST(ddraw1)
test_pixel_format();
test_create_surface_pitch();
test_mipmap_lock();
test_palette_complex();
}

View file

@ -5697,6 +5697,107 @@ static void test_mipmap_lock(void)
DestroyWindow(window);
}
static void test_palette_complex(void)
{
IDirectDrawSurface *surface1;
IDirectDrawSurface2 *surface, *mipmap, *tmp;
DDSURFACEDESC surface_desc;
IDirectDraw2 *ddraw;
IDirectDrawPalette *palette, *palette2;
ULONG refcount;
HWND window;
HRESULT hr;
DDSCAPS caps = {DDSCAPS_COMPLEX};
DDCAPS hal_caps;
PALETTEENTRY palette_entries[256];
unsigned int i;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps));
hal_caps.dwSize = sizeof(hal_caps);
hr = IDirectDraw2_GetCaps(ddraw, &hal_caps, NULL);
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
{
skip("Mipmapped textures not supported, skipping mipmap palette test.\n");
IDirectDraw2_Release(ddraw);
DestroyWindow(window);
return;
}
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
surface_desc.dwWidth = 128;
surface_desc.dwHeight = 128;
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
surface_desc.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 8;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface1, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
hr = IDirectDrawSurface_QueryInterface(surface1, &IID_IDirectDrawSurface2, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get IDirectDrawSurface2 interface, hr %#x.\n", hr);
IDirectDrawSurface_Release(surface1);
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw2_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
palette_entries, &palette, NULL);
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
palette2 = (void *)0xdeadbeef;
hr = IDirectDrawSurface2_GetPalette(surface, &palette2);
ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x.\n", hr);
ok(!palette2, "Got unexpected palette %p.\n", palette2);
hr = IDirectDrawSurface2_SetPalette(surface, palette);
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
hr = IDirectDrawSurface2_GetPalette(surface, &palette2);
ok(SUCCEEDED(hr), "Failed to get palette, hr %#x.\n", hr);
ok(palette == palette2, "Got unexpected palette %p.\n", palette2);
IDirectDrawPalette_Release(palette2);
mipmap = surface;
IDirectDrawSurface2_AddRef(mipmap);
for (i = 0; i < 7; ++i)
{
hr = IDirectDrawSurface2_GetAttachedSurface(mipmap, &caps, &tmp);
ok(SUCCEEDED(hr), "Failed to get attached surface, i %u, hr %#x.\n", i, hr);
palette2 = (void *)0xdeadbeef;
hr = IDirectDrawSurface2_GetPalette(tmp, &palette2);
ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x, i %u.\n", hr, i);
ok(!palette2, "Got unexpected palette %p, i %u.\n", palette2, i);
hr = IDirectDrawSurface2_SetPalette(tmp, palette);
ok(SUCCEEDED(hr), "Failed to set palette, i %u, hr %#x.\n", i, hr);
hr = IDirectDrawSurface2_GetPalette(tmp, &palette2);
ok(SUCCEEDED(hr), "Failed to get palette, i %u, hr %#x.\n", i, hr);
ok(palette == palette2, "Got unexpected palette %p.\n", palette2);
IDirectDrawPalette_Release(palette2);
IDirectDrawSurface2_Release(mipmap);
mipmap = tmp;
}
hr = IDirectDrawSurface2_GetAttachedSurface(mipmap, &caps, &tmp);
ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface2_Release(mipmap);
refcount = IDirectDrawSurface2_Release(surface);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
refcount = IDirectDrawPalette_Release(palette);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
refcount = IDirectDraw2_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
DestroyWindow(window);
}
START_TEST(ddraw2)
{
IDirectDraw2 *ddraw;
@ -5748,4 +5849,5 @@ START_TEST(ddraw2)
test_pixel_format();
test_create_surface_pitch();
test_mipmap_lock();
test_palette_complex();
}

View file

@ -6562,6 +6562,103 @@ static void test_mipmap_lock(void)
DestroyWindow(window);
}
static void test_palette_complex(void)
{
IDirectDrawSurface4 *surface, *mipmap, *tmp;
DDSURFACEDESC2 surface_desc;
IDirectDraw4 *ddraw;
IDirectDrawPalette *palette, *palette2;
ULONG refcount;
HWND window;
HRESULT hr;
DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, 0};
DDCAPS hal_caps;
PALETTEENTRY palette_entries[256];
unsigned int i;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps));
hal_caps.dwSize = sizeof(hal_caps);
hr = IDirectDraw4_GetCaps(ddraw, &hal_caps, NULL);
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
{
skip("Mipmapped textures not supported, skipping mipmap palette test.\n");
IDirectDraw4_Release(ddraw);
DestroyWindow(window);
return;
}
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
surface_desc.dwWidth = 128;
surface_desc.dwHeight = 128;
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 8;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw4_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
palette_entries, &palette, NULL);
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
palette2 = (void *)0xdeadbeef;
hr = IDirectDrawSurface4_GetPalette(surface, &palette2);
ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x.\n", hr);
ok(!palette2, "Got unexpected palette %p.\n", palette2);
hr = IDirectDrawSurface4_SetPalette(surface, palette);
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
hr = IDirectDrawSurface4_GetPalette(surface, &palette2);
ok(SUCCEEDED(hr), "Failed to get palette, hr %#x.\n", hr);
ok(palette == palette2, "Got unexpected palette %p.\n", palette2);
IDirectDrawPalette_Release(palette2);
mipmap = surface;
IDirectDrawSurface4_AddRef(mipmap);
for (i = 0; i < 7; ++i)
{
hr = IDirectDrawSurface4_GetAttachedSurface(mipmap, &caps, &tmp);
ok(SUCCEEDED(hr), "Failed to get attached surface, i %u, hr %#x.\n", i, hr);
palette2 = (void *)0xdeadbeef;
hr = IDirectDrawSurface4_GetPalette(tmp, &palette2);
ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x, i %u.\n", hr, i);
ok(!palette2, "Got unexpected palette %p, i %u.\n", palette2, i);
hr = IDirectDrawSurface4_SetPalette(tmp, palette);
ok(SUCCEEDED(hr), "Failed to set palette, i %u, hr %#x.\n", i, hr);
hr = IDirectDrawSurface4_GetPalette(tmp, &palette2);
ok(SUCCEEDED(hr), "Failed to get palette, i %u, hr %#x.\n", i, hr);
ok(palette == palette2, "Got unexpected palette %p.\n", palette2);
IDirectDrawPalette_Release(palette2);
IDirectDrawSurface4_Release(mipmap);
mipmap = tmp;
}
hr = IDirectDrawSurface4_GetAttachedSurface(mipmap, &caps, &tmp);
ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface4_Release(mipmap);
refcount = IDirectDrawSurface4_Release(surface);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
refcount = IDirectDrawPalette_Release(palette);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
refcount = IDirectDraw4_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
DestroyWindow(window);
}
START_TEST(ddraw4)
{
IDirectDraw4 *ddraw;
@ -6619,4 +6716,5 @@ START_TEST(ddraw4)
test_pixel_format();
test_create_surface_pitch();
test_mipmap_lock();
test_palette_complex();
}

View file

@ -6417,6 +6417,127 @@ static void test_mipmap_lock(void)
DestroyWindow(window);
}
static void test_palette_complex(void)
{
IDirectDrawSurface7 *surface, *mipmap, *tmp;
DDSURFACEDESC2 surface_desc;
IDirectDraw7 *ddraw;
IDirectDrawPalette *palette, *palette2;
ULONG refcount;
HWND window;
HRESULT hr;
DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, 0};
DDCAPS hal_caps;
PALETTEENTRY palette_entries[256];
unsigned int i;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps));
hal_caps.dwSize = sizeof(hal_caps);
hr = IDirectDraw7_GetCaps(ddraw, &hal_caps, NULL);
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
{
skip("Mipmapped textures not supported, skipping mipmap palette test.\n");
IDirectDraw7_Release(ddraw);
DestroyWindow(window);
return;
}
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
surface_desc.dwWidth = 128;
surface_desc.dwHeight = 128;
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 8;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw7_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
palette_entries, &palette, NULL);
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
palette2 = (void *)0xdeadbeef;
hr = IDirectDrawSurface7_GetPalette(surface, &palette2);
ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x.\n", hr);
ok(!palette2, "Got unexpected palette %p.\n", palette2);
hr = IDirectDrawSurface7_SetPalette(surface, palette);
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
hr = IDirectDrawSurface7_GetPalette(surface, &palette2);
ok(SUCCEEDED(hr), "Failed to get palette, hr %#x.\n", hr);
ok(palette == palette2, "Got unexpected palette %p.\n", palette2);
IDirectDrawPalette_Release(palette2);
mipmap = surface;
IDirectDrawSurface7_AddRef(mipmap);
for (i = 0; i < 7; ++i)
{
hr = IDirectDrawSurface7_GetAttachedSurface(mipmap, &caps, &tmp);
ok(SUCCEEDED(hr), "Failed to get attached surface, i %u, hr %#x.\n", i, hr);
palette2 = (void *)0xdeadbeef;
hr = IDirectDrawSurface7_GetPalette(tmp, &palette2);
ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x, i %u.\n", hr, i);
ok(!palette2, "Got unexpected palette %p, i %u.\n", palette2, i);
hr = IDirectDrawSurface7_SetPalette(tmp, palette);
ok(hr == DDERR_NOTONMIPMAPSUBLEVEL, "Got unexpected hr %#x, i %u.\n", hr, i);
hr = IDirectDrawSurface7_GetPalette(tmp, &palette2);
ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x, i %u.\n", hr, i);
ok(!palette2, "Got unexpected palette %p, i %u.\n", palette2, i);
IDirectDrawSurface7_Release(mipmap);
mipmap = tmp;
}
hr = IDirectDrawSurface7_GetAttachedSurface(mipmap, &caps, &tmp);
ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface7_Release(mipmap);
refcount = IDirectDrawSurface7_Release(surface);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
/* Test DDERR_INVALIDPIXELFORMAT vs DDERR_NOTONMIPMAPSUBLEVEL. */
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
surface_desc.dwWidth = 128;
surface_desc.dwHeight = 128;
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
hr = IDirectDrawSurface7_GetAttachedSurface(surface, &caps, &mipmap);
ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
hr = IDirectDrawSurface7_SetPalette(mipmap, palette);
ok(hr == DDERR_NOTONMIPMAPSUBLEVEL, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface7_Release(mipmap);
refcount = IDirectDrawSurface7_Release(surface);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
refcount = IDirectDrawPalette_Release(palette);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
refcount = IDirectDraw7_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
DestroyWindow(window);
}
START_TEST(ddraw7)
{
HMODULE module = GetModuleHandleA("ddraw.dll");
@ -6481,4 +6602,5 @@ START_TEST(ddraw7)
test_pixel_format();
test_create_surface_pitch();
test_mipmap_lock();
test_palette_complex();
}