From ccbd7281b25f4b25a4c324aa815b94d7de76ac90 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 13 Aug 2011 09:22:15 +0100 Subject: [PATCH] test/line-width: Add a non-antialiased variant Signed-off-by: Chris Wilson --- test/Makefile.refs | 1 + test/a1-line-width.ref.png | Bin 0 -> 154 bytes test/line-width.c | 38 +++++++++++++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 test/a1-line-width.ref.png diff --git a/test/Makefile.refs b/test/Makefile.refs index bbf64dd18..5a733864c 100644 --- a/test/Makefile.refs +++ b/test/Makefile.refs @@ -11,6 +11,7 @@ REFERENCE_IMAGES = \ a1-clip-stroke.ref.png \ a1-image-sample.gl.xfail.png \ a1-image-sample.ref.png \ + a1-line-width.ref.png \ a1-mask-sample.ref.png \ a1-mask.ref.png \ a1-rasterisation-rectangles.quartz.xfail.png \ diff --git a/test/a1-line-width.ref.png b/test/a1-line-width.ref.png new file mode 100644 index 0000000000000000000000000000000000000000..35d9cad6062a5b934906b35ccac151c5babac6de GIT binary patch literal 154 zcmeAS@N?(olHy`uVBq!ia0vp^Qa~)h!2~3;A5={OQfx`y?k)`fL2$v|<&%LT{+=$5 zAr`&KfByfsXa35--IA1&a%6Ewg|?(;fLF^@6$y79g@c=qtVmom@3e#j+ojDQ5s8Kk x$&O~TiwqWBy8FN^&m?>TKil@gX6y4z41dxr6(<~@lmj%H!PC{xWt~$(69DO{GtdA4 literal 0 HcmV?d00001 diff --git a/test/line-width.c b/test/line-width.c index e612a93bb..66924f188 100644 --- a/test/line-width.c +++ b/test/line-width.c @@ -31,7 +31,7 @@ #define IMAGE_HEIGHT ((LINES+4)*LINES)/2 + 2 static cairo_test_status_t -draw (cairo_t *cr, int width, int height) +draw_a8 (cairo_t *cr, int width, int height) { int i; @@ -56,9 +56,43 @@ draw (cairo_t *cr, int width, int height) return CAIRO_TEST_SUCCESS; } +static cairo_test_status_t +draw_a1 (cairo_t *cr, int width, int height) +{ + int i; + + /* We draw in black, so paint white first. */ + cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */ + cairo_paint (cr); + + cairo_set_source_rgb (cr, 0, 0, 0); + cairo_translate (cr, 2, 2); + + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); + + for (i=0; i < LINES; i++) { + cairo_set_line_width (cr, i+1); + cairo_move_to (cr, 0, 0); + cairo_rel_line_to (cr, LINE_LENGTH, 0); + cairo_stroke (cr); + cairo_move_to (cr, LINE_LENGTH + 2, 0.5); + cairo_rel_line_to (cr, LINE_LENGTH, 0); + cairo_stroke (cr); + cairo_translate (cr, 0, i+3); + } + + return CAIRO_TEST_SUCCESS; +} + CAIRO_TEST (line_width, "Tests cairo_set_line_width", "stroke", /* keywords */ NULL, /* requirements */ IMAGE_WIDTH, IMAGE_HEIGHT, - NULL, draw) + NULL, draw_a8) +CAIRO_TEST (a1_line_width, + "Tests cairo_set_line_width", + "stroke", /* keywords */ + NULL, /* requirements */ + IMAGE_WIDTH, IMAGE_HEIGHT, + NULL, draw_a1)