File: CairoPath.t

package info (click to toggle)
libcairo-perl 1.060-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 500 kB
  • ctags: 683
  • sloc: perl: 1,781; ansic: 63; makefile: 53
file content (33 lines) | stat: -rw-r--r-- 912 bytes parent folder | download
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
#!/usr/bin/perl
#
# Copyright (c) 2004-2005 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/CairoPath.t,v 1.2 2007-10-14 18:03:43 tsch Exp $
#

use strict;
use warnings;
use Cairo;

use Test::More tests => 4;

use constant IMG_WIDTH => 256;
use constant IMG_HEIGHT => 256;

my $surf = Cairo::ImageSurface->create ('rgb24', IMG_WIDTH, IMG_HEIGHT);
my $cr = Cairo::Context->create ($surf);

$cr->new_path;
$cr->move_to (1, 2);
$cr->line_to (3, 4);
$cr->curve_to (5, 6, 7, 8, 9, 10);
$cr->close_path;

my $path = $cr->copy_path;

is_deeply ($path->[0], { type => "move-to", points => [[1, 2]] });
is_deeply ($path->[1], { type => "line-to", points => [[3, 4]] });
is_deeply ($path->[2], { type => "curve-to", points => [[5, 6], [7, 8], [9, 10]] });
is_deeply ($path->[3], { type => "close-path", points => [] });