From 13bd6192579b9fc8d0fb802d1916b7a1b2a79d76 Mon Sep 17 00:00:00 2001 From: mertz Date: Sat, 24 Apr 2004 16:00:45 +0000 Subject: adding coords test for group, track, waypoint, tabular, arc, traingles, icon --- Perl/t/Coords.t | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) (limited to 'Perl/t') diff --git a/Perl/t/Coords.t b/Perl/t/Coords.t index 9b4dd86..74d7b90 100644 --- a/Perl/t/Coords.t +++ b/Perl/t/Coords.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -# $Id: Coords.t,v 1.2 2004-04-02 12:01:49 mertz Exp $ +# $Id: Coords.t,v 1.3 2004-04-24 16:00:45 mertz Exp $ # Author: Christophe Mertz # @@ -10,7 +10,7 @@ BEGIN { if (!eval q{ # use Test::More qw(no_plan); - use Test::More tests => 12; + use Test::More tests => 20; 1; }) { print "# tests only work properly with installed Test::More module\n"; @@ -71,7 +71,7 @@ is_deeply([ $zinc->coords($curve) ], is_deeply([ $zinc->coords($curve,0) ], [ [10,20] ,[40,50,'c'], [90,10,'c'], [30,60] ], - "coords of contour 0 of a curve are list of arrays"); + "coords of contour 0 of a curve is a list of arrays"); is_deeply([ $zinc->coords($curve,0,0) ], [ 10,20 ], @@ -95,6 +95,52 @@ is_deeply([ $zinc->coords($text,0,0) ], [ 10,20 ], "coords of text contour first point"); + +my $group = $zinc->add('group', 1); + +is_deeply([ $zinc->coords($group) ], + [ 0,0 ], + "coords of a empty group, not moved"); + +$zinc->translate($group, 23, 45); +#my @coords = @{$zinc->coords($group)}[0]; +#print "coords = @coords", $coords[0][0], $coords[0][1], "\n"; +is_deeply([ $zinc->coords($group) ], + [ 23,45 ], + "coords of a empty group, translated"); + + +my $track = $zinc->add('track', 1, 0, -position => [56, 78]); +is_deeply([ $zinc->coords($track) ], + [ 56,78 ], + "coords of a track"); + +my $wpt = $zinc->add('waypoint', 1, 0, -position => [561, 781]); +is_deeply([ $zinc->coords($wpt) ], + [ 561,781 ], + "coords of a waypoint"); + +my $tab = $zinc->add('tabular', 1, 0, -position => [61, 81]); +is_deeply([ $zinc->coords($tab) ], + [ 61,81 ], + "coords of a tabular"); + +my $arc = $zinc->add('arc', 1, [13,31, 42,24]); +is_deeply([ $zinc->coords($arc) ], + [ [13,31], [42,24] ], + "coords of an arc"); + +my $tri = $zinc->add('triangles', 1, [ [10,20], [30,40], [50,60], [70,80], [90,99] ]); +is_deeply([ $zinc->coords($tri) ], + [ [10,20], [30,40], [50,60], [70,80], [90,99] ], + "coords of an triangle"); + +my $photoMickey = $zinc->Photo('mickey.gif', -file => Tk->findINC("demos/images/mickey.gif")); +my $icon = $zinc->add('icon', 1, -position => [20,100], -image => $photoMickey); +is_deeply([ $zinc->coords($icon) ], + [ 20,100 ], + "coords of an icon"); + diag("############## coords test"); -- cgit v1.1