| 1 |
BEGIN { $^W = 1; $| = 1;} |
| 2 |
use strict; |
| 3 |
use Test; |
| 4 |
use Tk; |
| 5 |
use Tk::Photo; |
| 6 |
|
| 7 |
|
| 8 |
my $mw = MainWindow->new(); |
| 9 |
$mw->geometry('+100+100'); |
| 10 |
|
| 11 |
plan tests => 8; |
| 12 |
|
| 13 |
my $c = $mw->Canvas->pack; |
| 14 |
my $p = $mw->Photo(-height => 10, -width => 10); |
| 15 |
|
| 16 |
$c->configure(-offset => "ne"); |
| 17 |
ok($c->cget(-offset), "ne", "-offset wrong (anchor)"); |
| 18 |
|
| 19 |
$c->configure(-offset => [10,20]); |
| 20 |
my $a = $c->cget(-offset); |
| 21 |
ok($a->[0], 10, "-offset wrong (x value)"); |
| 22 |
ok($a->[1], 20, "-offset wrong (y value)"); |
| 23 |
|
| 24 |
$c->configure(-offset => ['#',10,20]); |
| 25 |
$a = $c->cget(-offset); |
| 26 |
ok($a->[0], '#', "-offset wrong (relative)"); |
| 27 |
ok($a->[1], 10, "-offset wrong (x value)"); |
| 28 |
ok($a->[2], 20, "-offset wrong (y value)"); |
| 29 |
|
| 30 |
eval { $c->configure(-offset => "wrong") }; |
| 31 |
ok($@ =~ /bad offset/, 1, "no error detected"); |
| 32 |
|
| 33 |
eval { $c->configure(-tile => $p) }; |
| 34 |
ok($@, '', "cannot set -tile"); |