File: podtree.t

package info (click to toggle)
libtk-pod-perl 0.9943-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 456 kB
  • sloc: perl: 4,877; makefile: 14
file content (66 lines) | stat: -rwxr-xr-x 1,251 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/perl -w
# -*- perl -*-

#
# Author: Slaven Rezic
#

use strict;

use Tk;
use Tk::Pod::Tree;
use Tk::Pod::FindPods;

BEGIN {
    if (!eval q{
	use Test::More;
	1;
    }) {
	print "# tests only work with installed Test::More module\n";
	print "1..1\n";
	print "ok 1\n";
	CORE::exit(0);
    }
}

my $mw = eval { tkinit };
if (!$mw) {
    print "1..0 # cannot create MainWindow\n";
    CORE::exit(0);
}
$mw->geometry("+1+1"); # for twm

plan tests => 5;

my $pt;
$pt = $mw->Scrolled("PodTree",
		    -scrollbars => "osow",
		    -showcommand => sub {
			warn $_[1]->{File};
		    },
		   )->grid(-sticky => "esnw");
$mw->gridColumnconfigure(0, -weight => 1);
$mw->gridRowconfigure(0, -weight => 1);

diag <<EOF;
#
# Tests may take a long time (up to 10 minutes or so) if you have a lot
# of modules installed.
EOF

ok Tk::Exists($pt), 'PodTree widget exists';
$pt->Fill;
pass 'after calling Fill method';

my $FindPods = Tk::Pod::FindPods->new;
isa_ok $FindPods, 'Tk::Pod::FindPods';
my $pods = $FindPods->pod_find(-categorized => 1, -usecache => 1);
isa_ok $pods, 'HASH';
my $path = $pods->{perl}{ (keys %{ $pods->{perl} })[0] };
$pt->SeePath($path);
pass 'after calling SeePath method';

$mw->afterIdle(sub{$mw->destroy});
MainLoop;

__END__