dxgi/tests: Also test for ID3D10Device1 and ID3D11Device in test_device_interfaces().

This commit is contained in:
Henri Verbeet 2014-02-11 11:42:22 +01:00 committed by Alexandre Julliard
parent e806b5bab9
commit 2be432b4df
3 changed files with 24 additions and 97 deletions

View File

@ -21,54 +21,6 @@
#include "d3d10.h" #include "d3d10.h"
#include "wine/test.h" #include "wine/test.h"
static ID3D10Device *create_device(void)
{
ID3D10Device *device;
if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device)))
return device;
if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_WARP, NULL, 0, D3D10_SDK_VERSION, &device)))
return device;
if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &device)))
return device;
return NULL;
}
static void test_device_interfaces(void)
{
ID3D10Device *device;
ULONG refcount;
IUnknown *obj;
HRESULT hr;
device = create_device();
if (!device)
{
skip("Failed to create device, skipping tests\n");
return;
}
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);
ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIObject (%#x)\n", hr);
if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&obj)))
IUnknown_Release(obj);
ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIDevice (%#x)\n", hr);
refcount = ID3D10Device_Release(device);
ok(!refcount, "Device has %u references left\n", refcount);
}
static void test_stateblock_mask(void) static void test_stateblock_mask(void)
{ {
static const struct static const struct
@ -229,6 +181,5 @@ static void test_stateblock_mask(void)
START_TEST(device) START_TEST(device)
{ {
test_device_interfaces();
test_stateblock_mask(); test_stateblock_mask();
} }

View File

@ -35,39 +35,6 @@ static ID3D10Device *create_device(void)
return NULL; return NULL;
} }
static void test_device_interfaces(void)
{
ID3D10Device *device;
ULONG refcount;
IUnknown *obj;
HRESULT hr;
if (!(device = create_device()))
{
skip("Failed to create device, skipping tests.\n");
return;
}
if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IUnknown, (void **)&obj)))
IUnknown_Release(obj);
ok(SUCCEEDED(hr), "ID3D10Device does not implement IUnknown\n");
if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIObject, (void **)&obj)))
IUnknown_Release(obj);
ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIObject\n");
if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&obj)))
IUnknown_Release(obj);
ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIDevice\n");
if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_ID3D10Device, (void **)&obj)))
IUnknown_Release(obj);
ok(SUCCEEDED(hr), "ID3D10Device does not implement ID3D10Device\n");
refcount = ID3D10Device_Release(device);
ok(!refcount, "Device has %u references left\n", refcount);
}
static void test_create_texture2d(void) static void test_create_texture2d(void)
{ {
D3D10_TEXTURE2D_DESC desc; D3D10_TEXTURE2D_DESC desc;
@ -761,7 +728,6 @@ static void test_create_predicate(void)
START_TEST(device) START_TEST(device)
{ {
test_device_interfaces();
test_create_texture2d(); test_create_texture2d();
test_create_texture3d(); test_create_texture3d();
test_create_depthstencil_view(); test_create_depthstencil_view();

View File

@ -18,7 +18,7 @@
#define COBJMACROS #define COBJMACROS
#include "initguid.h" #include "initguid.h"
#include "d3d10.h" #include "d3d11.h"
#include "wine/test.h" #include "wine/test.h"
static HRESULT (WINAPI *pCreateDXGIFactory1)(REFIID iid, void **factory); static HRESULT (WINAPI *pCreateDXGIFactory1)(REFIID iid, void **factory);
@ -49,8 +49,8 @@ success:
static void test_device_interfaces(void) static void test_device_interfaces(void)
{ {
IDXGIDevice *device; IDXGIDevice *device;
IUnknown *iface;
ULONG refcount; ULONG refcount;
IUnknown *obj;
HRESULT hr; HRESULT hr;
if (!(device = create_device())) if (!(device = create_device()))
@ -59,21 +59,31 @@ static void test_device_interfaces(void)
return; return;
} }
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_IUnknown, (void **)&obj))) hr = IDXGIDevice_QueryInterface(device, &IID_IUnknown, (void **)&iface);
IUnknown_Release(obj); ok(SUCCEEDED(hr), "Failed to query IUnknown interface, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "IDXGIDevice does not implement IUnknown\n"); IUnknown_Release(iface);
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_IDXGIObject, (void **)&obj))) hr = IDXGIDevice_QueryInterface(device, &IID_IDXGIObject, (void **)&iface);
IUnknown_Release(obj); ok(SUCCEEDED(hr), "Failed to query IDXGIObject interface, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "IDXGIDevice does not implement IDXGIObject\n"); IUnknown_Release(iface);
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_IDXGIDevice, (void **)&obj))) hr = IDXGIDevice_QueryInterface(device, &IID_IDXGIDevice, (void **)&iface);
IUnknown_Release(obj); ok(SUCCEEDED(hr), "Failed to query IDXGIDevice interface, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "IDXGIDevice does not implement IDXGIDevice\n"); IUnknown_Release(iface);
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_ID3D10Device, (void **)&obj))) hr = IDXGIDevice_QueryInterface(device, &IID_ID3D10Device, (void **)&iface);
IUnknown_Release(obj); ok(SUCCEEDED(hr), "Failed to query ID3D10Device interface, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "IDXGIDevice does not implement ID3D10Device\n"); IUnknown_Release(iface);
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_ID3D10Device1, (void **)&iface)))
IUnknown_Release(iface);
todo_wine ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Failed to query ID3D10Device1 interface, hr %#x.\n", hr);
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_ID3D11Device, (void **)&iface)))
IUnknown_Release(iface);
todo_wine ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Failed to query ID3D11Device interface, hr %#x.\n", hr);
refcount = IDXGIDevice_Release(device); refcount = IDXGIDevice_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount); ok(!refcount, "Device has %u references left.\n", refcount);