#! perl -w
=head1 NAME
15_Text.t - test text widgets
=head1 DESCRIPTION
Need to get a full report of the case from the user.
=cut
use ExtUtils::testlib;
use Test::More no_plan;
BEGIN {
use_ok('Tk::Wizard');
}
my $VERSION = do { my @r = (q$Revision: 1.5 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
use strict;
use FileHandle;
autoflush STDOUT 1;
use Cwd;
my $root = cwd =~ /\/t$/? '..' : '.';
use vars qw/$GET_DIR $GET_FILE $user_chosen_dir $user_chosen_file $SPLASH/;
our $WAIT = 1;
#
# Instantiate Wizard
#
my $looped = 0;
foreach my $style ('top', '95') {
my $wizard = new Tk::Wizard(
-title => "Test v$VERSION For Wizard $Tk::Wizard::VERSION",
-style => $style,
);
isa_ok($wizard, "Tk::Wizard");
$wizard->configure(
-preNextButtonAction => sub { &preNextButtonAction($wizard); },
-finishButtonAction => sub { ok(1, 'user clicked finish'); },
);
isa_ok($wizard->cget(-preNextButtonAction), "Tk::Callback");
#
# Create pages
#
$SPLASH = $wizard->addPage( sub{ page_splash ($wizard,$looped)} );
is( $SPLASH, 1);
is( $wizard->addPage( sub{ page_text_textbox1($wizard) }), 2);
is( $wizard->addPage( sub{ page_text_textbox2($wizard) }), 3);
isa_ok($wizard->parent, "Tk::MainWindow");
$wizard->Show;
MainLoop();
ok(1);
undef $wizard;
}
exit;
sub page_splash { my ($wizard, $looped) = (shift, shift);
my ($frame,@pl) = $wizard->blank_frame(
-wait => $WAIT,
-title => ($looped==0? "Welcome to the Wizard" : "Testing the Old Style"),
-subtitle =>"RT Case 26607",
-text => "User case: RT 26607 =
http://rt.cpan.org/Ticket/Display.html?id=26607",
);
return $frame;
}
sub page_text_textbox1 { my $wizard = shift;
# diag('start page_text_textbox1');
my $text = "This is in a box: "
."string literal, with \\n\n...and \\r\r...and \\f\fand \\t\t...";
my $frame = $wizard->text_frame(
-wait => $WAIT,
-title =>"1: Test"
-boxedtext => \$text,
);
$frame
return $frame;
}
sub page_text_textbox2 { my $wizard = shift;
# diag('start page_text_textbox2');
my $frame = $wizard->text_frame(
-wait => $WAIT,
-title =>"2: Text from filename",
-boxedtext => $root.'/perl_licence_blab.txt',
);
return $frame;
}
sub preNextButtonAction { my $wizard = shift;
# diag("start preNextButtonAction, wizard is $wizard");
local $_ = $wizard->currentPage;
return 1;
}
__END__