aboutsummaryrefslogtreecommitdiff
path: root/Perl/t/Coords.t
diff options
context:
space:
mode:
authormertz2005-06-23 15:32:39 +0000
committermertz2005-06-23 15:32:39 +0000
commite59bb435d678c0eaa926817275b6aee744e09347 (patch)
tree0fad0b2614ef63204a593095452d4b447deeed0d /Perl/t/Coords.t
parentbc4d2dccd764be67fbfee10f1f371d4cf1f549c6 (diff)
downloadtkzinc-e59bb435d678c0eaa926817275b6aee744e09347.zip
tkzinc-e59bb435d678c0eaa926817275b6aee744e09347.tar.gz
tkzinc-e59bb435d678c0eaa926817275b6aee744e09347.tar.bz2
tkzinc-e59bb435d678c0eaa926817275b6aee744e09347.tar.xz
testing now the coords of empty curves, as well as the addition
and removal of contours (relative to an old bug report from Daniel the 7th October 2004. This bug seems to be closed)
Diffstat (limited to 'Perl/t/Coords.t')
-rw-r--r--Perl/t/Coords.t42
1 files changed, 39 insertions, 3 deletions
diff --git a/Perl/t/Coords.t b/Perl/t/Coords.t
index b8c4662..7e96d53 100644
--- a/Perl/t/Coords.t
+++ b/Perl/t/Coords.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
#
-# $Id: Coords.t,v 1.6 2004-05-24 19:56:23 mertz Exp $
+# $Id: Coords.t,v 1.7 2005-06-23 15:32:39 mertz Exp $
# Author: Christophe Mertz
#
@@ -9,8 +9,7 @@
BEGIN {
if (!eval q{
-# use Test::More qw(no_plan);
- use Test::More tests => 21;
+ use Test::More tests => 26;
1;
}) {
print "# tests only work properly with installed Test::More module\n";
@@ -81,6 +80,43 @@ is_deeply([ $zinc->coords($curve,0,1) ],
[ 40,50,'c' ],
"coords of a control point of a curve contour is list of three elements");
+
+
+## testing empty curves, and adding/removing contours
+my $emptyCurve = $zinc->add('curve', 1, [ ]);
+
+is_deeply([ $zinc->coords($emptyCurve) ],
+ [ ],
+ "coords of an empty curve is an empty list");
+
+# adding a contour
+$zinc->contour($emptyCurve, 'add', 0, [ [1,1], [100,100], [200,100] ]);
+is_deeply([ $zinc->coords($emptyCurve) ],
+ [ [1,1], [100,100], [200,100] ],
+ "coords of a no more empty curve");
+
+$zinc->contour($emptyCurve, 'add', 0, [ [80,90], [-100,-100], [-200,100] ]);
+is_deeply([ $zinc->coords($emptyCurve, 1) ],
+ [ [80,90], [-100,-100], [-200,100] ],
+ "coords of a second contour in a curve");
+
+# removing first contour (which can be the second one!!
+$zinc->contour($emptyCurve, 'remove', 0);
+is_deeply([ $zinc->coords($emptyCurve, 0) ],
+ [ [1,1], [100,100], [200,100] ], # contours order is re-organised by tkzinc!!
+# [ [80,90], [-100,-100], [-200,100] ],
+ "coords of remaining contour in the curve");
+
+# removing the last contour
+$zinc->contour($emptyCurve, 'remove', 0);
+is_deeply([ $zinc->coords($emptyCurve, 0) ],
+ [ ],
+ "coords of contour in the curve which is now empty");
+
+
+
+
+
my $text = $zinc->add('text', 1, -position => [10,20], -text => 'test');
is_deeply([ $zinc->coords($text) ],