summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-02-13 18:36:12 +0100
committerAndrea Canciani <ranma42@gmail.com>2011-02-13 20:49:47 +0100
commit5fa49462be24b7fc7f32032d8577703f1d0f463a (patch)
tree6fe3c3275695a8290f312ef8aec0143138b90b01
parent34612c400d3b66daf265529d90a3dcd1a8afdbcb (diff)
test: Fix surface-pattern-scale-down-extend
This test creates a similar surface using cairo_push_group () and assumes its size will be w x h. This is not true when testing similar surfaces with "cairo-test-suite -a", because they are bigger than the actual ROI, which corresponds to the rectangle (0,0) - (w,h). Clipping to the ROI guarantees that the surface created by cairo_push_group () always has the same size. Fixes surface-pattern-scale-down-extend.
-rw-r--r--test/surface-pattern-scale-down-extend.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/surface-pattern-scale-down-extend.c b/test/surface-pattern-scale-down-extend.c
index 80338611b..191ab927f 100644
--- a/test/surface-pattern-scale-down-extend.c
+++ b/test/surface-pattern-scale-down-extend.c
@@ -39,6 +39,17 @@ draw_with_extend (cairo_t *cr, int w, int h, cairo_extend_t extend)
cairo_set_source_rgb (cr, 1,1,1);
cairo_paint (cr);
+ cairo_save (cr);
+
+ /* When the destination surface is created by cairo-test-suite to
+ * test device-offset, it is bigger than w x h. This test expects
+ * the group to have a size which is exactly w x h, so it must
+ * clip to the this rectangle to guarantee that the group will
+ * have the correct size.
+ */
+ cairo_rectangle (cr, 0, 0, w, h);
+ cairo_clip (cr);
+
cairo_push_group_with_content (cr, CAIRO_CONTENT_COLOR); {
/* A two by two checkerboard with black, red and yellow
* cells. */
@@ -52,6 +63,8 @@ draw_with_extend (cairo_t *cr, int w, int h, cairo_extend_t extend)
pattern = cairo_pop_group (cr);
cairo_pattern_set_extend(pattern, extend);
+ cairo_restore (cr);
+
cairo_scale (cr, 0.5, 0.5);
cairo_set_source (cr, pattern);
cairo_paint (cr);