d3d11/tests: Add test for device interfaces.

This commit is contained in:
Józef Kucia 2015-08-24 01:04:24 +02:00 committed by Alexandre Julliard
parent 40c5303b62
commit 9af58dc110
4 changed files with 107 additions and 0 deletions

1
configure vendored
View File

@ -17236,6 +17236,7 @@ wine_fn_config_dll d3d10_1 enable_d3d10_1 implib
wine_fn_config_dll d3d10core enable_d3d10core implib
wine_fn_config_test dlls/d3d10core/tests d3d10core_test
wine_fn_config_dll d3d11 enable_d3d11 implib
wine_fn_config_test dlls/d3d11/tests d3d11_test
wine_fn_config_dll d3d8 enable_d3d8 implib
wine_fn_config_test dlls/d3d8/tests d3d8_test
wine_fn_config_dll d3d9 enable_d3d9 implib

View File

@ -2837,6 +2837,7 @@ WINE_CONFIG_DLL(d3d10_1,,[implib])
WINE_CONFIG_DLL(d3d10core,,[implib])
WINE_CONFIG_TEST(dlls/d3d10core/tests)
WINE_CONFIG_DLL(d3d11,,[implib])
WINE_CONFIG_TEST(dlls/d3d11/tests)
WINE_CONFIG_DLL(d3d8,,[implib])
WINE_CONFIG_TEST(dlls/d3d8/tests)
WINE_CONFIG_DLL(d3d9,,[implib])

View File

@ -0,0 +1,5 @@
TESTDLL = d3d11.dll
IMPORTS = d3d11
C_SRCS = \
d3d11.c

100
dlls/d3d11/tests/d3d11.c Normal file
View File

@ -0,0 +1,100 @@
/*
* Copyright 2015 Józef Kucia 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 "d3d11.h"
#include "wine/test.h"
static ID3D11Device *create_device(D3D_FEATURE_LEVEL feature_level)
{
ID3D11Device *device;
if (SUCCEEDED(D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &feature_level, 1, D3D11_SDK_VERSION,
&device, NULL, NULL)))
return device;
if (SUCCEEDED(D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_WARP, NULL, 0, &feature_level, 1, D3D11_SDK_VERSION,
&device, NULL, NULL)))
return device;
if (SUCCEEDED(D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_REFERENCE, NULL, 0, &feature_level, 1, D3D11_SDK_VERSION,
&device, NULL, NULL)))
return device;
return NULL;
}
static void test_device_interfaces(void)
{
static const D3D_FEATURE_LEVEL feature_levels[] =
{
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1
};
ID3D11Device *device;
IUnknown *iface;
ULONG refcount;
unsigned int i;
HRESULT hr;
for (i = 0; i < sizeof(feature_levels) / sizeof(*feature_levels); i++)
{
if (!(device = create_device(feature_levels[i])))
{
skip("Failed to create device for feature level %#x, skipping tests.\n", feature_levels[i]);
continue;
}
hr = ID3D11Device_QueryInterface(device, &IID_IUnknown, (void **)&iface);
ok(SUCCEEDED(hr), "Device should implement IUnknown interface, hr %#x.\n", hr);
IUnknown_Release(iface);
hr = ID3D11Device_QueryInterface(device, &IID_IDXGIObject, (void **)&iface);
ok(SUCCEEDED(hr), "Device should implement IDXGIObject interface, hr %#x.\n", hr);
IUnknown_Release(iface);
hr = ID3D11Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&iface);
ok(SUCCEEDED(hr), "Device should implement IDXGIDevice interface, hr %#x.\n", hr);
IUnknown_Release(iface);
hr = ID3D11Device_QueryInterface(device, &IID_ID3D10Multithread, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Device should implement ID3D10Multithread interface, hr %#x.\n", hr);
if (SUCCEEDED(hr)) IUnknown_Release(iface);
hr = ID3D11Device_QueryInterface(device, &IID_ID3D10Device, (void **)&iface);
todo_wine ok(hr == E_NOINTERFACE, "Device should not implement ID3D10Device interface, hr %#x.\n", hr);
if (SUCCEEDED(hr)) IUnknown_Release(iface);
hr = ID3D11Device_QueryInterface(device, &IID_ID3D10Device1, (void **)&iface);
todo_wine ok(hr == E_NOINTERFACE, "Device should not implement ID3D10Device1 interface, hr %#x.\n", hr);
if (SUCCEEDED(hr)) IUnknown_Release(iface);
refcount = ID3D11Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
}
}
START_TEST(d3d11)
{
test_device_interfaces();
}