d3d10: Add a test to show d3d10 devices implement IDXGIDevice.
Henri Verbeet
hverbeet at codeweavers.com
Wed Oct 29 03:00:27 CDT 2008
---
dlls/d3d10/tests/Makefile.in | 13 +++++++
dlls/d3d10/tests/device.c | 83 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 0 deletions(-)
create mode 100644 dlls/d3d10/tests/Makefile.in
create mode 100644 dlls/d3d10/tests/device.c
diff --git a/dlls/d3d10/tests/Makefile.in b/dlls/d3d10/tests/Makefile.in
new file mode 100644
index 0000000..892b9ce
--- /dev/null
+++ b/dlls/d3d10/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+TESTDLL = d3d10.dll
+IMPORTS = d3d10 kernel32
+
+CTESTS = \
+ device.c \
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@ # everything below this line is overwritten by make depend
diff --git a/dlls/d3d10/tests/device.c b/dlls/d3d10/tests/device.c
new file mode 100644
index 0000000..ba7ebdd
--- /dev/null
+++ b/dlls/d3d10/tests/device.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 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 "initguid.h"
+#include "d3d10.h"
+#include "wine/test.h"
+
+static ID3D10Device *create_device()
+{
+ ID3D10Device *device;
+
+ if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device)))
+ {
+ trace("Created a HW device\n");
+ return device;
+ }
+
+ trace("Failed to create a HW device, trying REF\n");
+ if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &device)))
+ {
+ trace("Created a REF device\n");
+ return device;
+ }
+
+ trace("Failed to create a device, returning NULL\n");
+ return NULL;
+}
+
+static void test_device_interfaces(ID3D10Device *device)
+{
+ HRESULT hr;
+ IUnknown *obj;
+
+ if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IUnknown, (void **)&obj)))
+ IUnknown_Release(obj);
+ ok(SUCCEEDED(hr), "ID3D10Device does not implement IUnknown (%#x)\n", hr);
+
+ if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_ID3D10Device, (void **)&obj)))
+ IUnknown_Release(obj);
+ ok(SUCCEEDED(hr), "ID3D10Device does not implement ID3D10Device (%#x)\n", hr);
+
+ if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIObject, (void **)&obj)))
+ IUnknown_Release(obj);
+ todo_wine ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIObject (%#x)\n", hr);
+
+ if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&obj)))
+ IUnknown_Release(obj);
+ todo_wine ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIDevice (%#x)\n", hr);
+}
+
+START_TEST(device)
+{
+ ID3D10Device *device;
+ ULONG refcount;
+
+ device = create_device();
+ if (!device)
+ {
+ skip("Failed to create device, skipping tests\n");
+ return;
+ }
+
+ test_device_interfaces(device);
+
+ refcount = ID3D10Device_Release(device);
+ ok(!refcount, "Device has %u references left\n", refcount);
+}
--
1.5.6.4
--------------010204040406060408020108--
More information about the wine-patches
mailing list