aboutsummaryrefslogtreecommitdiff
path: root/Perl/t
diff options
context:
space:
mode:
authorlecoanet2000-02-04 15:05:00 +0000
committerlecoanet2000-02-04 15:05:00 +0000
commit3f47be9fe5d3006927c79eb156cfbed946243e26 (patch)
tree290e6129a217eb3696b193f15fd7f2cdbb6d1e83 /Perl/t
parent64089dca388f5a9a8235a94b4372763875132219 (diff)
downloadtkzinc-3f47be9fe5d3006927c79eb156cfbed946243e26.zip
tkzinc-3f47be9fe5d3006927c79eb156cfbed946243e26.tar.gz
tkzinc-3f47be9fe5d3006927c79eb156cfbed946243e26.tar.bz2
tkzinc-3f47be9fe5d3006927c79eb156cfbed946243e26.tar.xz
Ameliorations de la compil/installation en Perl
Diffstat (limited to 'Perl/t')
-rw-r--r--Perl/t/zinc.t72
1 files changed, 46 insertions, 26 deletions
diff --git a/Perl/t/zinc.t b/Perl/t/zinc.t
index f345ec2..0d2f1bf 100644
--- a/Perl/t/zinc.t
+++ b/Perl/t/zinc.t
@@ -1,4 +1,22 @@
-#!/usr/bin/perl
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl zinc.t'
+
+######################### We start with some black magic to print on failure.
+
+# Change 1..1 below to 1..last_test_to_print .
+# (It may become useful if the test is moved to ./t subdirectory.)
+
+BEGIN { $| = 1; print "1..1\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use Tk::Zinc;
+$loaded = 1;
+print "ok 1\n";
+
+######################### End of black magic.
+
+# Insert your test code below (better if it prints "ok 13"
+# (correspondingly "not ok 13") depending on the success of chunk 13
+# of the test code):
use Tk;
@@ -25,7 +43,7 @@ $logo = $mw->Photo(-file => "$image_path/logo.gif");
#MainLoop; exit;
$top = 1;
$zinc = $mw->Zinc(-backcolor => 'skyblue', -relief => 'sunken');
-$zinc->pack(-expand => t, -fill => 'both');
+$zinc->pack(-expand => 't', -fill => 'both');
$zinc->configure(-width => 800, -height => 500);
$color = $zinc->cget("-backcolor"); print "zinc backcolor=$color\n";
@@ -69,7 +87,7 @@ $zinc->itemconfigure($track, 1, -filled => 1 , -backcolor => "green",
$zinc->itemconfigure($track, 1, -filled => 1 , -backcolor => "green",
-border => "contour");
$zinc->itemconfigure($track, 2, -image => $logo , -alignment => "center");
-$mk = $zinc->itemcget($track, -markercolor);
+#$mk = $zinc->itemcget($track, -markercolor);
$zinc->itemconfigure($track, 0, -reliefthickness => 2, -relief => "sunken",
-bordercolor => "red", -border => "noborder");
@@ -136,14 +154,14 @@ $mw->videomap("load", "$map_path/hegias_parouest_TE.vid", 0, "paris-ouest");
print "videomap ids : ",
join('|', $mw->videomap("ids", "$map_path/videomap_orly")),"\n";
-$map = $zinc->add("map", $top, -color => red);
-$zinc->itemconfigure($map,-mapinfo => orly);
+$map = $zinc->add("map", $top, -color => 'red');
+$zinc->itemconfigure($map,-mapinfo => 'orly');
-$map2 = $zinc->add("map", $top, -color => green, -filled => 1, -priority => 0,
- -fillpattern => AlphaStipple6);
-#$zinc->itemconfigure($map2, -mapinfo => paris-ouest);
+#$map2 = $zinc->add("map", $top, -color => 'green', -filled => 1, -priority => 0,
+# -fillpattern => AlphaStipple6);
+#$zinc->itemconfigure($map2, -mapinfo => 'paris-ouest');
-$map3 = $zinc->add("map", $top, -color => orange);
+$map3 = $zinc->add("map", $top, -color => 'orange');
$zinc->itemconfigure($map3,-mapinfo => "paris-w");
@@ -151,38 +169,38 @@ $zinc->itemconfigure($map3,-mapinfo => "paris-w");
#creation rectangle, arc, curve
###################################################
-$rect = $zinc->add(rectangle, $top, [-50, -50, 50, -80], -linecolor => bisque);
-$zinc->bind($rect, '<Enter>', sub { $zinc->itemconfigure($rect, -linecolor => red)});
-$zinc->bind($rect, '<Leave>', sub { $zinc->itemconfigure($rect, -linecolor => bisque)});
+$rect = $zinc->add('rectangle', $top, [-50, -50, 50, -80], -linecolor => 'bisque');
+$zinc->bind($rect, '<Enter>', sub { $zinc->itemconfigure($rect, -linecolor => 'red')});
+$zinc->bind($rect, '<Leave>', sub { $zinc->itemconfigure($rect, -linecolor => 'bisque')});
-$arc = $zinc->add(arc, $top, [-100, 80, -50, 30], -linecolor => bisque,
+$arc = $zinc->add('arc', $top, [-100, 80, -50, 30], -linecolor => 'bisque',
-tags => ["arc"]);
#$zinc->addtag("fleche",'withtag', $arc);
#$zinc->addtag("carquois",'withtag', $arc);
-$zinc->add(rectangle, $top, [-101, 81, -49, 29], -linecolor => green);
+$zinc->add('rectangle', $top, [-101, 81, -49, 29], -linecolor => 'green');
$zinc->raise($arc);
-$zinc->bind($arc, '<Enter>', sub {$zinc->itemconfigure($arc, -linecolor => red)});
-$zinc->bind($arc, '<Leave>', sub {$zinc->itemconfigure($arc, -linecolor => bisque)});
+$zinc->bind($arc, '<Enter>', sub {$zinc->itemconfigure($arc, -linecolor => 'red')});
+$zinc->bind($arc, '<Leave>', sub {$zinc->itemconfigure($arc, -linecolor => 'bisque')});
print "arc tags=", join('|',$zinc->gettags($arc)),"\n";
$zinc->itemconfigure($arc, -startangle => 0, -extent => 360);
-$mp = $zinc->add(curve, $top, [-300, 0, -250, 100, -80, 20]);
-$zinc->itemconfigure($mp, -filled => 1, -linewidth => 4, -linecolor => yellow,
- -fillcolor => tan, -fillpattern => AlphaStipple8);
-$zinc->itemconfigure($mp, -marker => AtcSymbol9 , -markercolor => red);
+$mp = $zinc->add('curve', $top, [-300, 0, -250, 100, -80, 20]);
+$zinc->itemconfigure($mp, -filled => 1, -linewidth => 4, -linecolor => 'yellow',
+ -fillcolor => 'tan', -fillpattern => AlphaStipple8);
+$zinc->itemconfigure($mp, -marker => AtcSymbol9 , -markercolor => 'red');
###################################################
# Map info
###################################################
$mw->mapinfo('mpessai', 'create');
-$mw->mapinfo('mpessai', add, text, normal, simple, 0, 200, "Et voilą");
-$mw->mapinfo(mpessai, add, line, simple, 0, 0, 0, 0, 200);
-#$mw->mapinfo('mpessai', add, line, simple, 5, -100, 100, 0, 0);
-$zinc->itemconfigure($map3, -mapinfo => mpessai);
+$mw->mapinfo('mpessai', 'add', 'text', 'normal', 'simple', 0, 200, "Et voilą");
+$mw->mapinfo('mpessai', 'add', 'line', 'simple', 0, 0, 0, 0, 200);
+#$mw->mapinfo('mpessai', 'add', 'line', 'simple', 5, -100, 100, 0, 0);
+$zinc->itemconfigure($map3, -mapinfo => 'mpessai');
-print "mapinfo count line : ", $mw->mapinfo(mpessai, count, line),"\n";
-print "mapinfo get line 3: ", join('|',$mw->mapinfo(mpessai, get, line, 0)),"\n";
+print "mapinfo count line : ", $mw->mapinfo('mpessai', 'count', 'line'),"\n";
+print "mapinfo get line 3: ", join('|',$mw->mapinfo('mpessai', 'get', 'line', 0)),"\n";
###################################################
# tests diverses methodes
###################################################
@@ -223,3 +241,5 @@ sub finditems {
print "--- overlapping --->",
join('|',$zinc->find('overlapping',$origx, $origy, $cornerx, $cornery)),"\n\n";
}
+
+1;