[cairo-commit]
cairo-perl/t CairoMatrix.t, NONE, 1.1 CairoPattern.t,
NONE, 1.1 CairoSurface.t, NONE, 1.1
Ross McFarland
commit at pdx.freedesktop.org
Thu Nov 11 19:32:07 PST 2004
Committed by: rwmcfa1
Update of /cvs/cairo/cairo-perl/t
In directory gabe:/tmp/cvs-serv2284/t
Added Files:
CairoMatrix.t CairoPattern.t CairoSurface.t
Log Message:
missed, i'm missing subversion right now
--- NEW FILE: CairoMatrix.t ---
#
# Copyright (c) 2004 by the cairo perl team (see the file README)
#
# Licensed under the LGPL, see LICENSE file for more information.
#
# $Header: /cvs/cairo/cairo-perl/t/CairoMatrix.t,v 1.1 2004/11/12 03:32:05 rwmcfa1 Exp $
#
use strict;
use warnings;
use Data::Dumper;
use Test::More tests => 6;
use Cairo;
isa_ok (my $matrix = Cairo::Matrix->create, 'Cairo::Matrix');
{
isa_ok ($matrix->copy, 'Cairo::Matrix', '$matrix->copy');
}
eval
{
$matrix->set_identity;
$matrix->translate (2, 3);
$matrix->scale (3, 4);
$matrix->rotate (3.14);
$matrix->invert;
};
is ($@, '', 'set_identity, translate, scale, rotate, invert');
$matrix->set_affine (1, 2, 3, 4, 5, 6);
is_deeply ([$matrix->get_affine], [1, 2, 3, 4, 5, 6],
'$matrix->set|get_affine');
is_deeply ([$matrix->transform_distance (1, 2)], [7, 10],
'$matrix->transform_distance');
is_deeply ([$matrix->transform_point (2, 3)], [16, 22],
'$matrix->transform_point');
--- NEW FILE: CairoPattern.t ---
#
# Copyright (c) 2004 by the cairo perl team (see the file README)
#
# Licensed under the LGPL, see LICENSE file for more information.
#
# $Header: /cvs/cairo/cairo-perl/t/CairoPattern.t,v 1.1 2004/11/12 03:32:05 rwmcfa1 Exp $
#
use strict;
use warnings;
use Data::Dumper;
use Test::More tests => 6;
use constant {
IMG_WIDTH => 256,
IMG_HEIGHT => 256,
};
use Cairo;
{
my $surf = Cairo::Surface->image_create ('RGB24', IMG_WIDTH,
IMG_HEIGHT);
isa_ok (Cairo::Pattern->create_for_surface ($surf), 'Cairo::Pattern',
'Cairo::Pattern->create_for_surface');
}
isa_ok (Cairo::Pattern->create_linear (1, 2, 3, 4), 'Cairo::Pattern',
'Cairo::Pattern->create_linear');
isa_ok (my $pat = Cairo::Pattern->create_radial (1, 2, 3, 4, 5, 6),
'Cairo::Pattern', 'Cairo::Pattern->create_radial');
$pat->add_color_stop (1, 0.5, 0.6, 0.7, 0.8);
{
my $matrix = Cairo::Matrix->create;
$pat->set_matrix ($matrix);
isa_ok ($pat->get_matrix, 'Cairo::Matrix', '$pat->get_matrix');
}
$pat->set_extend ('NONE');
is ($pat->get_extend, 'NONE', '$pat->set|get_extend');
$pat->set_filter ('FAST');
is ($pat->get_filter, 'FAST', '$pat->set|get_filter');
--- NEW FILE: CairoSurface.t ---
#
# Copyright (c) 2004 by the cairo perl team (see the file README)
#
# Licensed under the LGPL, see LICENSE file for more information.
#
# $Header: /cvs/cairo/cairo-perl/t/CairoSurface.t,v 1.1 2004/11/12 03:32:05 rwmcfa1 Exp $
#
use strict;
use warnings;
use Data::Dumper;
use Test::More tests => 12;
use constant {
IMG_WIDTH => 256,
IMG_HEIGHT => 256,
};
use Cairo;
isa_ok (my $surf = Cairo::Surface->image_create ('RGB24', IMG_WIDTH,
IMG_HEIGHT),
'Cairo::Surface');
{
isa_ok ($surf->create_similar ('RGB24', IMG_WIDTH, IMG_HEIGHT),
'Cairo::Surface', '$surf->create_similar');
}
eval
{
$surf->set_repeat (1);
};
is ($@, '', '$sufr->set_repeate');
{
my $matrix = Cairo::Matrix->create;
$surf->set_matrix ($matrix);
isa_ok ($surf->get_matrix, 'Cairo::Matrix', '$surf->set|get_matrix');
}
$surf->set_filter ('FAST');
is ($surf->get_filter, 'FAST', '$surf->set|get_filter');
# img isn't going to be very interesting
my $outtmp = 't/out.tmp';
open OUT, '>'.$outtmp
or die "failed to create output tmp file ($outtmp)";
ok (*OUT, 'OUT support');
SKIP:
{
skip "png backend not supported in bound cairo", 1
unless ($Cairo::backends{png});
isa_ok (Cairo::Surface->png_create (*OUT, 'ARGB32', IMG_WIDTH,
IMG_HEIGHT), 'Cairo::Surface');
}
SKIP:
{
# XXX:
skip "ps backend currently hangs", 1;
skip "ps backend not supported in bound cairo", 1
unless ($Cairo::backends{ps});
isa_ok (Cairo::Surface->ps_create (*OUT, IMG_WIDTH, IMG_HEIGHT,
72, 72), 'Cairo::Surface');
}
SKIP:
{
# XXX:
skip "xlib backend no way to get display and drawable", 1;
skip "xlib backend not supported in bound cairo", 1
unless ($Cairo::backends{xlib});
isa_ok (Cairo::Surface->xlib_create (), 'Cairo::Surface');
}
SKIP:
{
skip "xcb backend not supported in bound cairo", 1
unless ($Cairo::backends{xcb});
isa_ok (Cairo::Surface->xcb_create (), 'Cairo::Surface');
}
SKIP:
{
skip "glitz backend not supported in bound cairo", 1
unless ($Cairo::backends{glitz});
isa_ok (Cairo::Surface->glitz_create (), 'Cairo::Surface');
}
close OUT;
ok (unlink ($outtmp), 'rm tmpout');
More information about the cairo-commit
mailing list