| 1 |
BEGIN { $|=1; $^W=1; } |
| 2 |
use strict; |
| 3 |
use Test; |
| 4 |
use Tk; |
| 5 |
|
| 6 |
BEGIN { plan tests => 31 }; |
| 7 |
|
| 8 |
my $mw = Tk::MainWindow->new; |
| 9 |
my $xpm; |
| 10 |
my $photo; |
| 11 |
|
| 12 |
{ |
| 13 |
eval { require Tk::Photo; }; |
| 14 |
ok($@, '', 'Problem loading Tk::Photo'); |
| 15 |
eval { $xpm = Tk::findINC('Tk::folder.xpm'); }; |
| 16 |
ok (defined($xpm), 1, "Can't locate Tk::folder.xpm"); |
| 17 |
eval { $photo = $mw->Photo(-file=>$xpm); }; |
| 18 |
ok($@, '', 'Problem creating Photo widget'); |
| 19 |
} |
| 20 |
|
| 21 |
## |
| 22 |
## configure('-data') returned '-data {} {} {} {}' up and incl. Tk800.003 |
| 23 |
## |
| 24 |
{ |
| 25 |
my @opts; |
| 26 |
my $opts; |
| 27 |
foreach my $opt ( qw/-data -format -file -gamma -height -width/ ) |
| 28 |
{ |
| 29 |
eval { @opts = $photo->configure($opt); }; |
| 30 |
ok($@, '', "can't do configure $opt"); |
| 31 |
ok(scalar(@opts), 5, "configure $opt returned not 5 elements"); |
| 32 |
eval { $opts = $photo->configure($opt); }; |
| 33 |
ok($@, '', "can't do configure $opt"); |
| 34 |
ok(scalar(@$opts), 5, "configure $opt returned not 5 elements"); |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
{ |
| 39 |
ok $photo->image('inuse'), 0, 'photo is not in use'; |
| 40 |
ok $photo->inuse, 0, 'photo is not in use'; |
| 41 |
$mw->Label(-image => $photo); |
| 42 |
ok $photo->image('inuse'), 1, 'photo is now in use'; |
| 43 |
ok $photo->inuse, 1, 'photo is now in use'; |
| 44 |
} |
| 45 |
|
| 46 |
1; |
| 47 |
__END__ |