[PATCH 2/5] d3d9/tests: Use a custom GUID for the private data tests.

Stefan Dösinger stefan at codeweavers.com
Wed Mar 12 08:08:24 CDT 2014


The idea behind the vertex buffer id was to use an id that's neither the
container's nor the stored object's id to avoid potential interactions.
The next patch reuses some existing code, and rather than replace
everything with IID_IDirect3DVertexBuffer9 I decided to do it properly
and use a custom GUID.
---
 dlls/d3d9/tests/device.c | 47 +++++++++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 20 deletions(-)

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 93f43fa..393c14a 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -5082,6 +5082,13 @@ static void test_private_data(void)
     HRESULT hr;
     DWORD size;
     DWORD data[4] = {1, 2, 3, 4};
+    static const GUID d3d9_private_data_test_guid =
+    {
+        0xfdb37466,
+        0x428f,
+        0x4edf,
+        {0xa3,0x7f,0x9b,0x1d,0xf4,0x88,0xc5,0xfc}
+    };
 
     window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
             0, 0, 640, 480, 0, 0, 0, 0);
@@ -5099,57 +5106,57 @@ static void test_private_data(void)
             D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &surface, NULL);
     ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
 
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9 /* Abuse this tag */,
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
             device, 0, D3DSPD_IUNKNOWN);
     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9 /* Abuse this tag */,
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
             device, 5, D3DSPD_IUNKNOWN);
     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9 /* Abuse this tag */,
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
             device, sizeof(IUnknown *) * 2, D3DSPD_IUNKNOWN);
     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
 
     /* A failing SetPrivateData call does not clear the old data with the same tag. */
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DVertexBuffer9, device,
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid, device,
             sizeof(device), D3DSPD_IUNKNOWN);
     ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DVertexBuffer9, device,
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid, device,
             sizeof(device) * 2, D3DSPD_IUNKNOWN);
     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
     size = sizeof(ptr);
-    hr = IDirect3DSurface9_GetPrivateData(surface, &IID_IDirect3DVertexBuffer9, &ptr, &size);
+    hr = IDirect3DSurface9_GetPrivateData(surface, &d3d9_private_data_test_guid, &ptr, &size);
     ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr);
     IUnknown_Release(ptr);
-    hr = IDirect3DSurface9_FreePrivateData(surface, &IID_IDirect3DVertexBuffer9);
+    hr = IDirect3DSurface9_FreePrivateData(surface, &d3d9_private_data_test_guid);
     ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
 
     refcount = get_refcount((IUnknown *)device);
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9 /* Abuse this tag */,
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
             device, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     expected_refcount = refcount + 1;
     refcount = get_refcount((IUnknown *)device);
     ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
-    hr = IDirect3DSurface9_FreePrivateData(surface, &IID_IDirect3DSurface9);
+    hr = IDirect3DSurface9_FreePrivateData(surface, &d3d9_private_data_test_guid);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     expected_refcount = refcount - 1;
     refcount = get_refcount((IUnknown *)device);
     ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
 
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9,
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
             device, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9,
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
             surface, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     refcount = get_refcount((IUnknown *)device);
     ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
 
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9,
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
             device, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     size = sizeof(ptr);
-    hr = IDirect3DSurface9_GetPrivateData(surface, &IID_IDirect3DSurface9, &ptr, &size);
+    hr = IDirect3DSurface9_GetPrivateData(surface, &d3d9_private_data_test_guid, &ptr, &size);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     expected_refcount = refcount + 2;
     refcount = get_refcount((IUnknown *)device);
@@ -5171,27 +5178,27 @@ static void test_private_data(void)
     hr = IDirect3DTexture9_GetSurfaceLevel(texture, 1, &surface2);
     ok(SUCCEEDED(hr), "Failed to get texture level 1, hr %#x.\n", hr);
 
-    hr = IDirect3DTexture9_SetPrivateData(texture, &IID_IDirect3DVertexBuffer9, data, sizeof(data), 0);
+    hr = IDirect3DTexture9_SetPrivateData(texture, &d3d9_private_data_test_guid, 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 = IDirect3DSurface9_GetPrivateData(surface, &IID_IDirect3DVertexBuffer9, data, &size);
+    hr = IDirect3DSurface9_GetPrivateData(surface, &d3d9_private_data_test_guid, data, &size);
     ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
-    hr = IDirect3DTexture9_GetPrivateData(texture, &IID_IDirect3DVertexBuffer9, data, &size);
+    hr = IDirect3DTexture9_GetPrivateData(texture, &d3d9_private_data_test_guid, 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 = IDirect3DTexture9_FreePrivateData(texture, &IID_IDirect3DVertexBuffer9);
+    hr = IDirect3DTexture9_FreePrivateData(texture, &d3d9_private_data_test_guid);
     ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
 
-    hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DVertexBuffer9, data, sizeof(data), 0);
+    hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid, data, sizeof(data), 0);
     ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
-    hr = IDirect3DSurface9_GetPrivateData(surface2, &IID_IDirect3DVertexBuffer9, data, &size);
+    hr = IDirect3DSurface9_GetPrivateData(surface2, &d3d9_private_data_test_guid, data, &size);
     ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
 
-    hr = IDirect3DSurface9_FreePrivateData(surface, &IID_IDirect3DVertexBuffer9);
+    hr = IDirect3DSurface9_FreePrivateData(surface, &d3d9_private_data_test_guid);
     ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
 
     IDirect3DSurface9_Release(surface2);
-- 
1.8.3.2




More information about the wine-patches mailing list