Release 1.1.37.
[wine/gsoc-2012-control.git] / dlls / d3d10 / tests / device.c
blob8399cdb7bb274ebf7a49b81ac8309f8be92dae08
1 /*
2 * Copyright 2008 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
20 #include "initguid.h"
21 #include "d3d10.h"
22 #include "wine/test.h"
24 static ID3D10Device *create_device(void)
26 ID3D10Device *device;
28 if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device)))
30 trace("Created a HW device\n");
31 return device;
34 trace("Failed to create a HW device, trying REF\n");
35 if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &device)))
37 trace("Created a REF device\n");
38 return device;
41 trace("Failed to create a device, returning NULL\n");
42 return NULL;
45 static void test_device_interfaces(ID3D10Device *device)
47 HRESULT hr;
48 IUnknown *obj;
50 if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IUnknown, (void **)&obj)))
51 IUnknown_Release(obj);
52 ok(SUCCEEDED(hr), "ID3D10Device does not implement IUnknown (%#x)\n", hr);
54 if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_ID3D10Device, (void **)&obj)))
55 IUnknown_Release(obj);
56 ok(SUCCEEDED(hr), "ID3D10Device does not implement ID3D10Device (%#x)\n", hr);
58 if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIObject, (void **)&obj)))
59 IUnknown_Release(obj);
60 ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIObject (%#x)\n", hr);
62 if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&obj)))
63 IUnknown_Release(obj);
64 ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIDevice (%#x)\n", hr);
67 START_TEST(device)
69 ID3D10Device *device;
70 ULONG refcount;
72 device = create_device();
73 if (!device)
75 skip("Failed to create device, skipping tests\n");
76 return;
79 test_device_interfaces(device);
81 refcount = ID3D10Device_Release(device);
82 ok(!refcount, "Device has %u references left\n", refcount);