d2d1/tests: Add tests for standard effect properties.
Signed-off-by: Ziqing Hui <zhui@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c518a5362b
commit
5ee5d7bbf3
|
@ -9680,13 +9680,30 @@ static void test_mt_factory(BOOL d3d11)
|
||||||
|
|
||||||
static void test_effect(BOOL d3d11)
|
static void test_effect(BOOL d3d11)
|
||||||
{
|
{
|
||||||
|
unsigned int i, min_inputs, max_inputs;
|
||||||
|
D2D1_BUFFER_PRECISION precision;
|
||||||
ID2D1Image *image_a, *image_b;
|
ID2D1Image *image_a, *image_b;
|
||||||
struct d2d1_test_context ctx;
|
struct d2d1_test_context ctx;
|
||||||
ID2D1DeviceContext *context;
|
ID2D1DeviceContext *context;
|
||||||
ID2D1Factory1 *factory;
|
ID2D1Factory1 *factory;
|
||||||
ID2D1Effect *effect;
|
ID2D1Effect *effect;
|
||||||
|
BOOL cached;
|
||||||
|
CLSID clsid;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
const struct effect_test
|
||||||
|
{
|
||||||
|
const CLSID *clsid;
|
||||||
|
UINT32 min_inputs;
|
||||||
|
UINT32 max_inputs;
|
||||||
|
}
|
||||||
|
effect_tests[] =
|
||||||
|
{
|
||||||
|
{&CLSID_D2D12DAffineTransform, 1, 1},
|
||||||
|
{&CLSID_D2D13DPerspectiveTransform, 1, 1},
|
||||||
|
{&CLSID_D2D1Composite, 1, 0xffffffff},
|
||||||
|
};
|
||||||
|
|
||||||
if (!init_test_context(&ctx, d3d11))
|
if (!init_test_context(&ctx, d3d11))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -9699,7 +9716,14 @@ static void test_effect(BOOL d3d11)
|
||||||
|
|
||||||
hr = ID2D1RenderTarget_QueryInterface(ctx.rt, &IID_ID2D1DeviceContext, (void **)&context);
|
hr = ID2D1RenderTarget_QueryInterface(ctx.rt, &IID_ID2D1DeviceContext, (void **)&context);
|
||||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D12DAffineTransform, &effect);
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(effect_tests); ++i)
|
||||||
|
{
|
||||||
|
const struct effect_test *test = effect_tests + i;
|
||||||
|
|
||||||
|
winetest_push_context("Test %u", i);
|
||||||
|
|
||||||
|
hr = ID2D1DeviceContext_CreateEffect(context, test->clsid, &effect);
|
||||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = ID2D1Effect_QueryInterface(effect, &IID_ID2D1Image, (void **)&image_a);
|
hr = ID2D1Effect_QueryInterface(effect, &IID_ID2D1Image, (void **)&image_a);
|
||||||
|
@ -9709,7 +9733,46 @@ static void test_effect(BOOL d3d11)
|
||||||
ID2D1Image_Release(image_b);
|
ID2D1Image_Release(image_b);
|
||||||
ID2D1Image_Release(image_a);
|
ID2D1Image_Release(image_a);
|
||||||
|
|
||||||
|
todo_wine
|
||||||
|
{
|
||||||
|
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID,
|
||||||
|
D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid));
|
||||||
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
if (hr == S_OK)
|
||||||
|
ok(IsEqualGUID(&clsid, test->clsid), "Got unexpected clsid %s, expected %s.\n",
|
||||||
|
debugstr_guid(&clsid), debugstr_guid(test->clsid));
|
||||||
|
|
||||||
|
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CACHED,
|
||||||
|
D2D1_PROPERTY_TYPE_BOOL, (BYTE *)&cached, sizeof(cached));
|
||||||
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
if (hr == S_OK)
|
||||||
|
ok(cached == FALSE, "Got unexpected cached %d.\n", cached);
|
||||||
|
|
||||||
|
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_PRECISION,
|
||||||
|
D2D1_PROPERTY_TYPE_ENUM, (BYTE *)&precision, sizeof(precision));
|
||||||
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
if (hr == S_OK)
|
||||||
|
ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %u.\n", precision);
|
||||||
|
|
||||||
|
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MIN_INPUTS,
|
||||||
|
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&min_inputs, sizeof(min_inputs));
|
||||||
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
if (hr == S_OK)
|
||||||
|
ok(min_inputs == test->min_inputs, "Got unexpected min inputs %u, expected %u.\n",
|
||||||
|
min_inputs, test->min_inputs);
|
||||||
|
|
||||||
|
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MAX_INPUTS,
|
||||||
|
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&max_inputs, sizeof(max_inputs));
|
||||||
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
if (hr == S_OK)
|
||||||
|
ok(max_inputs == test->max_inputs, "Got unexpected max inputs %u, expected %u.\n",
|
||||||
|
max_inputs, test->max_inputs);
|
||||||
|
}
|
||||||
|
|
||||||
ID2D1Effect_Release(effect);
|
ID2D1Effect_Release(effect);
|
||||||
|
winetest_pop_context();
|
||||||
|
}
|
||||||
|
|
||||||
ID2D1DeviceContext_Release(context);
|
ID2D1DeviceContext_Release(context);
|
||||||
ID2D1Factory1_Release(factory);
|
ID2D1Factory1_Release(factory);
|
||||||
release_test_context(&ctx);
|
release_test_context(&ctx);
|
||||||
|
|
Loading…
Reference in New Issue