summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-04 11:47:07 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-04 11:52:30 +0100
commite34b800214c78ec3d92de505d173fc617cf6220f (patch)
treec71d425cd2b954984d4afaed45a3b17a4c1f7cf5 /test
parenta2d852497364afa742518ac0d9feb0466dccc191 (diff)
test: Extend testing of joins for fine lines
Diffstat (limited to 'test')
-rw-r--r--test/caps-joins.c55
-rw-r--r--test/reference/caps-joins-05.ref.pngbin0 -> 2169 bytes
-rw-r--r--test/reference/caps-joins-05.traps.ref.pngbin0 -> 1714 bytes
-rw-r--r--test/reference/caps-joins-1.ref.pngbin0 -> 2105 bytes
-rw-r--r--test/reference/caps-joins-1.traps.ref.pngbin0 -> 1861 bytes
-rw-r--r--test/reference/caps-joins-2.ref.pngbin0 -> 2046 bytes
-rw-r--r--test/reference/caps-joins-2.traps.ref.pngbin0 -> 1631 bytes
7 files changed, 51 insertions, 4 deletions
diff --git a/test/caps-joins.c b/test/caps-joins.c
index 9d1c2a889..de22d0367 100644
--- a/test/caps-joins.c
+++ b/test/caps-joins.c
@@ -72,7 +72,7 @@ draw_caps_joins (cairo_t *cr)
}
static cairo_test_status_t
-draw (cairo_t *cr, int width, int height)
+draw (cairo_t *cr, float line_width)
{
/* We draw in the default black, so paint white first. */
cairo_save (cr);
@@ -80,12 +80,12 @@ draw (cairo_t *cr, int width, int height)
cairo_paint (cr);
cairo_restore (cr);
- cairo_set_line_width (cr, LINE_WIDTH);
+ cairo_set_line_width (cr, line_width);
draw_caps_joins (cr);
/* and reflect to generate the opposite vertex ordering */
- cairo_translate (cr, 0, height);
+ cairo_translate (cr, 0, 2 * (PAD + SIZE) + PAD);
cairo_scale (cr, 1, -1);
draw_caps_joins (cr);
@@ -93,11 +93,58 @@ draw (cairo_t *cr, int width, int height)
return CAIRO_TEST_SUCCESS;
}
+static cairo_test_status_t
+draw_10 (cairo_t *cr, int width, int height)
+{
+ return draw (cr, LINE_WIDTH);
+}
+
+static cairo_test_status_t
+draw_2 (cairo_t *cr, int width, int height)
+{
+ return draw (cr, 2.0);
+}
+
+static cairo_test_status_t
+draw_1 (cairo_t *cr, int width, int height)
+{
+ return draw (cr, 1.0);
+}
+
+static cairo_test_status_t
+draw_05 (cairo_t *cr, int width, int height)
+{
+ return draw (cr, 0.5);
+}
+
CAIRO_TEST (caps_joins,
"Test caps and joins",
"stroke", /* keywords */
NULL, /* requirements */
3 * (PAD + SIZE) + PAD,
2 * (PAD + SIZE) + PAD,
- NULL, draw)
+ NULL, draw_10)
+
+CAIRO_TEST (caps_joins_2,
+ "Test caps and joins with default line width",
+ "stroke", /* keywords */
+ NULL, /* requirements */
+ 3 * (PAD + SIZE) + PAD,
+ 2 * (PAD + SIZE) + PAD,
+ NULL, draw_2)
+CAIRO_TEST (caps_joins_1,
+ "Test caps and joins with hairlines",
+ "stroke", /* keywords */
+ NULL, /* requirements */
+ 3 * (PAD + SIZE) + PAD,
+ 2 * (PAD + SIZE) + PAD,
+ NULL, draw_1)
+
+CAIRO_TEST (caps_joins_05,
+ "Test caps and joins with fine lines",
+ "stroke", /* keywords */
+ NULL, /* requirements */
+ 3 * (PAD + SIZE) + PAD,
+ 2 * (PAD + SIZE) + PAD,
+ NULL, draw_05)
diff --git a/test/reference/caps-joins-05.ref.png b/test/reference/caps-joins-05.ref.png
new file mode 100644
index 000000000..8814acede
--- /dev/null
+++ b/test/reference/caps-joins-05.ref.png
Binary files differ
diff --git a/test/reference/caps-joins-05.traps.ref.png b/test/reference/caps-joins-05.traps.ref.png
new file mode 100644
index 000000000..938fb6d1b
--- /dev/null
+++ b/test/reference/caps-joins-05.traps.ref.png
Binary files differ
diff --git a/test/reference/caps-joins-1.ref.png b/test/reference/caps-joins-1.ref.png
new file mode 100644
index 000000000..d7cdf2c86
--- /dev/null
+++ b/test/reference/caps-joins-1.ref.png
Binary files differ
diff --git a/test/reference/caps-joins-1.traps.ref.png b/test/reference/caps-joins-1.traps.ref.png
new file mode 100644
index 000000000..d9721f29f
--- /dev/null
+++ b/test/reference/caps-joins-1.traps.ref.png
Binary files differ
diff --git a/test/reference/caps-joins-2.ref.png b/test/reference/caps-joins-2.ref.png
new file mode 100644
index 000000000..1416a54e4
--- /dev/null
+++ b/test/reference/caps-joins-2.ref.png
Binary files differ
diff --git a/test/reference/caps-joins-2.traps.ref.png b/test/reference/caps-joins-2.traps.ref.png
new file mode 100644
index 000000000..e7089a8de
--- /dev/null
+++ b/test/reference/caps-joins-2.traps.ref.png
Binary files differ