Debian Codegraph @

t/itemstyle.t

raw
1 #!/usr/bin/perl -w
2 # -*- perl -*-
3
4 #
5 # Author: Slaven Rezic
6 #
7
8 use strict;
9
10 BEGIN {
11 if (!eval q{
12 use Test::More;
13 1;
14 }) {
15 print "1..0 # skip no Test::More module\n";
16 exit;
17 }
18 }
19
20 plan tests => 3;
21
22 use Tk;
23 use Tk::HList;
24 use Tk::ItemStyle;
25
26 my $mw = Tk::MainWindow->new;
27 eval { $mw->geometry('+10+10'); }; # This works for mwm and interactivePlacement
28
29 my $hl = $mw->HList(-columns => 2);
30 my $is = $mw->ItemStyle('text', -anchor => 'nw');
31 isa_ok $is, 'Tk::ItemStyle';
32
33 $hl->headerCreate(0, -style => $is);
34 pass 'Setting itemstyle worked';
35
36 eval { $hl->headerCreate(1, -style => 'invalid_style') };
37 like $@, qr{Display style "invalid_style" not found}, 'Invalid ItemStyle used';
38
39 __END__