[cairo-commit] cairo-perl/t Cairo.t, 1.8, 1.9 CairoFont.t, 1.3,
1.4 CairoPattern.t, 1.4, 1.5 CairoSurface.t, 1.11, 1.12
Torsten Schoenfeld
commit at pdx.freedesktop.org
Thu Aug 10 10:34:42 PDT 2006
- Previous message: [cairo-commit] cairo-perl Cairo.xs, 1.13, 1.14 CairoFont.xs, 1.7,
1.8 CairoPattern.xs, 1.10, 1.11 CairoSurface.xs, 1.13,
1.14 ChangeLog, 1.28, 1.29 MakeHelper.pm, 1.6, 1.7 Makefile.PL,
1.17, 1.18 cairo-perl-private.h, 1.3, 1.4
- Next message: [cairo-commit] test/cairo-test.c
test/mask-beos_bitmap-argb32-ref.png
test/mask-beos-bitmap-argb32-ref.png
test/mask-beos_bitmap-rgb24-ref.png
test/mask-beos-bitmap-rgb24-ref.png
test/set-source-beos_bitmap-rgb24-ref.png
test/set-source-beos-bitmap-rgb24-ref.png
test/trap-clip-beos_bitmap-rgb24-ref.png
test/trap-clip-beos-bitmap-rgb24-ref.png
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: tsch
Update of /cvs/cairo/cairo-perl/t
In directory kemper:/tmp/cvs-serv10208/t
Modified Files:
Cairo.t CairoFont.t CairoPattern.t CairoSurface.t
Log Message:
* Cairo.xs, CairoFont.xs, CairoPattern.xs, CairoSurface.xs,
MakeHelper.pm, Makefile.PL, cairo-perl-private.h, t/Cairo.t,
t/CairoFont.t, t/CairoPattern.t, t/CairoSurface.t: Make it
possible to compile and run the bindings against cairo 1.0.x. Use
a package lookup table for patterns and surfaces to work around
the lack of type accessors. Add version guards around things that
were introduced in 1.2.0.
* CairoSurface.xs: Use OUTLIST for
cairo_surface_get_device_offset.
* CairoPattern.xs, CairoSurface.xs, cairo-perl-private.h: Rename
cair_perl_set_isa to cairo_perl_set_isa. Doh!
* t/CairoSurface.t: Explicitly clear the image surface on cairo
1.0.x before writing it out since 1.0.x doesn't do it for us. Use
lexical surface variables to make sure they get destroyed before
execution ends which in turn makes sure all tests inside callbacks
are run before Test::More checks if reality matches the test plan.
Index: Cairo.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/Cairo.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Cairo.t 3 Jun 2006 14:21:10 -0000 1.8
+++ Cairo.t 10 Aug 2006 17:34:40 -0000 1.9
@@ -35,12 +35,17 @@
$cr->save;
$cr->restore;
-$cr->push_group();
-isa_ok ($cr->get_group_target, 'Cairo::Surface');
-isa_ok ($cr->pop_group(), 'Cairo::Pattern');
+SKIP: {
+ skip 'new stuff', 2
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
-$cr->push_group_with_content('color');
-$cr->pop_group_to_source();
+ $cr->push_group();
+ isa_ok ($cr->get_group_target, 'Cairo::Surface');
+ isa_ok ($cr->pop_group(), 'Cairo::Pattern');
+
+ $cr->push_group_with_content('color');
+ $cr->pop_group_to_source();
+}
$cr->set_operator ('clear');
is ($cr->get_operator, 'clear');
@@ -95,7 +100,14 @@
is_deeply ([$cr->device_to_user_distance (1, 2)], [1, 2]);
$cr->new_path;
-$cr->new_sub_path;
+
+SKIP: {
+ skip 'new stuff', 0
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
+
+ $cr->new_sub_path;
+}
+
$cr->move_to (1.1, 2.2);
$cr->line_to (2.2, 3.3);
$cr->curve_to (3.3, 4.4, 5.5, 6.6, 7.7, 8.8);
@@ -174,11 +186,16 @@
$cr->text_path ('Urgs?');
$cr->glyph_path (@glyphs);
-my $options = Cairo::FontOptions->create;
-my $matrix = Cairo::Matrix->init_identity;
-my $ctm = Cairo::Matrix->init_identity;
-my $font = Cairo::ScaledFont->create ($face, $matrix, $ctm, $options);
-$cr->set_scaled_font ($font);
+SKIP: {
+ skip 'new stuff', 0
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
+
+ my $options = Cairo::FontOptions->create;
+ my $matrix = Cairo::Matrix->init_identity;
+ my $ctm = Cairo::Matrix->init_identity;
+ my $font = Cairo::ScaledFont->create ($face, $matrix, $ctm, $options);
+ $cr->set_scaled_font ($font);
+}
isa_ok ($cr->get_source, 'Cairo::Pattern');
Index: CairoFont.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/CairoFont.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CairoFont.t 7 May 2006 14:17:39 -0000 1.3
+++ CairoFont.t 10 Aug 2006 17:34:40 -0000 1.4
@@ -48,7 +48,13 @@
my $face = $cr->get_font_face;
is ($face->status, 'success');
-ok (defined $face->get_type);
+
+SKIP: {
+ skip 'new stuff', 1
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
+
+ ok (defined $face->get_type);
+}
my $matrix = Cairo::Matrix->init_identity;
my $ctm = Cairo::Matrix->init_identity;
@@ -57,13 +63,20 @@
isa_ok ($font, 'Cairo::ScaledFont');
is ($font->status, 'success');
-ok (defined $font->get_type);
isa_ok ($font->extents, 'HASH');
-isa_ok ($font->text_extents('Bla'), 'HASH');
isa_ok ($font->glyph_extents ({ index => 1, x => 2, y => 3 }), 'HASH');
-isa_ok ($font->get_font_face, 'Cairo::FontFace');
-isa_ok ($font->get_font_matrix, 'Cairo::Matrix');
-isa_ok ($font->get_ctm, 'Cairo::Matrix');
-isa_ok ($font->get_font_options, 'Cairo::FontOptions');
+SKIP: {
+ skip 'new stuff', 6
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
+
+ ok (defined $font->get_type);
+
+ isa_ok ($font->text_extents('Bla'), 'HASH');
+
+ isa_ok ($font->get_font_face, 'Cairo::FontFace');
+ isa_ok ($font->get_font_matrix, 'Cairo::Matrix');
+ isa_ok ($font->get_ctm, 'Cairo::Matrix');
+ isa_ok ($font->get_font_options, 'Cairo::FontOptions');
+}
Index: CairoPattern.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/CairoPattern.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CairoPattern.t 7 May 2006 14:17:39 -0000 1.4
+++ CairoPattern.t 10 Aug 2006 17:34:40 -0000 1.5
@@ -55,4 +55,10 @@
isa_ok ($pat->get_matrix, 'Cairo::Matrix');
is ($pat->status, 'success');
-is ($pat->get_type, 'radial');
+
+SKIP: {
+ skip 'new stuff', 1
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
+
+ is ($pat->get_type, 'radial');
+}
Index: CairoSurface.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/CairoSurface.t,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- CairoSurface.t 15 Jul 2006 14:41:12 -0000 1.11
+++ CairoSurface.t 10 Aug 2006 17:34:40 -0000 1.12
@@ -21,9 +21,15 @@
my $surf = Cairo::ImageSurface->create ('rgb24', IMG_WIDTH, IMG_HEIGHT);
isa_ok ($surf, 'Cairo::ImageSurface');
isa_ok ($surf, 'Cairo::Surface');
-is ($surf->get_content, 'color');
-is ($surf->get_format, 'rgb24');
+SKIP: {
+ skip 'new stuff', 2
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
+
+ is ($surf->get_content, 'color');
+ is ($surf->get_format, 'rgb24');
+}
+
is ($surf->get_width, IMG_WIDTH);
is ($surf->get_height, IMG_HEIGHT);
@@ -32,20 +38,32 @@
isa_ok ($surf, 'Cairo::ImageSurface');
isa_ok ($surf, 'Cairo::Surface');
-is ($surf->get_data, 'Urgs!');
-is ($surf->get_stride, 23);
+SKIP: {
+ skip 'new stuff', 2
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
+
+ is ($surf->get_data, 'Urgs!');
+ is ($surf->get_stride, 23);
+}
$surf = $surf->create_similar ('color', IMG_WIDTH, IMG_HEIGHT);
isa_ok ($surf, 'Cairo::ImageSurface');
isa_ok ($surf, 'Cairo::Surface');
$surf->set_device_offset (23, 42);
-is_deeply ([$surf->get_device_offset], [23, 42]);
-$surf->set_fallback_resolution (72, 72);
+SKIP: {
+ skip 'new stuff', 2
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
+
+ is_deeply ([$surf->get_device_offset], [23, 42]);
+
+ $surf->set_fallback_resolution (72, 72);
+
+ is ($surf->get_type, 'image');
+}
is ($surf->status, 'success');
-is ($surf->get_type, 'image');
isa_ok ($surf->get_font_options, 'Cairo::FontOptions');
@@ -53,11 +71,20 @@
$surf->mark_dirty_rectangle (10, 10, 10, 10);
$surf->flush;
+sub clear {
+ if (Cairo::VERSION() < Cairo::VERSION_ENCODE (1, 2, 0)) {
+ my $cr = Cairo::Context->create ($surf);
+ $cr->set_operator ('clear');
+ $cr->paint;
+ }
+}
+
SKIP: {
skip 'png surface', 16
unless Cairo::HAS_PNG_FUNCTIONS;
- $surf = Cairo::ImageSurface->create ('rgb24', IMG_WIDTH, IMG_HEIGHT);
+ my $surf = Cairo::ImageSurface->create ('rgb24', IMG_WIDTH, IMG_HEIGHT);
+ clear ($surf);
is ($surf->write_to_png ('tmp.png'), 'success');
is ($surf->write_to_png_stream (sub {
@@ -110,7 +137,7 @@
skip 'pdf surface', 8
unless Cairo::HAS_PDF_SURFACE;
- $surf = Cairo::PdfSurface->create ('tmp.pdf', IMG_WIDTH, IMG_HEIGHT);
+ my $surf = Cairo::PdfSurface->create ('tmp.pdf', IMG_WIDTH, IMG_HEIGHT);
isa_ok ($surf, 'Cairo::PdfSurface');
isa_ok ($surf, 'Cairo::Surface');
@@ -136,7 +163,7 @@
skip 'ps surface', 8
unless Cairo::HAS_PS_SURFACE;
- $surf = Cairo::PsSurface->create ('tmp.ps', IMG_WIDTH, IMG_HEIGHT);
+ my $surf = Cairo::PsSurface->create ('tmp.ps', IMG_WIDTH, IMG_HEIGHT);
isa_ok ($surf, 'Cairo::PsSurface');
isa_ok ($surf, 'Cairo::Surface');
@@ -166,7 +193,7 @@
skip 'svg surface', 12
unless Cairo::HAS_SVG_SURFACE;
- $surf = Cairo::SvgSurface->create ('tmp.svg', IMG_WIDTH, IMG_HEIGHT);
+ my $surf = Cairo::SvgSurface->create ('tmp.svg', IMG_WIDTH, IMG_HEIGHT);
isa_ok ($surf, 'Cairo::SvgSurface');
isa_ok ($surf, 'Cairo::Surface');
- Previous message: [cairo-commit] cairo-perl Cairo.xs, 1.13, 1.14 CairoFont.xs, 1.7,
1.8 CairoPattern.xs, 1.10, 1.11 CairoSurface.xs, 1.13,
1.14 ChangeLog, 1.28, 1.29 MakeHelper.pm, 1.6, 1.7 Makefile.PL,
1.17, 1.18 cairo-perl-private.h, 1.3, 1.4
- Next message: [cairo-commit] test/cairo-test.c
test/mask-beos_bitmap-argb32-ref.png
test/mask-beos-bitmap-argb32-ref.png
test/mask-beos_bitmap-rgb24-ref.png
test/mask-beos-bitmap-rgb24-ref.png
test/set-source-beos_bitmap-rgb24-ref.png
test/set-source-beos-bitmap-rgb24-ref.png
test/trap-clip-beos_bitmap-rgb24-ref.png
test/trap-clip-beos-bitmap-rgb24-ref.png
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list