Commit e202a9ea authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d2d1/tests: Add a simple test for creating d2d devices.

parent 02603467
......@@ -19,7 +19,7 @@
#define COBJMACROS
#include <limits.h>
#include <math.h>
#include "d2d1.h"
#include "d2d1_1.h"
#include "wincrypt.h"
#include "wine/test.h"
#include "initguid.h"
......@@ -6426,6 +6426,47 @@ static void test_bezier_intersect(void)
DestroyWindow(window);
}
static void test_create_device(void)
{
ID3D10Device1 *d3d_device;
IDXGIDevice *dxgi_device;
ID2D1Factory1 *factory;
ID2D1Factory *factory2;
ID2D1Device *device;
ULONG refcount;
HRESULT hr;
if (!(d3d_device = create_device()))
{
skip("Failed to create device, skipping tests.\n");
return;
}
if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory)))
{
win_skip("ID2D1Factory1 is not supported.\n");
ID3D10Device1_Release(d3d_device);
return;
}
hr = ID3D10Device1_QueryInterface(d3d_device, &IID_IDXGIDevice, (void **)&dxgi_device);
ok(SUCCEEDED(hr), "Failed to get IDXGIDevice interface, hr %#x.\n", hr);
hr = ID2D1Factory1_CreateDevice(factory, dxgi_device, &device);
ok(SUCCEEDED(hr), "Failed to get ID2D1Device, hr %#x.\n", hr);
ID2D1Device_GetFactory(device, &factory2);
ok(factory2 == (ID2D1Factory *)factory, "Got unexpected factory %p, expected %p.\n", factory2, factory);
ID2D1Factory_Release(factory2);
ID2D1Device_Release(device);
IDXGIDevice_Release(dxgi_device);
ID3D10Device1_Release(d3d_device);
refcount = ID2D1Factory1_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount);
}
START_TEST(d2d1)
{
test_clip();
......@@ -6454,4 +6495,5 @@ START_TEST(d2d1)
test_gdi_interop();
test_layer();
test_bezier_intersect();
test_create_device();
}
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