[cairo-commit] cairo-perl/t Cairo.t, 1.9, 1.10 CairoPattern.t, 1.5, 1.6

Torsten Schoenfeld commit at pdx.freedesktop.org
Thu Nov 9 11:43:46 PST 2006


Committed by: tsch

Update of /cvs/cairo/cairo-perl/t
In directory kemper:/tmp/cvs-serv21345/t

Modified Files:
	Cairo.t CairoPattern.t 
Log Message:
	* Cairo.xs, cairo-perl-private.h: Export cairo_perl_alloc_temp
	privately.

	* Cairo.xs: Remove the DOUBLES_ macros and inline them.  They were
	used only in one place.

	* Cairo.xs, t/Cairo.t: Wrap cairo_get_dash.

	* CairoPattern.xs, cairo-perl-private.h, t/CairoPattern.t: Wrap
	cairo_pattern_get_rgba, cairo_pattern_get_surface,
	cairo_pattern_get_color_stop_rgba, cairo_pattern_get_points, and
	cairo_pattern_get_circles.

	* Makefile.PL: Support new cairo_status_t values.


Index: Cairo.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/Cairo.t,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Cairo.t	10 Aug 2006 17:34:40 -0000	1.9
+++ Cairo.t	9 Nov 2006 19:43:43 -0000	1.10
@@ -9,7 +9,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 56;
+use Test::More tests => 60;
 
 use constant {
 	IMG_WIDTH => 256,
@@ -77,6 +77,22 @@
 is ($cr->get_line_join, 'miter');
 
 $cr->set_dash (0, 2, 4, 6, 4, 2);
+$cr->set_dash (0);
+
+SKIP: {
+	skip 'new stuff', 4
+		unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 5); # FIXME: 1.4
+
+	$cr->set_dash (0.5, 2.3, 4.5, 6.7, 4.5, 2.3);
+	my ($offset, @dashes) = $cr->get_dash;
+	is ($offset, 0.5);
+	is_deeply (\@dashes, [2.3, 4.5, 6.7, 4.5, 2.3]);
+
+	$cr->set_dash (0);
+	($offset, @dashes) = $cr->get_dash;
+	is ($offset, 0);
+	is_deeply (\@dashes, []);
+}
 
 $cr->set_miter_limit (2.2);
 is ($cr->get_miter_limit, 2.2);

Index: CairoPattern.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/CairoPattern.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CairoPattern.t	10 Aug 2006 17:34:40 -0000	1.5
+++ CairoPattern.t	9 Nov 2006 19:43:43 -0000	1.6
@@ -9,7 +9,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 17;
+use Test::More tests => 25;
 
 use constant {
 	IMG_WIDTH => 256,
@@ -60,5 +60,33 @@
 	skip 'new stuff', 1
 		unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
 
+	my $pat = Cairo::RadialGradient->create (1, 2, 3, 4, 5, 6);
 	is ($pat->get_type, 'radial');
 }
+
+SKIP: {
+	skip 'new stuff', 8,
+		unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 5); # FIXME: 1.4
+
+	my $pat = Cairo::SolidPattern->create_rgb(1.0, 0.0, 0.0);
+	my ($r, $g, $b, $a) = $pat->get_rgba;
+	is ($r, 1.0);
+	is ($g, 0.0);
+	is ($b, 0.0);
+	is ($a, 1.0);
+
+	my $surf = Cairo::ImageSurface->create ('rgb24', IMG_WIDTH, IMG_HEIGHT);
+	$pat = Cairo::SurfacePattern->create ($surf);
+	isa_ok ($pat->get_surface, 'Cairo::ImageSurface');
+
+	$pat = Cairo::LinearGradient->create (1, 2, 3, 4);
+	$pat->add_color_stop_rgba (0.25, 1, 0, 1, 0);
+	$pat->add_color_stop_rgba (0.75, 0, 1, 0, 1);
+	is_deeply ([$pat->get_color_stops], [[0.25, 1, 0, 1, 0], [0.75, 0, 1, 0, 1]]);
+
+	$pat = Cairo::LinearGradient->create (1.5, 2.5, 3.5, 4.5);
+	is_deeply ([$pat->get_points], [1.5, 2.5, 3.5, 4.5]);
+
+	$pat = Cairo::RadialGradient->create (1.5, 2.5, 3.5, 4.5, 5.5, 6.5);
+	is_deeply ([$pat->get_circles], [1.5, 2.5, 3.5, 4.5, 5.5, 6.5]);
+}



More information about the cairo-commit mailing list