[gtk/path-work-rebased: 36/121] testsuite: Add relative path functions




commit 7f63e426ccb11db7d1ffa13b2ab13dc7a28981ac
Author: Benjamin Otte <otte redhat com>
Date:   Mon Nov 30 05:02:00 2020 +0100

    testsuite: Add relative path functions
    
    They're making the paths slightly weirder, but they test public API, so
    woohoo!

 testsuite/gsk/path.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/testsuite/gsk/path.c b/testsuite/gsk/path.c
index ff3ca9b368..356eae2d5b 100644
--- a/testsuite/gsk/path.c
+++ b/testsuite/gsk/path.c
@@ -209,16 +209,23 @@ add_standard_contour (GskPathBuilder *builder)
   guint i, n;
 
   if (g_test_rand_bit ())
-    gsk_path_builder_move_to (builder,
-                              g_test_rand_double_range (-1000, 1000),
-                              g_test_rand_double_range (-1000, 1000));
+    {
+      if (g_test_rand_bit ())
+        gsk_path_builder_move_to (builder,
+                                  g_test_rand_double_range (-1000, 1000),
+                                  g_test_rand_double_range (-1000, 1000));
+      else
+        gsk_path_builder_rel_move_to (builder,
+                                      g_test_rand_double_range (-1000, 1000),
+                                      g_test_rand_double_range (-1000, 1000));
+    }
 
   /* that 20 is random, but should be enough to get some
    * crazy self-intersecting shapes */
   n = g_test_rand_int_range (1, 20);
   for (i = 0; i < n; i++)
     {
-      switch (g_test_rand_int_range (0, 2))
+      switch (g_test_rand_int_range (0, 4))
       {
         case 0:
           gsk_path_builder_line_to (builder,
@@ -227,6 +234,12 @@ add_standard_contour (GskPathBuilder *builder)
           break;
 
         case 1:
+          gsk_path_builder_rel_line_to (builder,
+                                        g_test_rand_double_range (-1000, 1000),
+                                        g_test_rand_double_range (-1000, 1000));
+          break;
+
+        case 2:
           gsk_path_builder_curve_to (builder,
                                      g_test_rand_double_range (-1000, 1000),
                                      g_test_rand_double_range (-1000, 1000),
@@ -236,6 +249,16 @@ add_standard_contour (GskPathBuilder *builder)
                                      g_test_rand_double_range (-1000, 1000));
           break;
 
+        case 3:
+          gsk_path_builder_rel_curve_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),
+                                         g_test_rand_double_range (-1000, 1000),
+                                         g_test_rand_double_range (-1000, 1000));
+          break;
+
         default:
           g_assert_not_reached();
           break;


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