aboutsummaryrefslogtreecommitdiff
path: root/Perl/t
diff options
context:
space:
mode:
authormertz2004-04-24 16:00:45 +0000
committermertz2004-04-24 16:00:45 +0000
commit13bd6192579b9fc8d0fb802d1916b7a1b2a79d76 (patch)
treeafe7ee2119e2c05f7fa92e8a537e24cf9f682958 /Perl/t
parent9137bb0876dd76cb3e7707b83dcc905cd98a5f6c (diff)
downloadtkzinc-13bd6192579b9fc8d0fb802d1916b7a1b2a79d76.zip
tkzinc-13bd6192579b9fc8d0fb802d1916b7a1b2a79d76.tar.gz
tkzinc-13bd6192579b9fc8d0fb802d1916b7a1b2a79d76.tar.bz2
tkzinc-13bd6192579b9fc8d0fb802d1916b7a1b2a79d76.tar.xz
adding coords test for group, track, waypoint, tabular, arc, traingles, icon
Diffstat (limited to 'Perl/t')
-rw-r--r--Perl/t/Coords.t52
1 files changed, 49 insertions, 3 deletions
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");