File 0004-d2d1-tests-Test-coincident-last-first-vertex-for-bot.patch of Package wine
From 26747be3808434d58d34598778f4e46f3cd32141 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Thu, 6 Jan 2022 06:48:03 +0100
Subject: [PATCH 04/10] d2d1/tests: Test coincident last/first vertex for both
OPEN and CLOSED
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Provide two orientatations for both cases (END_OPEN/END_CLOSED) each.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51139
Signed-off-by: Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de>
---
dlls/d2d1/tests/d2d1.c | 81 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 3b7c45357ae..9f2c432c55e 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -3083,6 +3083,23 @@ static void test_path_geometry(BOOL d3d11)
/* Figure 28. */
{SEGMENT_LINE, {{{ 75.0f, 300.0f}}}},
{SEGMENT_LINE, {{{ 5.0f, 300.0f}}}},
+ /* Figure 29. */
+ {SEGMENT_LINE, {{{ 40.0f, 100.0f}}}},
+ {SEGMENT_BEZIER, {{{4.00000000e+01f, 7.66666666e+01f},
+ {3.33333333e+01f, 7.00000000e+01f},
+ {2.00000000e+01f, 8.00000000e+01f}}}},
+ {SEGMENT_LINE, {{{ 60.0f, 40.0f}}}},
+ {SEGMENT_BEZIER, {{{8.33333333e+01f, 4.00000000e+01f},
+ {9.00000000e+01f, 3.33333333e+01f},
+ {8.00000000e+01f, 2.00000000e+01f}}}},
+ {SEGMENT_LINE, {{{140.0f, 160.0f}}}},
+ {SEGMENT_BEZIER, {{{1.16666666e+02f, 1.60000000e+02f},
+ {1.10000000e+02f, 1.66666666e+02f},
+ {1.20000000e+02f, 1.80000000e+02f}}}},
+ {SEGMENT_LINE, {{{170.0f, 110.0f}}}},
+ {SEGMENT_BEZIER, {{{1.70000000e+02f, 1.26666666e+02f},
+ {1.73333333e+02f, 1.30000000e+02f},
+ {1.80000000e+02f, 1.20000000e+02f}}}},
};
static const struct expected_geometry_figure expected_figures[] =
{
@@ -3126,6 +3143,11 @@ static void test_path_geometry(BOOL d3d11)
{D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 20.0f, 612.0f}, 8, &expected_segments[164]},
/* 28 */
{D2D1_FIGURE_BEGIN_HOLLOW, D2D1_FIGURE_END_OPEN, { 40.0f, 20.0f}, 2, &expected_segments[172]},
+ /* 29 */
+ {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_OPEN, { 20.0f, 80.0f}, 2, &expected_segments[174]},
+ {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_OPEN, { 80.0f, 20.0f}, 2, &expected_segments[176]},
+ {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 120.0f, 180.0f}, 2, &expected_segments[178]},
+ {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 180.0f, 120.0f}, 2, &expected_segments[180]},
};
if (!init_test_context(&ctx, d3d11))
@@ -3871,6 +3893,65 @@ static void test_path_geometry(BOOL d3d11)
ID2D1PathGeometry_Release(geometry);
+ hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
+ ok(SUCCEEDED(hr), "Failed to create path geometry, hr %#x.\n", hr);
+ hr = ID2D1PathGeometry_Open(geometry, &sink);
+ ok(SUCCEEDED(hr), "Failed to open geometry sink, hr %#x.\n", hr);
+
+#if 0
+ set_point(&point, 20.0f, 80.0f);
+ ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
+ line_to(sink, 40.0f, 100.0f);
+ quadratic_to(sink, 40.0f, 65.0f, 20.0f, 80.0f);
+ ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
+
+ set_point(&point, 80.0f, 20.0f);
+ ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
+ line_to(sink, 60.0f, 40.0f);
+ quadratic_to(sink, 95.0f, 40.0f, 80.0f, 20.0f);
+ ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
+#endif
+
+ set_point(&point, 120.0f, 180.0f);
+ ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
+ line_to(sink, 140.0f, 160.0f);
+ quadratic_to(sink, 105.0f, 160.0f, 120.0f, 180.0f);
+ ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
+
+ set_point(&point, 180.0f, 120.0f);
+ ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
+ line_to(sink, 170.0f, 110.0f);
+ quadratic_to(sink, 170.0f, 135.0f, 180.0f, 120.0f);
+ ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
+
+ hr = ID2D1GeometrySink_Close(sink);
+ ok(SUCCEEDED(hr), "Failed to close geometry sink, hr %#x.\n", hr);
+ ID2D1GeometrySink_Release(sink);
+
+ set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
+ hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
+ ok(SUCCEEDED(hr), "Failed to get geometry bounds, hr %#x.\n", hr);
+#if 0
+ match = compare_rect(&rect, 20.0f, 20.0f, 180.0f, 180.0f, 0);
+#else
+ match = compare_rect(&rect, 115.5f, 110.0f, 180.0f, 180.0f, 1);
+#endif
+ ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
+ rect.left, rect.top, rect.right, rect.bottom);
+
+ geometry_sink_init(&simplify_sink);
+ hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
+ NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
+ ok(SUCCEEDED(hr), "Failed to simplify geometry, hr %#x.\n", hr);
+#if 0
+ geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 4, &expected_figures[29], 1);
+#else
+ geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 2, &expected_figures[31], 1);
+#endif
+ geometry_sink_cleanup(&simplify_sink);
+
+ ID2D1PathGeometry_Release(geometry);
+
ID2D1SolidColorBrush_Release(brush);
ID2D1Factory_Release(factory);
release_test_context(&ctx);
--
2.34.1