[cairo-commit] cairo-perl/t CairoSurface.t,1.17.2.1,1.17.2.2
Torsten Schoenfeld
commit at pdx.freedesktop.org
Thu Nov 23 11:13:05 PST 2006
Committed by: tsch
Update of /cvs/cairo/cairo-perl/t
In directory kemper:/tmp/cvs-serv30022/t
Modified Files:
Tag: stable-1-0
CairoSurface.t
Log Message:
* CairoSurface.xs, t/CairoSurface.t: Make
Cairo::ImageSurface::get_data usable by specifying the buffer
length.
Index: CairoSurface.t
===================================================================
RCS file: /cvs/cairo/cairo-perl/t/CairoSurface.t,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -u -d -r1.17.2.1 -r1.17.2.2
--- CairoSurface.t 11 Nov 2006 20:04:23 -0000 1.17.2.1
+++ CairoSurface.t 23 Nov 2006 19:13:01 -0000 1.17.2.2
@@ -9,7 +9,7 @@
use strict;
use warnings;
-use Test::More tests => 62;
+use Test::More tests => 64;
use constant {
IMG_WIDTH => 256,
@@ -33,17 +33,29 @@
is ($surf->get_width, IMG_WIDTH);
is ($surf->get_height, IMG_HEIGHT);
-$surf = Cairo::ImageSurface->create_for_data ('Urgs!', 'rgb24',
- IMG_WIDTH, IMG_HEIGHT, 23);
-isa_ok ($surf, 'Cairo::ImageSurface');
-isa_ok ($surf, 'Cairo::Surface');
+{
+ my $data = pack ('CCCC', 0, 0, 0, 0);
+ my $surf = Cairo::ImageSurface->create_for_data (
+ $data, 'argb32', 1, 1, 4);
+ isa_ok ($surf, 'Cairo::ImageSurface');
+ isa_ok ($surf, 'Cairo::Surface');
-SKIP: {
- skip 'new stuff', 2
- unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
+ SKIP: {
+ skip 'new stuff', 4
+ unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
- is ($surf->get_data, 'Urgs!');
- is ($surf->get_stride, 23);
+ is ($surf->get_data, $data);
+ is ($surf->get_stride, 4);
+
+ # Change the image data and make sure $data gets updated accordingly.
+ my $cr = Cairo::Context->create ($surf);
+ $cr->set_source_rgba (1.0, 0, 0, 1.0);
+ $cr->rectangle (0, 0, 1, 1);
+ $cr->fill;
+
+ is ($surf->get_data, $data);
+ is ($surf->get_data, pack ('CCCC', 0, 0, 255, 255));
+ }
}
$surf = $surf->create_similar ('color', IMG_WIDTH, IMG_HEIGHT);
@@ -51,7 +63,6 @@
isa_ok ($surf, 'Cairo::Surface');
# Test that the enum wrappers differentiate between color and color-alpha.
-# Duh!
SKIP: {
skip 'content tests', 2
unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 2, 0);
More information about the cairo-commit
mailing list