Commit 09dd10e7 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

dxgi/tests: Add some tests for IDXGIObject::GetParent().

parent 3543e3d8
......@@ -121,6 +121,49 @@ static void test_create_surface(IDXGIDevice *device)
IDXGISurface_Release(surface);
}
static void test_parents(IDXGIDevice *device)
{
IDXGIFactory *factory;
IDXGIAdapter *adapter;
IDXGIOutput *output;
IUnknown *parent;
HRESULT hr;
hr = IDXGIDevice_GetAdapter(device, &adapter);
ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
hr = IDXGIAdapter_EnumOutputs(adapter, 0, &output);
if (hr == DXGI_ERROR_NOT_FOUND)
{
skip("Adapter has not outputs, skipping output tests.\n");
}
else
{
ok(SUCCEEDED(hr), "EnumOutputs failed, hr %#x.\n", hr);
hr = IDXGIOutput_GetParent(output, &IID_IDXGIAdapter, (void **)&parent);
IDXGIOutput_Release(output);
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
ok(parent == (IUnknown *)adapter, "Got parent %p, expected %p.\n", parent, adapter);
IUnknown_Release(parent);
}
hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
hr = IDXGIFactory_GetParent(factory, &IID_IUnknown, (void **)&parent);
ok(hr == E_NOINTERFACE, "GetParent returned %#x, expected %#x.\n", hr, E_NOINTERFACE);
ok(parent == NULL, "Got parent %p, expected %p.\n", parent, NULL);
IDXGIFactory_Release(factory);
hr = IDXGIDevice_GetParent(device, &IID_IDXGIAdapter, (void **)&parent);
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
ok(parent == (IUnknown *)adapter, "Got parent %p, expected %p.\n", parent, adapter);
IUnknown_Release(parent);
IDXGIAdapter_Release(adapter);
}
START_TEST(device)
{
HMODULE d3d10core = LoadLibraryA("d3d10core.dll");
......@@ -143,6 +186,7 @@ START_TEST(device)
test_device_interfaces(device);
test_create_surface(device);
test_parents(device);
refcount = IDXGIDevice_Release(device);
ok(!refcount, "Device has %u references left\n", refcount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment