=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: d3d8/tests: Add a test for sub resource private data.
Alexandre Julliard
julliard at winehq.org
Mon Feb 17 13:45:16 CST 2014
Module: wine
Branch: master
Commit: 69c4f41646fce7c467dc542b59ca8550e06f99a5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=69c4f41646fce7c467dc542b59ca8550e06f99a5
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Sun Feb 16 22:42:22 2014 +0100
d3d8/tests: Add a test for sub resource private data.
---
dlls/d3d8/tests/device.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 78f6773..c7493c7 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -4148,13 +4148,15 @@ static void test_lockrect_invalid(void)
static void test_private_data(void)
{
ULONG refcount, expected_refcount;
- IDirect3DSurface8 *surface;
+ IDirect3DTexture8 *texture;
+ IDirect3DSurface8 *surface, *surface2;
IDirect3DDevice8 *device;
IDirect3D8 *d3d8;
IUnknown *ptr;
HWND window;
HRESULT hr;
DWORD size;
+ DWORD data[4] = {1, 2, 3, 4};
if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION)))
{
@@ -4225,6 +4227,39 @@ static void test_private_data(void)
refcount = get_refcount((IUnknown *)device);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
+ hr = IDirect3DDevice8_CreateTexture(device, 4, 4, 2, 0, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &texture);
+ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ hr = IDirect3DTexture8_GetSurfaceLevel(texture, 0, &surface);
+ ok(SUCCEEDED(hr), "Failed to get texture level 0, hr %#x.\n", hr);
+ hr = IDirect3DTexture8_GetSurfaceLevel(texture, 1, &surface2);
+ ok(SUCCEEDED(hr), "Failed to get texture level 1, hr %#x.\n", hr);
+
+ hr = IDirect3DTexture8_SetPrivateData(texture, &IID_IDirect3DVertexBuffer8, data, sizeof(data), 0);
+ ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
+
+ memset(data, 0, sizeof(data));
+ size = sizeof(data);
+ hr = IDirect3DSurface8_GetPrivateData(surface, &IID_IDirect3DVertexBuffer8, data, &size);
+ ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DTexture8_GetPrivateData(texture, &IID_IDirect3DVertexBuffer8, data, &size);
+ ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr);
+ ok(data[0] == 1 && data[1] == 2 && data[2] == 3 && data[3] == 4,
+ "Got unexpected private data: %u, %u, %u, %u.\n", data[0], data[1], data[2], data[3]);
+
+ hr = IDirect3DTexture8_FreePrivateData(texture, &IID_IDirect3DVertexBuffer8);
+ ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
+
+ hr = IDirect3DSurface8_SetPrivateData(surface, &IID_IDirect3DVertexBuffer8, data, sizeof(data), 0);
+ ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
+ hr = IDirect3DSurface8_GetPrivateData(surface2, &IID_IDirect3DVertexBuffer8, data, &size);
+ ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DSurface8_FreePrivateData(surface, &IID_IDirect3DVertexBuffer8);
+ ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
+
+ IDirect3DSurface8_Release(surface2);
+ IDirect3DSurface8_Release(surface);
+ IDirect3DTexture8_Release(texture);
+
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
IDirect3D8_Release(d3d8);
More information about the wine-cvs
mailing list