Nikolay Sivov : d2d1/tests: Use test context for command list test.

Alexandre Julliard julliard at winehq.org
Wed Aug 3 15:30:39 CDT 2022


Module: wine
Branch: master
Commit: 56b50f158d4f2236614a28c250cddf512568bcea
URL:    https://gitlab.winehq.org/wine/wine/-/commit/56b50f158d4f2236614a28c250cddf512568bcea

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Jul 30 23:36:57 2022 +0300

d2d1/tests: Use test context for command list test.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>

---

 dlls/d2d1/tests/d2d1.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 22e020bebb9..53e02bbfc30 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -9445,7 +9445,6 @@ static void test_command_list(BOOL d3d11)
     ID2D1CommandList *command_list;
     struct d2d1_test_context ctx;
     ID2D1Geometry *geometry;
-    ID2D1Factory1 *factory;
     ID2D1RenderTarget *rt;
     D2D1_POINT_2F p0, p1;
     ID2D1Bitmap *bitmap;
@@ -9460,23 +9459,20 @@ static void test_command_list(BOOL d3d11)
     if (!init_test_context(&ctx, d3d11))
         return;
 
-    if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory)))
+    if (!ctx.factory1)
     {
-        win_skip("ID2D1Factory1 is not supported.\n");
+        win_skip("Command lists are not supported.\n");
         release_test_context(&ctx);
         return;
     }
 
-    device_context = create_device_context(factory, ctx.device, d3d11);
-    ok(device_context != NULL, "Failed to create device context.\n");
+    device_context = ctx.context;
 
     hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list);
     todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
 
     if (FAILED(hr))
     {
-        ID2D1DeviceContext_Release(device_context);
-        ID2D1Factory1_Release(factory);
         release_test_context(&ctx);
         return;
     }
@@ -9542,7 +9538,7 @@ static void test_command_list(BOOL d3d11)
     ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
 
     set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
-    hr = ID2D1Factory1_CreateRectangleGeometry(factory, &rect, (ID2D1RectangleGeometry **)&geometry);
+    hr = ID2D1Factory1_CreateRectangleGeometry(ctx.factory1, &rect, (ID2D1RectangleGeometry **)&geometry);
     ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
 
     ID2D1RenderTarget_FillGeometry(rt, geometry, brush, NULL);
@@ -9570,7 +9566,7 @@ static void test_command_list(BOOL d3d11)
     ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
 
     set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
-    hr = ID2D1Factory1_CreateRectangleGeometry(factory, &rect, (ID2D1RectangleGeometry **)&geometry);
+    hr = ID2D1Factory1_CreateRectangleGeometry(ctx.factory1, &rect, (ID2D1RectangleGeometry **)&geometry);
     ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
 
     ID2D1RenderTarget_FillGeometry(rt, geometry, brush, NULL);
@@ -9586,7 +9582,7 @@ static void test_command_list(BOOL d3d11)
 
     /* Geometry. */
     set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
-    hr = ID2D1Factory1_CreateRectangleGeometry(factory, &rect, (ID2D1RectangleGeometry **)&geometry);
+    hr = ID2D1Factory1_CreateRectangleGeometry(ctx.factory1, &rect, (ID2D1RectangleGeometry **)&geometry);
     ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
 
     set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f);
@@ -9610,7 +9606,7 @@ static void test_command_list(BOOL d3d11)
     stroke_desc.dashStyle = D2D1_DASH_STYLE_DOT;
     stroke_desc.dashOffset = -1.0f;
 
-    hr = ID2D1Factory_CreateStrokeStyle((ID2D1Factory *)factory, &stroke_desc, NULL, 0, &stroke_style);
+    hr = ID2D1Factory_CreateStrokeStyle((ID2D1Factory *)ctx.factory, &stroke_desc, NULL, 0, &stroke_style);
     ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
 
     set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f);
@@ -9653,7 +9649,7 @@ static void test_command_list(BOOL d3d11)
     ID2D1CommandList_Release(command_list);
 
     /* List created with different context. */
-    device_context2 = create_device_context(factory, ctx.device, d3d11);
+    device_context2 = create_device_context(ctx.factory1, ctx.device, d3d11);
     ok(device_context2 != NULL, "Failed to create device context.\n");
 
     hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list);
@@ -9667,8 +9663,6 @@ static void test_command_list(BOOL d3d11)
     ID2D1DeviceContext_Release(device_context2);
 
     ID2D1RenderTarget_Release(rt);
-    ID2D1DeviceContext_Release(device_context);
-    ID2D1Factory1_Release(factory);
     release_test_context(&ctx);
 }
 




More information about the wine-cvs mailing list