[cairo-commit] cairo-perl/t Cairo.t, 1.14, 1.15 CairoPattern.t, 1.7, 1.8

Torsten Schoenfeld commit at pdx.freedesktop.org
Sun May 13 03:58:18 PDT 2007


Committed by: tsch

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

Modified Files:
	Cairo.t CairoPattern.t 
Log Message:
	* Makefile.PL, README, t/Cairo.t, t/CairoPattern.t: Use
	Test::Number::Delta to make floating point number comparisons more
	reliable.


Index: Cairo.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/Cairo.t,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Cairo.t	6 May 2007 11:28:37 -0000	1.14
+++ Cairo.t	13 May 2007 10:58:07 -0000	1.15
@@ -10,6 +10,7 @@
 use warnings;
 
 use Test::More tests => 68;
+use Test::Number::Delta;
 
 use constant {
 	IMG_WIDTH => 256,
@@ -59,7 +60,7 @@
 $cr->set_source_surface ($surf, 23, 42);
 
 $cr->set_tolerance (0.75);
-is ($cr->get_tolerance, 0.75);
+delta_ok ($cr->get_tolerance, 0.75);
 
 $cr->set_antialias ('subpixel');
 is ($cr->get_antialias, 'subpixel');
@@ -86,7 +87,7 @@
 	$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]);
+	delta_ok (\@dashes, [2.3, 4.5, 6.7, 4.5, 2.3]);
 
 	$cr->set_dash (0);
 	($offset, @dashes) = $cr->get_dash;
@@ -95,7 +96,7 @@
 }
 
 $cr->set_miter_limit (2.2);
-is ($cr->get_miter_limit, 2.2);
+delta_ok ($cr->get_miter_limit, 2.2);
 
 $cr->translate (2.2, 3.3);
 $cr->scale (2.2, 3.3);

Index: CairoPattern.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/CairoPattern.t,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- CairoPattern.t	6 May 2007 11:28:37 -0000	1.7
+++ CairoPattern.t	13 May 2007 10:58:07 -0000	1.8
@@ -10,6 +10,7 @@
 use warnings;
 
 use Test::More tests => 25;
+use Test::Number::Delta;
 
 use constant {
 	IMG_WIDTH => 256,
@@ -70,10 +71,10 @@
 
 	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);
+	delta_ok ($r, 1.0);
+	delta_ok ($g, 0.0);
+	delta_ok ($b, 0.0);
+	delta_ok ($a, 1.0);
 
 	my $surf = Cairo::ImageSurface->create ('rgb24', IMG_WIDTH, IMG_HEIGHT);
 	$pat = Cairo::SurfacePattern->create ($surf);
@@ -82,11 +83,11 @@
 	$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]]);
+	delta_ok ([$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]);
+	delta_ok ([$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]);
+	delta_ok ([$pat->get_circles], [1.5, 2.5, 3.5, 4.5, 5.5, 6.5]);
 }



More information about the cairo-commit mailing list