15
24
eval { require Tk::HList; };
16
ok($@, "", 'Problem loading Tk::HList');
25
is($@, "", 'Loading Tk::HList');
17
26
eval { $hlist = $mw->HList(); };
18
ok($@, "", 'Problem creating HList widget');
27
is($@, "", 'Creating HList widget');
19
28
ok( Tk::Exists($hlist) );
20
29
eval { $hlist->grid; };
21
ok($@, "", '$hlist->grid problem');
30
is($@, "", '$hlist->grid');
22
31
eval { $hlist->update; };
23
ok($@, "", '$hlist->update problem.');
32
is($@, "", '$hlist->update.');
25
34
$hlist->delete("all");
26
35
$hlist->add("entry with spaces");
27
36
my @bbox = $hlist->info('bbox', 'entry with spaces');
28
37
my @info = $hlist->info('item', @bbox[0, 1]);
29
ok($info[0], 'entry with spaces', 'Problems with spaces in entry path');
38
is($info[0], 'entry with spaces', 'Spaces in entry path');
45
54
eval { @dim = $hl->headerSize(0); };
46
ok($@, '', "Problems with headerSize method");
47
ok(scalar(@dim), 2, 'headerSize returned not a 2 element array: |'.
55
is($@, '', "headerSize method");
56
is(scalar(@dim), 2, 'headerSize returned a 2 element array: |'.
50
59
eval { $hlist->update; };
51
ok($@, "", '$hlist->update problem.');
60
is($@, "", '$hlist->update.');
53
62
eval { $hl->header('size', 1); }; # does not exist
54
ok($@ ne "", 1, "Oops, no error for non existent header field");
55
ok($@=~m/^Column "1" does not exist/, 1,
56
"'$@' does not match /^Column \"1\" does not exist/"
63
isnt($@, "", "Error for non existent header field");
64
like($@, qr/^Column "1" does not exist/,
65
"Error message matches /^Column \"1\" does not exist/"
58
67
eval { $hlist->update; };
59
ok($@, "", '$hlist->update problem.');
68
is($@, "", '$hlist->update.');
61
70
eval { $hl->info('selection'); };
62
ok($@, "", "Problem with info('selection') method.");
71
is($@, "", "info('selection') method.");
63
72
eval { $hl->infoSelection; };
64
ok($@, "", "Problem with infoSelection method.");
73
is($@, "", "infoSelection method.");
65
74
eval { $hlist->update; };
66
ok($@, "", '$hlist->update problem.');
75
is($@, "", '$hlist->update.');
68
77
$hl->add(1,-text=>'one');
69
78
my $val1 = ( $hl->entryconfigure(1, '-style') )[4];
70
79
# comment out the next line and at least I get always a SEGV
71
ok(!defined($val1), 1, "Ooops entryconfigure -style is defined");
80
isnt(defined($val1), "entryconfigure -style is not defined");
72
81
my $val2 = $hl->entrycget(1, '-style');
73
ok(!defined($val2), 1, "Ooops entrycget -style is defined");
82
isnt(defined($val2), "entrycget -style is not defined");
74
83
# ok($val1, $val2, "entryconfigure and entrycget do not agree");
76
85
my @bbox = $hl->infoBbox(1);
77
ok(scalar(@bbox), 4, "\@bbox not 4 items");
86
is(scalar(@bbox), 4, "\@bbox 4 items");
78
87
my $bbox = $hl->infoBbox(1);
79
ok(ref($bbox), 'ARRAY', "$bbox not an ARRAY");
88
is(ref($bbox), 'ARRAY', "$bbox is an ARRAY");
80
89
foreach my $a (@bbox)
82
ok($a, shift(@$bbox), "\$bbox values differ");
91
is($a, shift(@$bbox), "\$bbox values OK");
97
skip("Aborts with Tk804", 1)
98
if $Tk::VERSION <= 804.027;
102
$hl->add("top", -text => "top");
103
$hl->add("top.item1", -text => "item1");
104
$hl->add("top.item2", -text => "item2");
106
$hl->add("top.item3", -at => 0, -text => "item2");
107
$hl->add("top.item4", -before => "top.item1", -text => "item2");
108
$hl->add("top.item5", -after => "top.item1", -text => "item2");
110
pass("No abort with -at/-before/-after");
118
$hl->add("top", -text => "top");
119
$hl->add("top.item1", -text => "item1");
120
$hl->add("top.item2", -text => "item2");
122
ok(!$hl->info('hidden', 'top.item1'), "Item initially not hidden");
123
$hl->hide('entry','top.item1');
124
ok($hl->info('hidden', 'top.item1'), "Item now hidden");
125
$hl->show('entry','top.item1');
126
ok(!$hl->info('hidden', 'top.item1'), "Item not hidden again");
127
$hl->hideEntry('top.item1');
128
ok($hl->info('hidden', 'top.item1'), "Undocumented method hideEntry also works");
136
pass("addchild with empty string");