[PATCH 3/5] ddraw/tests: Add mipmap private data tests.
Stefan Dösinger
stefan at codeweavers.com
Sun Mar 16 14:39:00 CDT 2014
---
dlls/ddraw/tests/ddraw4.c | 23 ++++++++++++++++++++++-
dlls/ddraw/tests/ddraw7.c | 23 ++++++++++++++++++++++-
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index f01f812..14c712d 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -6047,13 +6047,15 @@ static void test_surface_attachment(void)
static void test_private_data(void)
{
IDirectDraw4 *ddraw;
- IDirectDrawSurface4 *surface;
+ IDirectDrawSurface4 *surface, *surface2;
DDSURFACEDESC2 surface_desc;
ULONG refcount, refcount2, refcount3;
IUnknown *ptr;
DWORD size = sizeof(ptr);
HRESULT hr;
HWND window;
+ DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, 0};
+ DWORD data[] = {1, 2, 3, 4};
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
@@ -6163,6 +6165,25 @@ static void test_private_data(void)
refcount2 = get_refcount((IUnknown *)ddraw);
ok(refcount2 == refcount - 1, "Got unexpected refcount %u.\n", refcount2);
+ reset_ddsd(&surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_MIPMAPCOUNT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
+ surface_desc.dwHeight = 4;
+ surface_desc.dwWidth = 4;
+ U2(surface_desc).dwMipMapCount = 2;
+ hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
+ ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_GetAttachedSurface(surface, &caps, &surface2);
+ ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
+
+ hr = IDirectDrawSurface4_SetPrivateData(surface, &IID_IDirect3D, data, sizeof(data), 0);
+ ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_GetPrivateData(surface2, &IID_IDirect3D, NULL, NULL);
+ ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
+
+ IDirectDrawSurface4_Release(surface2);
+ IDirectDrawSurface4_Release(surface);
+
refcount = IDirectDraw4_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
DestroyWindow(window);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 1efde27..1514769 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -5902,13 +5902,15 @@ static void test_surface_attachment(void)
static void test_private_data(void)
{
IDirectDraw7 *ddraw;
- IDirectDrawSurface7 *surface;
+ IDirectDrawSurface7 *surface, *surface2;
DDSURFACEDESC2 surface_desc;
ULONG refcount, refcount2, refcount3;
IUnknown *ptr;
DWORD size = sizeof(ptr);
HRESULT hr;
HWND window;
+ DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, 0};
+ DWORD data[] = {1, 2, 3, 4};
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
@@ -6018,6 +6020,25 @@ static void test_private_data(void)
refcount2 = get_refcount((IUnknown *)ddraw);
ok(refcount2 == refcount - 1, "Got unexpected refcount %u.\n", refcount2);
+ reset_ddsd(&surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_MIPMAPCOUNT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
+ surface_desc.dwHeight = 4;
+ surface_desc.dwWidth = 4;
+ U2(surface_desc).dwMipMapCount = 2;
+ hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
+ ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_GetAttachedSurface(surface, &caps, &surface2);
+ ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
+
+ hr = IDirectDrawSurface7_SetPrivateData(surface, &IID_IDirect3D, data, sizeof(data), 0);
+ ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_GetPrivateData(surface2, &IID_IDirect3D, NULL, NULL);
+ ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
+
+ IDirectDrawSurface7_Release(surface2);
+ IDirectDrawSurface7_Release(surface);
+
refcount = IDirectDraw7_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
DestroyWindow(window);
--
1.8.3.2
More information about the wine-patches
mailing list