- t/30tkx11.t now provides a default gemoetry to prevent
[imager-screenshot.git] / t / 30tkx11.t
CommitLineData
b2239557
TC
1#!perl -w
2use strict;
3use Test::More;
4
5use Imager::Screenshot 'screenshot';
6
7Imager::Screenshot->have_x11
8 or plan skip_all => "No X11 support";
9
10my $display = Imager::Screenshot::x11_open()
11 or plan skip_all => "Cannot connect to display: ".Imager->errstr;
12
13Imager::Screenshot::x11_close($display);
14
15eval "use Tk;";
16$@
17 and plan skip_all => "Tk not available";
18
19my $mw = Tk::MainWindow->new;
20
6d2b10ba
TC
21$mw->can('windowingsystem')
22 or plan skip_all => 'Cannot determine windowing system';
b2239557
TC
23$mw->windowingsystem eq 'x11'
24 or plan skip_all => 'Tk windowing system not X11';
25
53ccbd1e
TC
26eval { $mw->geometry('+10+10'); };
27
b2239557
TC
28plan tests => 1;
29
30my $im;
31$mw->Label(-text => "test: $0")->pack;
32$mw->after(100 =>
33 sub {
34 $im = screenshot(widget => $mw, decor => 1)
35 or print "# ", Imager->errstr, "\n";
36 $mw->destroy;
37 });
38MainLoop();
39ok($im, "grab from a Tk widget (X11)");