summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-04 11:34:31 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-04 11:52:26 +0100
commita2d852497364afa742518ac0d9feb0466dccc191 (patch)
tree11a1766bc4e1cbe6f5cd1f724bce1dd1fc906c6d
parent85c2a0d76ab109f2bec8f7dccab577033e6d37b0 (diff)
test: Expand testing of caps for fine strokes
-rw-r--r--test/caps.c57
-rw-r--r--test/reference/caps-05.ref.pngbin0 -> 1375 bytes
-rw-r--r--test/reference/caps-05.traps.ref.pngbin0 -> 1126 bytes
-rw-r--r--test/reference/caps-1.ref.pngbin0 -> 1457 bytes
-rw-r--r--test/reference/caps-1.traps.ref.pngbin0 -> 1268 bytes
-rw-r--r--test/reference/caps-2.ref.pngbin0 -> 1509 bytes
-rw-r--r--test/reference/caps-2.traps.ref.pngbin0 -> 1231 bytes
7 files changed, 54 insertions, 3 deletions
diff --git a/test/caps.c b/test/caps.c
index 7f5611791..cde2773f9 100644
--- a/test/caps.c
+++ b/test/caps.c
@@ -45,14 +45,13 @@ make_path (cairo_t *cr)
}
static cairo_test_status_t
-draw (cairo_t *cr, int width, int height)
+draw (cairo_t *cr)
{
cairo_save (cr);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
cairo_paint (cr);
cairo_restore (cr);
- cairo_set_line_width (cr, LINE_WIDTH);
cairo_translate (cr, PAD + SIZE / 2., PAD + SIZE / 2.);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
@@ -77,11 +76,63 @@ 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)
+{
+ cairo_set_line_width (cr, LINE_WIDTH);
+ return draw (cr);
+}
+
+static cairo_test_status_t
+draw_2 (cairo_t *cr, int width, int height)
+{
+ cairo_set_line_width (cr, 2);
+ return draw (cr);
+}
+
+static cairo_test_status_t
+draw_1 (cairo_t *cr, int width, int height)
+{
+ cairo_set_line_width (cr, 1);
+ return draw (cr);
+}
+
+static cairo_test_status_t
+draw_05 (cairo_t *cr, int width, int height)
+{
+ cairo_set_line_width (cr, 0.5);
+ return draw (cr);
+}
+
CAIRO_TEST (caps,
"Test caps",
"stroke caps", /* keywords */
NULL, /* requirements */
PAD + SIZE + PAD,
3 * (PAD + SIZE) + PAD,
- NULL, draw)
+ NULL, draw_10)
+
+CAIRO_TEST (caps_2,
+ "Test normal caps",
+ "stroke caps", /* keywords */
+ NULL, /* requirements */
+ PAD + SIZE + PAD,
+ 3 * (PAD + SIZE) + PAD,
+ NULL, draw_2)
+
+CAIRO_TEST (caps_1,
+ "Test hairline caps",
+ "stroke caps", /* keywords */
+ NULL, /* requirements */
+ PAD + SIZE + PAD,
+ 3 * (PAD + SIZE) + PAD,
+ NULL, draw_1)
+
+CAIRO_TEST (caps_05,
+ "Test fine caps",
+ "stroke caps", /* keywords */
+ NULL, /* requirements */
+ PAD + SIZE + PAD,
+ 3 * (PAD + SIZE) + PAD,
+ NULL, draw_05)
diff --git a/test/reference/caps-05.ref.png b/test/reference/caps-05.ref.png
new file mode 100644
index 000000000..946adcbfa
--- /dev/null
+++ b/test/reference/caps-05.ref.png
Binary files differ
diff --git a/test/reference/caps-05.traps.ref.png b/test/reference/caps-05.traps.ref.png
new file mode 100644
index 000000000..409bdab07
--- /dev/null
+++ b/test/reference/caps-05.traps.ref.png
Binary files differ
diff --git a/test/reference/caps-1.ref.png b/test/reference/caps-1.ref.png
new file mode 100644
index 000000000..dfb111808
--- /dev/null
+++ b/test/reference/caps-1.ref.png
Binary files differ
diff --git a/test/reference/caps-1.traps.ref.png b/test/reference/caps-1.traps.ref.png
new file mode 100644
index 000000000..10f7d57a3
--- /dev/null
+++ b/test/reference/caps-1.traps.ref.png
Binary files differ
diff --git a/test/reference/caps-2.ref.png b/test/reference/caps-2.ref.png
new file mode 100644
index 000000000..ca420bcab
--- /dev/null
+++ b/test/reference/caps-2.ref.png
Binary files differ
diff --git a/test/reference/caps-2.traps.ref.png b/test/reference/caps-2.traps.ref.png
new file mode 100644
index 000000000..1c5d88574
--- /dev/null
+++ b/test/reference/caps-2.traps.ref.png
Binary files differ