diff --git a/testsuite/gsk/path-private.c b/testsuite/gsk/path-private.c index 3d2e3d74c4..c882b4ce7e 100644 --- a/testsuite/gsk/path-private.c +++ b/testsuite/gsk/path-private.c @@ -47,12 +47,46 @@ test_roundtrip_circle (void) gsk_path_unref (path); } +static void +test_roundtrip_rounded_rect (void) +{ + GskRoundedRect rr; + GskPathBuilder *builder; + GskPath *path, *path2; + const GskContour *contour; + char *s; + + rr.bounds = GRAPHENE_RECT_INIT (100, 100, 200, 150); + rr.corner[GSK_CORNER_TOP_LEFT] = GRAPHENE_SIZE_INIT (10, 10); + rr.corner[GSK_CORNER_TOP_RIGHT] = GRAPHENE_SIZE_INIT (20, 10); + rr.corner[GSK_CORNER_BOTTOM_RIGHT] = GRAPHENE_SIZE_INIT (20, 0); + rr.corner[GSK_CORNER_BOTTOM_LEFT] = GRAPHENE_SIZE_INIT (0, 0); + + builder = gsk_path_builder_new (); + gsk_path_builder_add_rounded_rect (builder, &rr); + path = gsk_path_builder_free_to_path (builder); + contour = gsk_path_get_contour (path, 0); + + g_assert_cmpstr (gsk_contour_get_type_name (contour), ==, "GskRoundedRectContour"); + + s = gsk_path_to_string (path); + path2 = gsk_path_parse (s); + contour = gsk_path_get_contour (path2, 0); + + g_assert_cmpstr (gsk_contour_get_type_name (contour), ==, "GskRoundedRectContour"); + + g_free (s); + gsk_path_unref (path2); + gsk_path_unref (path); +} + int main (int argc, char *argv[]) { gtk_test_init (&argc, &argv, NULL); g_test_add_func ("/path/roundtrip/circle", test_roundtrip_circle); + g_test_add_func ("/path/roundtrip/rounded-rect", test_roundtrip_rounded_rect); return g_test_run (); }