=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: ddraw/tests: Test GetPrivateData size behavior.
Alexandre Julliard
julliard at winehq.org
Mon Mar 17 15:51:35 CDT 2014
Module: wine
Branch: master
Commit: 1d9ff5c43b4630be0791508c0b7d9f6e1379dd39
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1d9ff5c43b4630be0791508c0b7d9f6e1379dd39
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Sun Mar 16 20:38:59 2014 +0100
ddraw/tests: Test GetPrivateData size behavior.
---
dlls/ddraw/tests/ddraw4.c | 26 ++++++++++++++++++++++++++
dlls/ddraw/tests/ddraw7.c | 26 ++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index bb725e7..f01f812 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -6122,13 +6122,39 @@ static void test_private_data(void)
hr = IDirectDrawSurface4_SetPrivateData(surface, &IID_IDirect3D, ddraw,
sizeof(ddraw), DDSPD_IUNKNOWNPOINTER);
ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
+ size = 2 * sizeof(ptr);
hr = IDirectDrawSurface4_GetPrivateData(surface, &IID_IDirect3D, &ptr, &size);
ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr);
+ ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size);
refcount2 = get_refcount(ptr);
/* Object is NOT addref'ed by the getter. */
ok(ptr == (IUnknown *)ddraw, "Returned interface pointer is %p, expected %p.\n", ptr, ddraw);
ok(refcount2 == refcount + 1, "Got unexpected refcount %u.\n", refcount2);
+ ptr = (IUnknown *)0xdeadbeef;
+ size = 1;
+ hr = IDirectDrawSurface4_GetPrivateData(surface, &IID_IDirect3D, NULL, &size);
+ ok(hr == DDERR_MOREDATA, "Got unexpected hr %#x.\n", hr);
+ ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size);
+ size = 2 * sizeof(ptr);
+ hr = IDirectDrawSurface4_GetPrivateData(surface, &IID_IDirect3D, NULL, &size);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+ ok(size == 2 * sizeof(ptr), "Got unexpected size %u.\n", size);
+ size = 1;
+ hr = IDirectDrawSurface4_GetPrivateData(surface, &IID_IDirect3D, &ptr, &size);
+ ok(hr == DDERR_MOREDATA, "Got unexpected hr %#x.\n", hr);
+ ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size);
+ ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr);
+ hr = IDirectDrawSurface4_GetPrivateData(surface, &IID_IDirect3DViewport, NULL, NULL);
+ ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
+ size = 0xdeadbabe;
+ hr = IDirectDrawSurface4_GetPrivateData(surface, &IID_IDirect3DViewport, &ptr, &size);
+ ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
+ ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr);
+ ok(size == 0xdeadbabe, "Got unexpected size %u.\n", size);
+ hr = IDirectDrawSurface4_GetPrivateData(surface, &IID_IDirect3D, NULL, NULL);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+
refcount3 = IDirectDrawSurface4_Release(surface);
ok(!refcount3, "Got unexpected refcount %u.\n", refcount3);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 15e89a1..1efde27 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -5977,13 +5977,39 @@ static void test_private_data(void)
hr = IDirectDrawSurface7_SetPrivateData(surface, &IID_IDirect3D, ddraw,
sizeof(ddraw), DDSPD_IUNKNOWNPOINTER);
ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
+ size = 2 * sizeof(ptr);
hr = IDirectDrawSurface7_GetPrivateData(surface, &IID_IDirect3D, &ptr, &size);
ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr);
+ ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size);
refcount2 = get_refcount(ptr);
/* Object is NOT addref'ed by the getter. */
ok(ptr == (IUnknown *)ddraw, "Returned interface pointer is %p, expected %p.\n", ptr, ddraw);
ok(refcount2 == refcount + 1, "Got unexpected refcount %u.\n", refcount2);
+ ptr = (IUnknown *)0xdeadbeef;
+ size = 1;
+ hr = IDirectDrawSurface7_GetPrivateData(surface, &IID_IDirect3D, NULL, &size);
+ ok(hr == DDERR_MOREDATA, "Got unexpected hr %#x.\n", hr);
+ ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size);
+ size = 2 * sizeof(ptr);
+ hr = IDirectDrawSurface7_GetPrivateData(surface, &IID_IDirect3D, NULL, &size);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+ ok(size == 2 * sizeof(ptr), "Got unexpected size %u.\n", size);
+ size = 1;
+ hr = IDirectDrawSurface7_GetPrivateData(surface, &IID_IDirect3D, &ptr, &size);
+ ok(hr == DDERR_MOREDATA, "Got unexpected hr %#x.\n", hr);
+ ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size);
+ ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr);
+ hr = IDirectDrawSurface7_GetPrivateData(surface, &IID_IDirect3DViewport, NULL, NULL);
+ ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
+ size = 0xdeadbabe;
+ hr = IDirectDrawSurface7_GetPrivateData(surface, &IID_IDirect3DViewport, &ptr, &size);
+ ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
+ ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr);
+ ok(size == 0xdeadbabe, "Got unexpected size %u.\n", size);
+ hr = IDirectDrawSurface7_GetPrivateData(surface, &IID_IDirect3D, NULL, NULL);
+ ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
+
refcount3 = IDirectDrawSurface7_Release(surface);
ok(!refcount3, "Got unexpected refcount %u.\n", refcount3);
More information about the wine-cvs
mailing list