UI-Dialog
view release on metacpan or search on metacpan
t/UI-Dialog-Backend-XDialog.t view on Meta::CPAN
use Test::More;
BEGIN { use_ok( 'UI::Dialog::Backend::XDialog' ); }
require_ok( 'UI::Dialog::Backend::XDialog' );
#########################
eval { new UI::Dialog::Backend::XDialog(test_mode=>1); };
if ( $@ ) {
if ($@ =~ m!binary could not be found!) {
diag("Tests skipped, backend binary not found.");
} else {
diag("An unknown error occurred while trying to use backend: ".$@);
}
done_testing();
} else {
my $obj = new UI::Dialog::Backend::XDialog(test_mode=>1);
isa_ok( $obj, 'UI::Dialog::Backend::XDialog' );
my @methods = qw( new state ra rs rv nautilus xosd beep clear
yesno msgbox inputbox password textbox menu
checklist radiolist fselect dselect
state combobox
rangebox rangesbox2 rangesbox3 spinbox spinsbox2
spinsbox3 buildlist treeview calendar timebox
inputsbox2 inputsbox3 passwords2 passwords3
msgbox infobox textbox editbox logbox tailbox
progress_start progress_inc progress_dec
progress_set progress_stop gauge_start gauge_inc
gauge_dec gauge_set gauge_text gauge_stop );
can_ok( 'UI::Dialog::Backend::XDialog', @methods );
# Track $bin is needed to validate the command line constructs
my $bin = $obj->get_bin();
#
#: Test the standard dialog widgets
#
#: Test the yes/no prompt
$obj->yesno( title=>"TITLE", backtitle => "BACKTITLE", text => "TEXT",
width => 64, height => 16 );
is( $obj->get_unit_test_result(),
$bin.' --title TITLE --backtitle BACKTITLE --button-style default --yesno TEXT 16 64'
);
#: Test the message box
$obj->msgbox( title=>"TITLE", backtitle => "BACKTITLE", text => "TEXT",
width => 64, height => 16 );
is( $obj->get_unit_test_result(),
$bin.' --title TITLE --backtitle BACKTITLE --button-style default --msgbox TEXT 16 64'
);
#: Test the info box
$obj->infobox( title=>"TITLE", backtitle => "BACKTITLE", text => "TEXT",
width => 64, height => 16 );
is( $obj->get_unit_test_result(),
$bin.' --title TITLE --backtitle BACKTITLE --button-style default --infobox TEXT 16 64 5000'
);
#: Test the input box
$obj->inputbox( title=>"TITLE", backtitle => "BACKTITLE", text => "TEXT",
width => 64, height => 16, entry => ENTRY );
is( $obj->get_unit_test_result(),
$bin.' --title TITLE --backtitle BACKTITLE --button-style default --inputbox TEXT 16 64 ENTRY'
);
#: Test the password box
$obj->password( title=>"TITLE", backtitle => "BACKTITLE", text => "TEXT",
width => 64, height => 16, entry => "ENTRY" );
is( $obj->get_unit_test_result(),
$bin.' --title TITLE --backtitle BACKTITLE --button-style default --password --inputbox TEXT 16 64 ENTRY'
);
#: Test the text file box
$obj->textbox( title=>"TITLE", backtitle => "BACKTITLE", path => "$0",
width => 64, height => 16 );
is( $obj->get_unit_test_result(),
$bin.' --title TITLE --backtitle BACKTITLE --button-style default --textbox t/UI-Dialog-Backend-XDialog.t 16 64'
);
#: Test the menu prompt
$obj->menu( title=>"TITLE", backtitle => "BACKTITLE", text => "TEXT",
( run in 0.528 second using v1.01-cache-2.11-cpan-2398b32b56e )