[gtk/wip/otte/lottie: 2/2] testsuite: Add conics to the random paths




commit 45c5e3a91f5195719e722bb53c11db2e7fe6fd09
Author: Benjamin Otte <otte redhat com>
Date:   Tue Dec 8 00:31:57 2020 +0100

    testsuite: Add conics to the random paths

 testsuite/gsk/path.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/testsuite/gsk/path.c b/testsuite/gsk/path.c
index 6b49b862c0..0583c6705d 100644
--- a/testsuite/gsk/path.c
+++ b/testsuite/gsk/path.c
@@ -178,6 +178,15 @@ add_shape_contour (GskPathBuilder *builder)
   }
 }
 
+static float
+random_weight (void)
+{
+  if (g_test_rand_bit ())
+    return g_test_rand_double_range (0, 100);
+  else
+    return 1.0 / g_test_rand_double_range (1, 100);
+}
+
 static void
 add_standard_contour (GskPathBuilder *builder)
 {
@@ -200,7 +209,7 @@ add_standard_contour (GskPathBuilder *builder)
   n = g_test_rand_int_range (1, 20);
   for (i = 0; i < n; i++)
     {
-      switch (g_test_rand_int_range (0, 4))
+      switch (g_test_rand_int_range (0, 6))
       {
         case 0:
           gsk_path_builder_line_to (builder,
@@ -234,6 +243,24 @@ add_standard_contour (GskPathBuilder *builder)
                                          g_test_rand_double_range (-1000, 1000));
           break;
 
+        case 4:
+          gsk_path_builder_conic_to (builder,
+                                     g_test_rand_double_range (-1000, 1000),
+                                     g_test_rand_double_range (-1000, 1000),
+                                     g_test_rand_double_range (-1000, 1000),
+                                     g_test_rand_double_range (-1000, 1000),
+                                     random_weight ());
+          break;
+
+        case 5:
+          gsk_path_builder_rel_conic_to (builder,
+                                         g_test_rand_double_range (-1000, 1000),
+                                         g_test_rand_double_range (-1000, 1000),
+                                         g_test_rand_double_range (-1000, 1000),
+                                         g_test_rand_double_range (-1000, 1000),
+                                         random_weight ());
+          break;
+
         default:
           g_assert_not_reached();
           break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]