Signed-off-by: Ziqing Hui zhui@codeweavers.com --- dlls/d2d1/tests/d2d1.c | 59 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 629bbd65523..7971d1396bc 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9680,13 +9680,16 @@ static void test_mt_factory(BOOL d3d11)
static void test_effect(BOOL d3d11) { - unsigned int i, min_inputs, max_inputs, str_size; + unsigned int i, j, min_inputs, max_inputs, str_size, input_count, off_limit_tests = 4; + D2D1_BITMAP_PROPERTIES bitmap_desc; D2D1_BUFFER_PRECISION precision; ID2D1Image *image_a, *image_b; struct d2d1_test_context ctx; ID2D1DeviceContext *context; ID2D1Factory1 *factory; + ID2D1Bitmap *bitmap; ID2D1Effect *effect; + D2D1_SIZE_U size; BYTE buffer[64]; BOOL cached; CLSID clsid; @@ -9797,6 +9800,60 @@ static void test_effect(BOOL d3d11) max_inputs, test->max_inputs); }
+ todo_wine + { + input_count = ID2D1Effect_GetInputCount(effect); + ok (input_count == 1 || input_count == 2, "Got unexpected input count %u.\n", input_count); + + input_count = (test->max_inputs < 16 ? test->max_inputs : 16); + for (j = 0; j < input_count + off_limit_tests; ++j) + { + hr = ID2D1Effect_SetInputCount(effect, j); + if (j < test->min_inputs || j > test->max_inputs) + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + else + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + } + + input_count = ID2D1Effect_GetInputCount(effect); + for (j = 0; j < input_count + off_limit_tests; ++j) + { + ID2D1Effect_GetInput(effect, j, &image_a); + ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a); + } + } + + set_size_u(&size, 1, 1); + bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; + bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; + bitmap_desc.dpiX = 96.0f; + bitmap_desc.dpiY = 96.0f; + hr = ID2D1RenderTarget_CreateBitmap(ctx.rt, size, NULL, 4, &bitmap_desc, &bitmap); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + todo_wine + { + ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE); + for (j = 0; j < input_count + off_limit_tests; ++j) + { + image_a = (ID2D1Image *)0xdeadbeef; + if (j >= input_count) + ID2D1Effect_SetInput(effect, j, (ID2D1Image *)bitmap, FALSE); + ID2D1Effect_GetInput(effect, j, &image_a); + if (j == 0) + { + ok(image_a == (ID2D1Image *)bitmap, "Got unexpected image_a %p.\n", image_a); + if (image_a == (ID2D1Image *)bitmap) + ID2D1Image_Release(image_a); + } + else + { + ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a); + } + } + ID2D1Bitmap_Release(bitmap); + } + ID2D1Effect_Release(effect); winetest_pop_context(); }