[perl-Cairo] Cairo::Pattern: make set_extend and get_extend available to all types



commit 4396d20b2de6e53986fd2ef305dee1953909e4e4
Author: Quentin Sculo <squentin free fr>
Date:   Wed Mar 31 00:45:44 2010 +0200

    Cairo::Pattern: make set_extend and get_extend available to all types
    
    The cairo manual[1] suggests that cairo_pattern_set_extend() and
    cairo_pattern_get_extend() should be made available only to surface patterns,
    but seems to be a mistake[2].
    
    [1] http://cairographics.org/manual/bindings-patterns.html
    [2] http://lists.cairographics.org/archives/cairo/2010-March/019643.html
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614495

 CairoPattern.xs  |    8 ++++----
 t/CairoPattern.t |   13 +++++++++++--
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/CairoPattern.xs b/CairoPattern.xs
index 8a39b2f..24a0791 100644
--- a/CairoPattern.xs
+++ b/CairoPattern.xs
@@ -79,6 +79,10 @@ cairo_matrix_t * cairo_pattern_get_matrix (cairo_pattern_t * pattern);
 
 cairo_status_t cairo_pattern_status (cairo_pattern_t *pattern);
 
+void cairo_pattern_set_extend (cairo_pattern_t * pattern, cairo_extend_t extend);
+
+cairo_extend_t cairo_pattern_get_extend (cairo_pattern_t * pattern);
+
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
 
 cairo_pattern_type_t cairo_pattern_get_type (cairo_pattern_t *pattern);
@@ -144,10 +148,6 @@ cairo_pattern_t_noinc * create (class, cairo_surface_t * surface);
     OUTPUT:
 	RETVAL
 
-void cairo_pattern_set_extend (cairo_pattern_t * pattern, cairo_extend_t extend);
-
-cairo_extend_t cairo_pattern_get_extend (cairo_pattern_t * pattern);
-
 void cairo_pattern_set_filter (cairo_pattern_t * pattern, cairo_filter_t filter);
 
 cairo_filter_t cairo_pattern_get_filter (cairo_pattern_t * pattern);
diff --git a/t/CairoPattern.t b/t/CairoPattern.t
index 4c75b27..f8b4951 100644
--- a/t/CairoPattern.t
+++ b/t/CairoPattern.t
@@ -10,7 +10,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 25;
+use Test::More tests => 28;
 
 unless (eval 'use Test::Number::Delta; 1;') {
 	my $reason = 'Test::Number::Delta not available';
@@ -30,13 +30,16 @@ $pat = Cairo::SolidPattern->create_rgba(1.0, 0.0, 0.0, 1.0);
 isa_ok ($pat, 'Cairo::SolidPattern');
 isa_ok ($pat, 'Cairo::Pattern');
 
+$pat->set_extend ('pad');
+is ($pat->get_extend, 'pad', 'Cairo::SolidPattern set|get_extend');
+
 my $surf = Cairo::ImageSurface->create ('rgb24', IMG_WIDTH, IMG_HEIGHT);
 $pat = Cairo::SurfacePattern->create ($surf);
 isa_ok ($pat, 'Cairo::SurfacePattern');
 isa_ok ($pat, 'Cairo::Pattern');
 
 $pat->set_extend ('none');
-is ($pat->get_extend, 'none', '$pat->set|get_extend');
+is ($pat->get_extend, 'none', 'Cairo::SurfacePattern set|get_extend');
 
 $pat->set_filter ('fast');
 is ($pat->get_filter, 'fast', '$pat->set|get_filter');
@@ -46,11 +49,17 @@ isa_ok ($pat, 'Cairo::LinearGradient');
 isa_ok ($pat, 'Cairo::Gradient');
 isa_ok ($pat, 'Cairo::Pattern');
 
+$pat->set_extend ('repeat');
+is ($pat->get_extend, 'repeat', 'Cairo::LinearGradient set|get_extend');
+
 $pat = Cairo::RadialGradient->create (1, 2, 3, 4, 5, 6);
 isa_ok ($pat, 'Cairo::RadialGradient');
 isa_ok ($pat, 'Cairo::Gradient');
 isa_ok ($pat, 'Cairo::Pattern');
 
+$pat->set_extend ('reflect');
+is ($pat->get_extend, 'reflect', 'Cairo::RadialGradient set|get_extend');
+
 $pat->add_color_stop_rgb (1, 0.5, 0.6, 0.7);
 $pat->add_color_stop_rgba (1, 0.5, 0.6, 0.7, 0.8);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]