1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#
# Copyright (c) 2004-2005 by the cairo perl team (see the file README)
#
# Licensed under the LGPL, see LICENSE file for more information.
#
# $Id$
#
use strict;
use warnings;
use Test::More tests => 10;
use Cairo;
my $matrix = Cairo::Matrix->init (1, 2, 3, 4, 5, 6);
isa_ok ($matrix, 'Cairo::Matrix');
$matrix = Cairo::Matrix->init_identity;
isa_ok ($matrix, 'Cairo::Matrix');
$matrix = Cairo::Matrix->init_translate (1, 2);
isa_ok ($matrix, 'Cairo::Matrix');
$matrix = Cairo::Matrix->init_scale (3, 4);
isa_ok ($matrix, 'Cairo::Matrix');
$matrix = Cairo::Matrix->init_rotate (3.1415);
isa_ok ($matrix, 'Cairo::Matrix');
eval
{
$matrix->translate (1, 2);
$matrix->scale (3, 4);
$matrix->rotate (3.1415);
};
is ($@, '', 'translate, scale, rotate');
is ($matrix->invert, 'success');
my $id = Cairo::Matrix->init_identity;
isa_ok ($matrix->multiply ($id), 'Cairo::Matrix');
is_deeply ([$id->transform_distance (1, 1)], [1, 1],
'$id->transform_distance');
is_deeply ([$id->transform_point (1, 1)], [1, 1],
'$id->transform_point');
|