[gtk/curve-ops: 41/97] testsuite: Add relative path functions
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/curve-ops: 41/97] testsuite: Add relative path functions
- Date: Sat, 19 Dec 2020 19:04:31 +0000 (UTC)
commit d4b5d9bae552c46a52390d9a9c86129461c52989
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 2d30af5858..0765abf5fa 100644
--- a/testsuite/gsk/path.c
+++ b/testsuite/gsk/path.c
@@ -184,16 +184,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,
@@ -202,6 +209,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),
@@ -211,6 +224,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]