[cairo-commit] cairo-perl/t CairoSurface.t,1.10,1.11

Torsten Schoenfeld commit at pdx.freedesktop.org
Sat Jul 15 07:41:14 PDT 2006


Committed by: tsch

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

Modified Files:
	CairoSurface.t 
Log Message:
	* Cairo.pm, Cairo.xs, CairoPattern.xs, CairoSurface.xs,
	cairo-perl-private.h: Add cairo_perl_set_isa and use it for
	surfaces and patterns.

	* CairoSurface.xs, Makefile.PL, cairo-perl.h, t/CairoSurface.t:
	Add support for svg surfaces if available.

	* t/CairoSurface.t: Remove TODO block and revert workaround
	related to the weird unknown surface types.  It's been fixed
	upstream: https://bugs.freedesktop.org/show_bug.cgi?id=7322


Index: CairoSurface.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/CairoSurface.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- CairoSurface.t	2 Jul 2006 13:10:44 -0000	1.10
+++ CairoSurface.t	15 Jul 2006 14:41:12 -0000	1.11
@@ -9,7 +9,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 48;
+use Test::More tests => 60;
 
 use constant {
 	IMG_WIDTH => 256,
@@ -99,10 +99,7 @@
 		is ($closure, 'blub');
 		die 'read-error';
 	}, 'blub');
-	TODO: {
-		local $TODO = "create_from_png_stream trouble";
-		isa_ok ($surf, 'Cairo::ImageSurface');
-	}
+	isa_ok ($surf, 'Cairo::ImageSurface');
 	isa_ok ($surf, 'Cairo::Surface');
 	is ($surf->status, 'read-error');
 
@@ -145,6 +142,10 @@
 
 	$surf->set_size (23, 42);
 
+	$surf->dsc_comment("Bla?");
+	$surf->dsc_begin_setup;
+	$surf->dsc_begin_page_setup;
+
 	$surf = $surf->create_similar ('alpha', IMG_WIDTH, IMG_HEIGHT);
 	isa_ok ($surf, 'Cairo::ImageSurface');
 	isa_ok ($surf, 'Cairo::Surface');
@@ -159,8 +160,38 @@
 	}, 'blub', IMG_WIDTH, IMG_HEIGHT);
 	isa_ok ($surf, 'Cairo::PsSurface');
 	isa_ok ($surf, 'Cairo::Surface');
+}
+
+SKIP: {
+	skip 'svg surface', 12
+		unless Cairo::HAS_SVG_SURFACE;
+
+	$surf = Cairo::SvgSurface->create ('tmp.svg', IMG_WIDTH, IMG_HEIGHT);
+	isa_ok ($surf, 'Cairo::SvgSurface');
+	isa_ok ($surf, 'Cairo::Surface');
 
-	$surf->dsc_comment("Bla?");
-	$surf->dsc_begin_setup;
-	$surf->dsc_begin_page_setup;
+	$surf->restrict_to_version ('1-1');
+	$surf->restrict_to_version ('1-2');
+
+	unlink 'tmp.svg';
+
+	$surf = Cairo::SvgSurface->create_for_stream (sub {
+		my ($closure, $data) = @_;
+		is ($closure, 'blub');
+		like ($data, qr/xml/);
+		die 'write-error';
+	}, 'blub', IMG_WIDTH, IMG_HEIGHT);
+	isa_ok ($surf, 'Cairo::SvgSurface');
+	isa_ok ($surf, 'Cairo::Surface');
+
+	my @versions = Cairo::SvgSurface::get_versions();
+	ok (scalar @versions > 0);
+	is ($versions[0], '1-1');
+
+	@versions = Cairo::SvgSurface->get_versions();
+	ok (scalar @versions > 0);
+	is ($versions[0], '1-1');
+
+	like (Cairo::SvgSurface::version_to_string('1-1'), qr/1\.1/);
+	like (Cairo::SvgSurface->version_to_string('1-1'), qr/1\.1/);
 }



More information about the cairo-commit mailing list