| 1 |
#!/usr/bin/perl -w |
| 2 |
# -*- perl -*- |
| 3 |
|
| 4 |
# |
| 5 |
# $Id: $ |
| 6 |
# Author: Slaven Rezic |
| 7 |
# |
| 8 |
|
| 9 |
use strict; |
| 10 |
|
| 11 |
use Tk; |
| 12 |
use Tk::PNG; |
| 13 |
use FindBin; |
| 14 |
|
| 15 |
BEGIN { |
| 16 |
if (!eval q{ |
| 17 |
use Test::More; |
| 18 |
1; |
| 19 |
}) { |
| 20 |
print "1..0 # skip: no Test::More module\n"; |
| 21 |
exit; |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
plan tests => 1; |
| 26 |
|
| 27 |
my $mw = tkinit; |
| 28 |
$mw->geometry('+10+10'); |
| 29 |
|
| 30 |
$mw->packPropagate(0); |
| 31 |
my $file = "$FindBin::RealBin/../pngtest.png"; |
| 32 |
my $img = $mw->Photo(-file => $file); |
| 33 |
$mw->Label(-image => $img)->pack; |
| 34 |
$mw->afterIdle |
| 35 |
(sub { |
| 36 |
$mw->GeometryRequest($img->width, $img->height); |
| 37 |
$mw->after(100, |
| 38 |
sub { |
| 39 |
$mw->GeometryRequest($img->width-20, $img->height-20); |
| 40 |
$mw->after(100, |
| 41 |
sub { |
| 42 |
$mw->destroy; |
| 43 |
} |
| 44 |
); |
| 45 |
} |
| 46 |
); |
| 47 |
}); |
| 48 |
MainLoop; |
| 49 |
|
| 50 |
pass("No crash while resizing a window with PNG image"); |
| 51 |
|
| 52 |
__END__ |