From 564b98cc44155f9b870124a6381bab3907497952 Mon Sep 17 00:00:00 2001 From: mertz Date: Wed, 26 May 2004 20:32:45 +0000 Subject: adding 3 tests for field/label bbox (currently only empty fields / labels are tested --- Perl/t/Bbox.t | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'Perl') diff --git a/Perl/t/Bbox.t b/Perl/t/Bbox.t index 238da00..b6f5419 100644 --- a/Perl/t/Bbox.t +++ b/Perl/t/Bbox.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -# $Id: Bbox.t,v 1.2 2004-05-24 19:55:03 mertz Exp $ +# $Id: Bbox.t,v 1.3 2004-05-26 20:32:45 mertz Exp $ # Author: Christophe Mertz # @@ -9,7 +9,7 @@ BEGIN { if (!eval q{ - use Test::More tests => 5; + use Test::More tests => 8; 1; }) { print "# tests only work properly with installed Test::More module\n"; @@ -66,7 +66,7 @@ ok(&similarFlatArray ([$zinc->bbox($txt1)], "bbox of empty text"); my $width = $zinc->fontMeasure('font20pixels', 'dummy'); -print "width = $width\n"; +#print "width = $width\n"; my $txt2 = $zinc->add('text', 1, -font => 'font20pixels', -alignment => 'left', @@ -110,6 +110,42 @@ ok(&similarFlatArray ([$zinc->bbox($txt4)], "bbox of 'dummy' centered text"); +### testing bbox of fields or labels of track/waypoint and tabular items +my $track = $zinc->add('track', 1, 4, -position => [56, 78]); +print "bbox=(", join(',', $zinc->bbox(-label, $track)),")\n"; +is_deeply ([ $zinc->bbox(-label, $track) ], + [ ], + "bbox of a track label without labelformat"); + +#print "bbox=(", join(',', $zinc->bbox(-field, 2, $track)),")\n"; +is_deeply ([ $zinc->bbox(-field, 2, $track) ], + [ ], + "bbox of a track field without labelformat"); + +$zinc->itemconfigure($track, -labelformat => 'x20x18+0+0'); +#print "bbox=(", join(',', $zinc->bbox(-label, $track)),")\n"; + + +#print "bbox=(", join(',', $zinc->bbox(-field, 4, $track)),")\n"; +is_deeply ([ $zinc->bbox(-field, 4, $track) ], + [ ], + "bbox of a empty track field"); + + +# 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, 1, -position => [61, 81]); +# is_deeply([ $zinc->coords($tab) ], +# [ 61,81 ], +# "coords of a empty tabular"); +# $zinc->itemconfigure($tab, -labelformat => 'x20x18+0+0'); +# is_deeply([ $zinc->coords($tab) ], +# [ 61,81 ], +# "coords of a tabular with a labelformat"); + + sub similarPoints { -- cgit v1.1