| 1 |
#!/usr/bin/perl -w |
| 2 |
# -*- perl -*- |
| 3 |
|
| 4 |
# |
| 5 |
# Author: Slaven Rezic |
| 6 |
# |
| 7 |
|
| 8 |
use strict; |
| 9 |
|
| 10 |
use Getopt::Long; |
| 11 |
use Tk; |
| 12 |
|
| 13 |
BEGIN { |
| 14 |
if (!eval q{ |
| 15 |
use Test::More; |
| 16 |
1; |
| 17 |
}) { |
| 18 |
print "1..0 # skip no Test::More module\n"; |
| 19 |
exit; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
my $mw = eval { tkinit }; |
| 24 |
if (!$mw) { |
| 25 |
plan skip_all => 'Cannot create MainWindow'; |
| 26 |
CORE::exit(0); |
| 27 |
} |
| 28 |
|
| 29 |
plan tests => 1; |
| 30 |
|
| 31 |
my $show; |
| 32 |
GetOptions("show!" => \$show) |
| 33 |
or die "usage: $0 [-show]"; |
| 34 |
|
| 35 |
$mw->geometry('+0+0'); |
| 36 |
my $c = $mw->Canvas->pack; |
| 37 |
$c->createGrid(0,0,20,20, -color=>'blue'); # as documented |
| 38 |
$c->createGrid(10,10,30,30, -fill=>'red'); # as implemented for a long time |
| 39 |
pass 'createGrid done'; |
| 40 |
|
| 41 |
if (!$show) { |
| 42 |
$mw->after(200, sub { $mw->destroy }); |
| 43 |
} |
| 44 |
MainLoop; |
| 45 |
|
| 46 |
__END__ |