From: Aaryaman Vasishta Subject: [PATCH 3/4] d3drm/tests: Split tests seperately for IDirect3DRM{1-3} interfaces Message-Id: <1427904921-81402-3-git-send-email-jem456.vasishta@gmail.com> Date: Wed, 1 Apr 2015 21:45:20 +0530 --- dlls/d3drm/tests/Makefile.in | 3 + dlls/d3drm/tests/d3drm.c | 99 +++++++++++++++ dlls/d3drm/tests/d3drm1.c | 275 ++++++++++++++++++++++++++++++++++++++++ dlls/d3drm/tests/d3drm2.c | 293 +++++++++++++++++++++++++++++++++++++++++++ dlls/d3drm/tests/d3drm3.c | 293 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 963 insertions(+) create mode 100644 dlls/d3drm/tests/d3drm1.c create mode 100644 dlls/d3drm/tests/d3drm2.c create mode 100644 dlls/d3drm/tests/d3drm3.c diff --git a/dlls/d3drm/tests/Makefile.in b/dlls/d3drm/tests/Makefile.in index 591f9e0..0e0c4bb 100644 --- a/dlls/d3drm/tests/Makefile.in +++ b/dlls/d3drm/tests/Makefile.in @@ -2,4 +2,7 @@ TESTDLL = d3drm.dll IMPORTS = d3drm dxguid ddraw user32 uuid C_SRCS = \ d3drm.c \ + d3drm1.c \ + d3drm2.c \ + d3drm3.c \ vector.c diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 515aace..6029b1a 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -1841,6 +1841,104 @@ static void test_d3drm_qi(void) IDirect3DRM_Release(d3drm); } +static void test_frame_qi(void) +{ + static const struct qi_test tests[] = + { + { &IID_IDirect3DRMFrame3, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRMFrame2, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRMFrame, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRM, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRMDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRM3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRM2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisual, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRMMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMWrap, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObjectArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDeviceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewportArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrameArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisualArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLightArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPickedArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFaceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMUserVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMInterpolator, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMProgressiveMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPicked2Array, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMClippedVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawClipper, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IUnknown, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + }; + HRESULT hr; + IDirect3DRM *d3drm; + IDirect3DRM3 *d3drm3; + IDirect3DRMFrame3 *frame3; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + if (FAILED(hr = IDirect3DRM_QueryInterface(d3drm, &IID_IDirect3DRM3, (void **)&d3drm3))) + { + win_skip("Cannot get IDirect3DRM3 interface (hr = %x), skipping tests\n", hr); + IDirect3DRM_Release(d3drm); + return; + } + + hr = IDirect3DRM3_CreateFrame(d3drm3, NULL, &frame3); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFrame3 interface (hr = %x)\n", hr); + CHECK_REFCOUNT(frame3, 1); + + test_qi("frame_qi", (IUnknown *)frame3, &IID_IDirect3DRMFrame3, tests, sizeof(tests) / sizeof(*tests)); + + IDirect3DRMFrame3_Release(frame3); + IDirect3DRM3_Release(d3drm3); + IDirect3DRM_Release(d3drm); +} + START_TEST(d3drm) { test_MeshBuilder(); @@ -1857,4 +1955,5 @@ START_TEST(d3drm) test_d3drm_load(); test_frame_mesh_materials(); test_d3drm_qi(); + test_frame_qi(); } diff --git a/dlls/d3drm/tests/d3drm1.c b/dlls/d3drm/tests/d3drm1.c new file mode 100644 index 0000000..cea000f --- /dev/null +++ b/dlls/d3drm/tests/d3drm1.c @@ -0,0 +1,275 @@ +/* +* Copyright 2010, 2012 Christian Costa +* Copyright 2012 André Hentschel +* Copyright 2011-2014 Henri Verbeet for CodeWeavers +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +*/ + +#define COBJMACROS +#include +#include +#include + +#include "wine/test.h" + +#define CHECK_REFCOUNT(obj,rc) \ + { \ + int rc_new = rc; \ + int count = get_refcount((IUnknown *)obj); \ + ok(count == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, count); \ + } + +static int get_refcount(IUnknown *object) +{ + IUnknown_AddRef(object); + return IUnknown_Release(object); +} + +struct qi_test +{ + REFIID iid; + REFIID refcount_iid; + HRESULT hr; + BOOL refcount_todo; +}; + +static void test_qi(const char *test_name, IUnknown *base_iface, + REFIID refcount_iid, const struct qi_test *tests, UINT entry_count) +{ + ULONG refcount, expected_refcount; + IUnknown *iface1, *iface2; + HRESULT hr; + UINT i, j; + + for (i = 0; i < entry_count; ++i) + { + hr = IUnknown_QueryInterface(base_iface, tests[i].iid, (void **)&iface1); + ok(hr == tests[i].hr, "Got hr %#x for test \"%s\" %u.\n", hr, test_name, i); + if (SUCCEEDED(hr)) + { + for (j = 0; j < entry_count; ++j) + { + hr = IUnknown_QueryInterface(iface1, tests[j].iid, (void **)&iface2); + ok(hr == tests[j].hr, "Got hr %#x for test \"%s\" %u, %u.\n", hr, test_name, i, j); + if (SUCCEEDED(hr)) + { + expected_refcount = 0; + if (IsEqualGUID(refcount_iid, tests[j].refcount_iid)) + ++expected_refcount; + if (IsEqualGUID(tests[i].refcount_iid, tests[j].refcount_iid)) + ++expected_refcount; + refcount = IUnknown_Release(iface2); + if (tests[i].refcount_todo || tests[j].refcount_todo) + todo_wine ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, %u, expected %u.\n", + refcount, test_name, i, j, expected_refcount); + else + ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, %u, expected %u.\n", + refcount, test_name, i, j, expected_refcount); + } + } + + expected_refcount = 0; + if (IsEqualGUID(refcount_iid, tests[i].refcount_iid)) + ++expected_refcount; + refcount = IUnknown_Release(iface1); + if (tests[i].refcount_todo) + todo_wine ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, expected %u.\n", + refcount, test_name, i, expected_refcount); + else + ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, expected %u.\n", + refcount, test_name, i, expected_refcount); + } + } +} + +static void test_d3drm_qi(void) +{ + static const struct qi_test tests[] = + { + { &IID_IDirect3DRM3, &IID_IDirect3DRM3, S_OK, TRUE }, + { &IID_IDirect3DRM2, &IID_IDirect3DRM2, S_OK, TRUE }, + { &IID_IDirect3DRM, &IID_IDirect3DRM, S_OK, FALSE }, + { &IID_IDirect3DRMDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrame, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrame2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrame3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMWrap, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObjectArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDeviceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewportArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrameArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisualArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLightArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPickedArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFaceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMUserVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMInterpolator, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMProgressiveMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPicked2Array, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMClippedVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawClipper, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IUnknown, &IID_IDirect3DRM, S_OK, FALSE }, + }; + HRESULT hr; + IDirect3DRM *d3drm; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + test_qi("d3drm_qi", (IUnknown *)d3drm, &IID_IDirect3DRM, tests, sizeof(tests) / sizeof(*tests)); + + IDirect3DRM_Release(d3drm); +} + +static void test_frame_qi(void) +{ + static const struct qi_test tests[] = + { + { &IID_IDirect3DRMFrame3, &IID_IDirect3DRMFrame, S_OK, FALSE }, + { &IID_IDirect3DRMFrame2, &IID_IDirect3DRMFrame, S_OK, FALSE }, + { &IID_IDirect3DRMFrame, &IID_IDirect3DRMFrame, S_OK, FALSE }, + { &IID_IDirect3DRM, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject, &IID_IDirect3DRMFrame, S_OK, FALSE }, + { &IID_IDirect3DRMDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRM3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRM2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisual, &IID_IDirect3DRMFrame, S_OK, FALSE }, + { &IID_IDirect3DRMMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMWrap, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObjectArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDeviceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewportArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrameArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisualArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLightArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPickedArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFaceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMUserVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMInterpolator, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMProgressiveMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPicked2Array, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMClippedVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawClipper, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IUnknown, &IID_IDirect3DRMFrame, S_OK, FALSE }, + }; + HRESULT hr; + IDirect3DRM *d3drm; + IDirect3DRMFrame *frame; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + hr = IDirect3DRM_CreateFrame(d3drm, NULL, &frame); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFrame3 interface (hr = %x)\n", hr); + CHECK_REFCOUNT(frame, 1); + + test_qi("frame_qi", (IUnknown *)frame, &IID_IDirect3DRMFrame, tests, sizeof(tests) / sizeof(*tests)); + + IDirect3DRMFrame_Release(frame); + IDirect3DRM_Release(d3drm); +} + +START_TEST(d3drm1) +{ + test_d3drm_qi(); + test_frame_qi(); +} diff --git a/dlls/d3drm/tests/d3drm2.c b/dlls/d3drm/tests/d3drm2.c new file mode 100644 index 0000000..6b52609 --- /dev/null +++ b/dlls/d3drm/tests/d3drm2.c @@ -0,0 +1,293 @@ +/* +* Copyright 2010, 2012 Christian Costa +* Copyright 2012 André Hentschel +* Copyright 2011-2014 Henri Verbeet for CodeWeavers +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +*/ + +#define COBJMACROS +#include +#include +#include + +#include "wine/test.h" + +#define CHECK_REFCOUNT(obj,rc) \ + { \ + int rc_new = rc; \ + int count = get_refcount((IUnknown *)obj); \ + ok(count == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, count); \ + } + +static int get_refcount(IUnknown *object) +{ + IUnknown_AddRef(object); + return IUnknown_Release(object); +} + +struct qi_test +{ + REFIID iid; + REFIID refcount_iid; + HRESULT hr; + BOOL refcount_todo; +}; + +static void test_qi(const char *test_name, IUnknown *base_iface, + REFIID refcount_iid, const struct qi_test *tests, UINT entry_count) +{ + ULONG refcount, expected_refcount; + IUnknown *iface1, *iface2; + HRESULT hr; + UINT i, j; + + for (i = 0; i < entry_count; ++i) + { + hr = IUnknown_QueryInterface(base_iface, tests[i].iid, (void **)&iface1); + ok(hr == tests[i].hr, "Got hr %#x for test \"%s\" %u.\n", hr, test_name, i); + if (SUCCEEDED(hr)) + { + for (j = 0; j < entry_count; ++j) + { + hr = IUnknown_QueryInterface(iface1, tests[j].iid, (void **)&iface2); + ok(hr == tests[j].hr, "Got hr %#x for test \"%s\" %u, %u.\n", hr, test_name, i, j); + if (SUCCEEDED(hr)) + { + expected_refcount = 0; + if (IsEqualGUID(refcount_iid, tests[j].refcount_iid)) + ++expected_refcount; + if (IsEqualGUID(tests[i].refcount_iid, tests[j].refcount_iid)) + ++expected_refcount; + refcount = IUnknown_Release(iface2); + if (tests[i].refcount_todo || tests[j].refcount_todo) + todo_wine ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, %u, expected %u.\n", + refcount, test_name, i, j, expected_refcount); + else + ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, %u, expected %u.\n", + refcount, test_name, i, j, expected_refcount); + } + } + + expected_refcount = 0; + if (IsEqualGUID(refcount_iid, tests[i].refcount_iid)) + ++expected_refcount; + refcount = IUnknown_Release(iface1); + if (tests[i].refcount_todo) + todo_wine ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, expected %u.\n", + refcount, test_name, i, expected_refcount); + else + ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, expected %u.\n", + refcount, test_name, i, expected_refcount); + } + } +} + +static void test_d3drm_qi(void) +{ + static const struct qi_test tests[] = + { + { &IID_IDirect3DRM3, &IID_IDirect3DRM3, S_OK, TRUE }, + { &IID_IDirect3DRM2, &IID_IDirect3DRM2, S_OK, FALSE }, + { &IID_IDirect3DRM, &IID_IDirect3DRM, S_OK, TRUE }, + { &IID_IDirect3DRMDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrame, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrame2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrame3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMWrap, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObjectArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDeviceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewportArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrameArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisualArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLightArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPickedArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFaceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMUserVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMInterpolator, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMProgressiveMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPicked2Array, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMClippedVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawClipper, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IUnknown, &IID_IDirect3DRM, S_OK, TRUE }, + }; + HRESULT hr; + IDirect3DRM *d3drm; + IDirect3DRM2 *d3drm2; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + if (FAILED(hr = IDirect3DRM_QueryInterface(d3drm, &IID_IDirect3DRM2, (void **)&d3drm2))) + { + win_skip("Cannot get IDirect3DRM2 interface (hr = %x), skipping tests\n", hr); + IDirect3DRM_Release(d3drm); + return; + } + IDirect3DRM_Release(d3drm); + + test_qi("d3drm_qi", (IUnknown *)d3drm2, &IID_IDirect3DRM2, tests, sizeof(tests) / sizeof(*tests)); + + IDirect3DRM2_Release(d3drm2); +} + +static void test_frame_qi(void) +{ + static const struct qi_test tests[] = + { + { &IID_IDirect3DRMFrame3, &IID_IDirect3DRMFrame2, S_OK, FALSE }, + { &IID_IDirect3DRMFrame2, &IID_IDirect3DRMFrame2, S_OK, FALSE }, + { &IID_IDirect3DRMFrame, &IID_IDirect3DRMFrame2, S_OK, FALSE }, + { &IID_IDirect3DRM, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject, &IID_IDirect3DRMFrame2, S_OK, FALSE }, + { &IID_IDirect3DRMDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRM3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRM2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisual, &IID_IDirect3DRMFrame2, S_OK, FALSE }, + { &IID_IDirect3DRMMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMWrap, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObjectArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDeviceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewportArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrameArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisualArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLightArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPickedArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFaceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMUserVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMInterpolator, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMProgressiveMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPicked2Array, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMClippedVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawClipper, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IUnknown, &IID_IDirect3DRMFrame2, S_OK, FALSE }, + }; + HRESULT hr; + IDirect3DRM *d3drm; + IDirect3DRM2 *d3drm2; + IDirect3DRMFrame2 *frame2; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + if (FAILED(hr = IDirect3DRM_QueryInterface(d3drm, &IID_IDirect3DRM2, (void **)&d3drm2))) + { + win_skip("Cannot get IDirect3DRM2 interface (hr = %x), skipping tests\n", hr); + IDirect3DRM_Release(d3drm); + return; + } + + hr = IDirect3DRM2_CreateFrame(d3drm2, NULL, &frame2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFrame3 interface (hr = %x)\n", hr); + CHECK_REFCOUNT(frame2, 1); + + test_qi("frame_qi", (IUnknown *)frame2, &IID_IDirect3DRMFrame2, tests, sizeof(tests) / sizeof(*tests)); + + IDirect3DRMFrame2_Release(frame2); + IDirect3DRM2_Release(d3drm2); + IDirect3DRM_Release(d3drm); +} + +START_TEST(d3drm2) +{ + test_d3drm_qi(); + test_frame_qi(); +} diff --git a/dlls/d3drm/tests/d3drm3.c b/dlls/d3drm/tests/d3drm3.c new file mode 100644 index 0000000..9538fb5 --- /dev/null +++ b/dlls/d3drm/tests/d3drm3.c @@ -0,0 +1,293 @@ +/* +* Copyright 2010, 2012 Christian Costa +* Copyright 2012 André Hentschel +* Copyright 2011-2014 Henri Verbeet for CodeWeavers +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +*/ + +#define COBJMACROS +#include +#include +#include + +#include "wine/test.h" + +#define CHECK_REFCOUNT(obj,rc) \ + { \ + int rc_new = rc; \ + int count = get_refcount((IUnknown *)obj); \ + ok(count == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, count); \ + } + +static int get_refcount(IUnknown *object) +{ + IUnknown_AddRef(object); + return IUnknown_Release(object); +} + +struct qi_test +{ + REFIID iid; + REFIID refcount_iid; + HRESULT hr; + BOOL refcount_todo; +}; + +static void test_qi(const char *test_name, IUnknown *base_iface, + REFIID refcount_iid, const struct qi_test *tests, UINT entry_count) +{ + ULONG refcount, expected_refcount; + IUnknown *iface1, *iface2; + HRESULT hr; + UINT i, j; + + for (i = 0; i < entry_count; ++i) + { + hr = IUnknown_QueryInterface(base_iface, tests[i].iid, (void **)&iface1); + ok(hr == tests[i].hr, "Got hr %#x for test \"%s\" %u.\n", hr, test_name, i); + if (SUCCEEDED(hr)) + { + for (j = 0; j < entry_count; ++j) + { + hr = IUnknown_QueryInterface(iface1, tests[j].iid, (void **)&iface2); + ok(hr == tests[j].hr, "Got hr %#x for test \"%s\" %u, %u.\n", hr, test_name, i, j); + if (SUCCEEDED(hr)) + { + expected_refcount = 0; + if (IsEqualGUID(refcount_iid, tests[j].refcount_iid)) + ++expected_refcount; + if (IsEqualGUID(tests[i].refcount_iid, tests[j].refcount_iid)) + ++expected_refcount; + refcount = IUnknown_Release(iface2); + if (tests[i].refcount_todo || tests[j].refcount_todo) + todo_wine ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, %u, expected %u.\n", + refcount, test_name, i, j, expected_refcount); + else + ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, %u, expected %u.\n", + refcount, test_name, i, j, expected_refcount); + } + } + + expected_refcount = 0; + if (IsEqualGUID(refcount_iid, tests[i].refcount_iid)) + ++expected_refcount; + refcount = IUnknown_Release(iface1); + if (tests[i].refcount_todo) + todo_wine ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, expected %u.\n", + refcount, test_name, i, expected_refcount); + else + ok(refcount == expected_refcount, "Got refcount %u for test \"%s\" %u, expected %u.\n", + refcount, test_name, i, expected_refcount); + } + } +} + +static void test_d3drm_qi(void) +{ + static const struct qi_test tests[] = + { + { &IID_IDirect3DRM3, &IID_IDirect3DRM3, S_OK, FALSE }, + { &IID_IDirect3DRM2, &IID_IDirect3DRM2, S_OK, TRUE }, + { &IID_IDirect3DRM, &IID_IDirect3DRM, S_OK, TRUE }, + { &IID_IDirect3DRMDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrame, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrame2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrame3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMWrap, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObjectArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDeviceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewportArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrameArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisualArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLightArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPickedArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFaceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMUserVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMInterpolator, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMProgressiveMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPicked2Array, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMClippedVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawClipper, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IUnknown, &IID_IDirect3DRM, S_OK, TRUE }, + }; + HRESULT hr; + IDirect3DRM *d3drm; + IDirect3DRM3 *d3drm3; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + if (FAILED(hr = IDirect3DRM_QueryInterface(d3drm, &IID_IDirect3DRM3, (void **)&d3drm3))) + { + win_skip("Cannot get IDirect3DRM2 interface (hr = %x), skipping tests\n", hr); + IDirect3DRM_Release(d3drm); + return; + } + IDirect3DRM_Release(d3drm); + + test_qi("d3drm_qi", (IUnknown *)d3drm3, &IID_IDirect3DRM3, tests, sizeof(tests) / sizeof(*tests)); + + IDirect3DRM3_Release(d3drm3); +} + +static void test_frame_qi(void) +{ + static const struct qi_test tests[] = + { + { &IID_IDirect3DRMFrame3, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRMFrame2, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRMFrame, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRM, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObject, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRMDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewport2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRM3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRM2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisual, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + { &IID_IDirect3DRMMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMeshBuilder3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFace2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMTexture3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMWrap, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMMaterial2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimation2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationSet2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMObjectArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMDeviceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMViewportArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFrameArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMVisualArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMLightArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPickedArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMFaceArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMAnimationArray, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMUserVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMShadow2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMInterpolator, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMProgressiveMesh, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMPicked2Array, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DRMClippedVisual, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawClipper, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDrawSurface, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DDevice, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3D, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw7, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw4, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw3, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw2, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirectDraw, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IDirect3DLight, NULL, CLASS_E_CLASSNOTAVAILABLE, FALSE }, + { &IID_IUnknown, &IID_IDirect3DRMFrame3, S_OK, FALSE }, + }; + HRESULT hr; + IDirect3DRM *d3drm; + IDirect3DRM3 *d3drm3; + IDirect3DRMFrame3 *frame3; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + if (FAILED(hr = IDirect3DRM_QueryInterface(d3drm, &IID_IDirect3DRM3, (void **)&d3drm3))) + { + win_skip("Cannot get IDirect3DRM3 interface (hr = %x), skipping tests\n", hr); + IDirect3DRM_Release(d3drm); + return; + } + + hr = IDirect3DRM3_CreateFrame(d3drm3, NULL, &frame3); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFrame3 interface (hr = %x)\n", hr); + CHECK_REFCOUNT(frame3, 1); + + test_qi("frame_qi", (IUnknown *)frame3, &IID_IDirect3DRMFrame3, tests, sizeof(tests) / sizeof(*tests)); + + IDirect3DRMFrame3_Release(frame3); + IDirect3DRM3_Release(d3drm3); + IDirect3DRM_Release(d3drm); +} + +START_TEST(d3drm3) +{ + test_d3drm_qi(); + test_frame_qi(); +} -- 1.9.3 (Apple Git-50)