[PATCH 2/3] d2d1/tests: Add tests for effect inputs.

Ziqing Hui zhui at codeweavers.com
Thu Jul 29 22:52:58 CDT 2021


Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
---
 dlls/d2d1/tests/d2d1.c | 53 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 629bbd65523..76ac27f11c6 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;
+    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,54 @@ 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 < 64 ? test->max_inputs + 1 : 64);
+        for (j = 0; j < input_count; ++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 + 8; ++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 + 8; ++j)
+        {
+            if (j >= input_count)
+                ID2D1Effect_SetInput(effect, 0, (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);
+            else
+                ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a);
+            if (image_a)
+                ID2D1Image_Release(image_a);
+        }
+        ID2D1Bitmap_Release(bitmap);
+        }
+
         ID2D1Effect_Release(effect);
         winetest_pop_context();
     }
-- 
2.25.1




More information about the wine-devel mailing list