1#!/usr/bin/perl -w 2# -*- perl -*- 3 4# 5# Author: Slaven Rezic 6# 7 8use strict; 9 10use Tk; 11use Tk::Pod::Tree; 12use Tk::Pod::FindPods; 13 14BEGIN { 15 if (!eval q{ 16 use Test::More; 17 1; 18 }) { 19 print "# tests only work with installed Test::More module\n"; 20 print "1..1\n"; 21 print "ok 1\n"; 22 CORE::exit(0); 23 } 24} 25 26my $mw = eval { tkinit }; 27if (!$mw) { 28 print "1..0 # cannot create MainWindow\n"; 29 CORE::exit(0); 30} 31$mw->geometry("+1+1"); # for twm 32 33plan tests => 5; 34 35my $pt; 36$pt = $mw->Scrolled("PodTree", 37 -scrollbars => "osow", 38 -showcommand => sub { 39 warn $_[1]->{File}; 40 }, 41 )->grid(-sticky => "esnw"); 42$mw->gridColumnconfigure(0, -weight => 1); 43$mw->gridRowconfigure(0, -weight => 1); 44 45diag <<EOF; 46# 47# Tests may take a long time (up to 10 minutes or so) if you have a lot 48# of modules installed. 49EOF 50 51ok Tk::Exists($pt), 'PodTree widget exists'; 52$pt->Fill; 53pass 'after calling Fill method'; 54 55my $FindPods = Tk::Pod::FindPods->new; 56isa_ok $FindPods, 'Tk::Pod::FindPods'; 57my $pods = $FindPods->pod_find(-categorized => 1, -usecache => 1); 58isa_ok $pods, 'HASH'; 59my $path = $pods->{perl}{ (keys %{ $pods->{perl} })[0] }; 60$pt->SeePath($path); 61pass 'after calling SeePath method'; 62 63$mw->afterIdle(sub{$mw->destroy}); 64MainLoop; 65 66__END__ 67