From d280097e2f36aac6153bbe9837076062ff3061bf Mon Sep 17 00:00:00 2001 From: mertz Date: Thu, 23 Jun 2005 18:11:10 +0000 Subject: renaming the file as a test (.t prefix) script --- Perl/t/Scale_clipped_group.pl | 89 ------------------------------------------- Perl/t/Scale_clipped_group.t | 89 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 89 deletions(-) delete mode 100644 Perl/t/Scale_clipped_group.pl create mode 100644 Perl/t/Scale_clipped_group.t (limited to 'Perl') diff --git a/Perl/t/Scale_clipped_group.pl b/Perl/t/Scale_clipped_group.pl deleted file mode 100644 index 1facee3..0000000 --- a/Perl/t/Scale_clipped_group.pl +++ /dev/null @@ -1,89 +0,0 @@ -# -# $Id$ -# Author: Christophe Mertz mertz@intuilab.com, adapted from a script -# reported by Daniel Etienne for a bug report in Tk::Zinc 3.2.96 -# - -use strict; - -# testing all the import - -BEGIN { - if (!eval q{ - use Test::More tests => 1; - 1; - }) { - print "# tests only work properly with installed Test::More module\n"; - print "1..1\n"; - print "ok 1\n"; - exit; - } - if (!eval q{ - use Tk::Zinc; - 1; - }) { - print "unable to load Tk::Zinc"; - print "1..1\n"; - print "ok 1\n"; - exit; - } -} -use Tk; - -my $mw = MainWindow->new(); -my $zinc = $mw->Zinc(-render => 0)->pack(-expand => 1, -fill => "both"); - - -# creating the father group 1 and 2 -my $fatherGroup1=$zinc->add("group", 1); -my $fatherGroup2=$zinc->add("group", 1); - -$zinc->coords($fatherGroup1, [50,100]); -$zinc->coords($fatherGroup2, [200,100]); - -# creating subGroup 1 and 2 -my $subGroup1=$zinc->add("group", $fatherGroup1); -my $subGroup2=$zinc->add("group", $fatherGroup2); - -# creating null sized rectangle 1 to clip the subgroup 1 -my $rectangle1 = $zinc->add("rectangle", $subGroup1, [ [0, 0], [0, 0] ]); - -$zinc->itemconfigure($subGroup1, -clip => $rectangle1); - -# creating an icon in the sub-group -my $surroundimgfile = Tk->findINC("Tk.xbm"); - -my $surroundimg = $zinc->Bitmap(-file => $surroundimgfile, - -foreground => 'sienna', - ); -my $icon1 = $zinc->add("icon", $subGroup1, - -image => $surroundimg, - ); -my $icon2 = $zinc->add("icon", $subGroup2, - -image => $surroundimg, - ); - - -## scaling fatherGroup1 makes an image visible on 3.2.96/3.3.2 TkZinc version -$zinc->scale($fatherGroup1, 0.8, 0.8); - - -&wait ("You should see ONLY ONE ptk ICON (a camel), please INSPECT VISUALY!"); sleep 2; - - -sub wait { - $zinc->update; - ok (1, $_[0]); - - my $delay = $ARGV[0]; - if (defined $delay) { - $zinc->update; - if ($delay =~ /^\d+$/) { - sleep $delay; - } else { - sleep 1; - } - } -} - - diff --git a/Perl/t/Scale_clipped_group.t b/Perl/t/Scale_clipped_group.t new file mode 100644 index 0000000..37c5183 --- /dev/null +++ b/Perl/t/Scale_clipped_group.t @@ -0,0 +1,89 @@ +# +# $Id: Scale_clipped_group.t,v 1.1 2005-06-23 18:11:10 mertz Exp $ +# Author: Christophe Mertz mertz@intuilab.com, adapted from a script +# reported by Daniel Etienne for a bug report in Tk::Zinc 3.2.96 +# + +use strict; + +# testing all the import + +BEGIN { + if (!eval q{ + use Test::More tests => 1; + 1; + }) { + print "# tests only work properly with installed Test::More module\n"; + print "1..1\n"; + print "ok 1\n"; + exit; + } + if (!eval q{ + use Tk::Zinc; + 1; + }) { + print "unable to load Tk::Zinc"; + print "1..1\n"; + print "ok 1\n"; + exit; + } +} +use Tk; + +my $mw = MainWindow->new(); +my $zinc = $mw->Zinc(-render => 0)->pack(-expand => 1, -fill => "both"); + + +# creating the father group 1 and 2 +my $fatherGroup1=$zinc->add("group", 1); +my $fatherGroup2=$zinc->add("group", 1); + +$zinc->coords($fatherGroup1, [50,100]); +$zinc->coords($fatherGroup2, [200,100]); + +# creating subGroup 1 and 2 +my $subGroup1=$zinc->add("group", $fatherGroup1); +my $subGroup2=$zinc->add("group", $fatherGroup2); + +# creating null sized rectangle 1 to clip the subgroup 1 +my $rectangle1 = $zinc->add("rectangle", $subGroup1, [ [0, 0], [0, 0] ]); + +$zinc->itemconfigure($subGroup1, -clip => $rectangle1); + +# creating an icon in the sub-group +my $surroundimgfile = Tk->findINC("Tk.xbm"); + +my $surroundimg = $zinc->Bitmap(-file => $surroundimgfile, + -foreground => 'sienna', + ); +my $icon1 = $zinc->add("icon", $subGroup1, + -image => $surroundimg, + ); +my $icon2 = $zinc->add("icon", $subGroup2, + -image => $surroundimg, + ); + + +## scaling fatherGroup1 makes an image visible on 3.2.96/3.3.2 TkZinc version +$zinc->scale($fatherGroup1, 0.8, 0.8); + + +&wait ("You should see ONLY ONE ptk ICON (a camel), please INSPECT VISUALY!"); sleep 2; + + +sub wait { + $zinc->update; + ok (1, $_[0]); + + my $delay = $ARGV[0]; + if (defined $delay) { + $zinc->update; + if ($delay =~ /^\d+$/) { + sleep $delay; + } else { + sleep 1; + } + } +} + + -- cgit v1.1