summaryrefslogtreecommitdiff
path: root/test/fallback-resolution.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-09-28 21:05:36 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-09-28 21:05:36 +0100
commit4f449107afba8ca96cd16e8dec283db124105dc8 (patch)
tree93b34cec025f3111398f67535edd6d3cf9bcd4b6 /test/fallback-resolution.c
parent0a7d781ab020171e70bd1dc66ff1556106e5be3f (diff)
downloadcairo-4f449107afba8ca96cd16e8dec283db124105dc8.tar.gz
[test/fallback-resolution] Exercise a couple of outstanding bugs.
Use dashes to exercise bugs: https://bugs.freedesktop.org/show_bug.cgi?id=9189 https://bugs.freedesktop.org/show_bug.cgi?id=17223 Note bug 17223 indicates that this is still relevant for win32 printing where fallbacks are used if the dash offset is non-zero. And use a pattern to exercise the (fixed) regression: https://bugs.launchpad.net/inkscape/+bug/234546
Diffstat (limited to 'test/fallback-resolution.c')
-rw-r--r--test/fallback-resolution.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index 6f814a8eb..4e78577da 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -53,7 +53,7 @@
*/
#define INCHES_TO_POINTS(in) ((in) * 72.0)
-#define SIZE INCHES_TO_POINTS(1)
+#define SIZE INCHES_TO_POINTS(2)
/* cairo_set_tolerance() is not respected by the PS/PDF backends currently */
#define SET_TOLERANCE 0
@@ -65,21 +65,57 @@ draw (cairo_t *cr, double width, double height)
{
const char *text = "cairo";
cairo_text_extents_t extents;
+ const double dash[2] = { 8, 16 };
+ cairo_pattern_t *pattern;
cairo_save (cr);
cairo_new_path (cr);
cairo_set_line_width (cr, .05 * SIZE / 2.0);
+
+ cairo_arc (cr, SIZE / 2.0, SIZE / 2.0,
+ 0.875 * SIZE / 2.0,
+ 0, 2.0 * M_PI);
+ cairo_stroke (cr);
+
+ /* use dashes to demonstrate bugs:
+ * https://bugs.freedesktop.org/show_bug.cgi?id=9189
+ * https://bugs.freedesktop.org/show_bug.cgi?id=17223
+ */
+ cairo_save (cr);
+ cairo_set_dash (cr, dash, 2, 0);
cairo_arc (cr, SIZE / 2.0, SIZE / 2.0,
0.75 * SIZE / 2.0,
0, 2.0 * M_PI);
cairo_stroke (cr);
+ cairo_restore (cr);
+ cairo_save (cr);
+ cairo_rectangle (cr, 0, 0, SIZE/2, SIZE);
+ cairo_clip (cr);
cairo_arc (cr, SIZE / 2.0, SIZE / 2.0,
0.6 * SIZE / 2.0,
0, 2.0 * M_PI);
cairo_fill (cr);
+ cairo_restore (cr);
+
+ /* use a pattern to exercise bug:
+ * https://bugs.launchpad.net/inkscape/+bug/234546
+ */
+ cairo_save (cr);
+ cairo_rectangle (cr, SIZE/2, 0, SIZE/2, SIZE);
+ cairo_clip (cr);
+ pattern = cairo_pattern_create_linear (SIZE/2, 0, SIZE, 0);
+ cairo_pattern_add_color_stop_rgba (pattern, 0, 0, 0, 0, 1.);
+ cairo_pattern_add_color_stop_rgba (pattern, 1, 0, 0, 0, 0.);
+ cairo_set_source (cr, pattern);
+ cairo_pattern_destroy (pattern);
+ cairo_arc (cr, SIZE / 2.0, SIZE / 2.0,
+ 0.6 * SIZE / 2.0,
+ 0, 2.0 * M_PI);
+ cairo_fill (cr);
+ cairo_restore (cr);
cairo_set_source_rgb (cr, 1, 1, 1); /* white */
cairo_set_font_size (cr, .25 * SIZE / 2.0);
@@ -193,7 +229,7 @@ check_result (cairo_test_context_t *ctx,
if (status) {
cairo_test_log (ctx, "Error: Failed to compare images: %s\n",
cairo_status_to_string (status));
- ret = TRUE;
+ ret = FALSE;
} else if (result.pixels_changed &&
result.max_diff > target->error_tolerance)
{