From 3f47be9fe5d3006927c79eb156cfbed946243e26 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 4 Feb 2000 15:05:00 +0000 Subject: Ameliorations de la compil/installation en Perl --- Perl/t/zinc.t | 72 ++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 26 deletions(-) (limited to 'Perl/t') 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, '', sub { $zinc->itemconfigure($rect, -linecolor => red)}); -$zinc->bind($rect, '', sub { $zinc->itemconfigure($rect, -linecolor => bisque)}); +$rect = $zinc->add('rectangle', $top, [-50, -50, 50, -80], -linecolor => 'bisque'); +$zinc->bind($rect, '', sub { $zinc->itemconfigure($rect, -linecolor => 'red')}); +$zinc->bind($rect, '', 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, '', sub {$zinc->itemconfigure($arc, -linecolor => red)}); -$zinc->bind($arc, '', sub {$zinc->itemconfigure($arc, -linecolor => bisque)}); +$zinc->bind($arc, '', sub {$zinc->itemconfigure($arc, -linecolor => 'red')}); +$zinc->bind($arc, '', 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; -- cgit v1.1