older Tk doesn't supply the windowing system method
[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
26plan tests => 1;
27
28my $im;
29$mw->Label(-text => "test: $0")->pack;
30$mw->after(100 =>
31 sub {
32 $im = screenshot(widget => $mw, decor => 1)
33 or print "# ", Imager->errstr, "\n";
34 $mw->destroy;
35 });
36MainLoop();
37ok($im, "grab from a Tk widget (X11)");