diff options
author | Angelo Naselli <anaselli@linux.it> | 2014-12-10 18:16:48 +0100 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2014-12-10 18:16:48 +0100 |
commit | 742aef75e939b44cbeccc5304e265b6fa59235d2 (patch) | |
tree | 65efdae417bfd09b040b825517bfc43e1046fd1b /t/03-Shared_GUI.t | |
parent | 735e5e5992d445c7ff30d3a83275b0eb9951f09d (diff) | |
download | colin-keep-742aef75e939b44cbeccc5304e265b6fa59235d2.tar colin-keep-742aef75e939b44cbeccc5304e265b6fa59235d2.tar.gz colin-keep-742aef75e939b44cbeccc5304e265b6fa59235d2.tar.bz2 colin-keep-742aef75e939b44cbeccc5304e265b6fa59235d2.tar.xz colin-keep-742aef75e939b44cbeccc5304e265b6fa59235d2.zip |
Skipped GUI dialog testing (enable them by running make test TEST_GUI=1)
thanks to Thierry Vignaud for the suggestion
Diffstat (limited to 't/03-Shared_GUI.t')
-rw-r--r-- | t/03-Shared_GUI.t | 103 |
1 files changed, 49 insertions, 54 deletions
diff --git a/t/03-Shared_GUI.t b/t/03-Shared_GUI.t index c2cef88..1a781cb 100644 --- a/t/03-Shared_GUI.t +++ b/t/03-Shared_GUI.t @@ -12,60 +12,55 @@ BEGIN { ok( my $gui = AdminPanel::Shared::GUI->new(), 'create'); - diag "\n\nNext tests will create some gui dialogs"; - diag "Perform tests (y/n) [n] ?"; - - my $a = <>; chomp $a; $a = "n" unless $a; - - SKIP: { - #remember to skip the righ number of tests - skip "You didn't say yes...", 11, unless ( $a eq "y" ); - - ok( $gui->warningMsgBox({text => "Warning message! (no title, no richtext)<br> line two"}), 'wmb1'); - - ok( $gui->warningMsgBox({text => "Warning message!<br> line two", title => "WARN", richtext => 1}), 'wmb2'); - - ok($gui->infoMsgBox({text => "Info message!<br> line two", title => "INFO", richtext => 1}), 'imb'); - - ok($gui->msgBox({text => "Normal message! (no title, no richtext)<br> line two"}), 'mb1'); - - ok($gui->msgBox({title => "Message", text => "Normal message!<br> line two", richtext=>1}), 'mb2'); - - cmp_ok(my $btn = $gui->ask_OkCancel({title => "Tests", text => "All these tests seem to be passed"}), ">=", 0, 'askOkCancel'); - diag "ask_OkCancel got: < " . ($btn == 1 ? "Ok": "Cancel"). " >"; - - cmp_ok($btn = $gui->ask_YesOrNo({title => "Question on tests", text => "Did these tests all pass?"}), ">=", 0, 'ask_YesOrNo'); - diag "ask_YesOrNo got: < " . ($btn == 1 ? "Yes": "No"). " >"; - - #TODO cancel makes this test failing - ok(my $item = $gui->ask_fromList({title => "Choose from list", header => "Which one do you select? [default is item 3]", default_button => 1, - list => ['item 1', 'item 2', 'item 3', 'item 4'], - default_item => 'item 3' - }), 'ask_fromList'); - diag "ask_fromList got: < " . ($item ? $item : "none") . " >"; - - #TODO cancel makes this test failing - ok($item = $gui->ask_fromTreeList({title => "Choose from list", header => "Which one do you select? [default is leaf 2]", default_button => 1, - default_item => 'leaf 2', - list => ['item 1/item 2/item 3', 'item 1/item 2/leaf 1', 'item 1/item 2/leaf 2', 'item 4/leaf 3', 'item 5']}), - 'ask_fromTreeList'); - diag "ask_fromTreeList got: < " . ($item ? $item : "none") . " >"; - - ok($gui->AboutDialog({ name => "Shared::GUI TABBED", - version => $AdminPanel::Shared::VERSION, - credits => "Copyright (C) 2014 Angelo Naselli", - license => 'GPLv2', - authors => "Angelo Naselli <anaselli\@linux.it>\nMatteo Pasotti <matteo.pasotti\@gmail.com>", - }), 'AboutDialog'); - - ok($gui->AboutDialog({ name => "Shared::GUI CLASSIC", - version => $AdminPanel::Shared::VERSION, - credits => "Copyright (C) 2014 Angelo Naselli", - license => 'GPLv2', - authors => "Angelo Naselli <anaselli\@linux.it>\nMatteo Pasotti <matteo.pasotti\@gmail.com>", - dialog_mode => 1, - }), 'ClassicAboutDialog'); - } +SKIP: { + #remember to skip the righ number of tests + skip "To enable dialog tests set TEST_GUI", 11, unless $ENV{TEST_GUI}; + + ok( $gui->warningMsgBox({text => "Warning message! (no title, no richtext)<br> line two"}), 'wmb1'); + + ok( $gui->warningMsgBox({text => "Warning message!<br> line two", title => "WARN", richtext => 1}), 'wmb2'); + + ok($gui->infoMsgBox({text => "Info message!<br> line two", title => "INFO", richtext => 1}), 'imb'); + + ok($gui->msgBox({text => "Normal message! (no title, no richtext)<br> line two"}), 'mb1'); + + ok($gui->msgBox({title => "Message", text => "Normal message!<br> line two", richtext=>1}), 'mb2'); + + cmp_ok(my $btn = $gui->ask_OkCancel({title => "Tests", text => "All these tests seem to be passed"}), ">=", 0, 'askOkCancel'); + diag "ask_OkCancel got: < " . ($btn == 1 ? "Ok": "Cancel"). " >"; + + cmp_ok($btn = $gui->ask_YesOrNo({title => "Question on tests", text => "Did these tests all pass?"}), ">=", 0, 'ask_YesOrNo'); + diag "ask_YesOrNo got: < " . ($btn == 1 ? "Yes": "No"). " >"; + + #TODO cancel makes this test failing + ok(my $item = $gui->ask_fromList({title => "Choose from list", header => "Which one do you select? [default is item 3]", default_button => 1, + list => ['item 1', 'item 2', 'item 3', 'item 4'], + default_item => 'item 3' + }), 'ask_fromList'); + diag "ask_fromList got: < " . ($item ? $item : "none") . " >"; + + #TODO cancel makes this test failing + ok($item = $gui->ask_fromTreeList({title => "Choose from list", header => "Which one do you select? [default is leaf 2]", default_button => 1, + default_item => 'leaf 2', + list => ['item 1/item 2/item 3', 'item 1/item 2/leaf 1', 'item 1/item 2/leaf 2', 'item 4/leaf 3', 'item 5']}), + 'ask_fromTreeList'); + diag "ask_fromTreeList got: < " . ($item ? $item : "none") . " >"; + + ok($gui->AboutDialog({ name => "Shared::GUI TABBED", + version => $AdminPanel::Shared::VERSION, + credits => "Copyright (C) 2014 Angelo Naselli", + license => 'GPLv2', + authors => "Angelo Naselli <anaselli\@linux.it>\nMatteo Pasotti <matteo.pasotti\@gmail.com>", + }), 'AboutDialog'); + + ok($gui->AboutDialog({ name => "Shared::GUI CLASSIC", + version => $AdminPanel::Shared::VERSION, + credits => "Copyright (C) 2014 Angelo Naselli", + license => 'GPLv2', + authors => "Angelo Naselli <anaselli\@linux.it>\nMatteo Pasotti <matteo.pasotti\@gmail.com>", + dialog_mode => 1, + }), 'ClassicAboutDialog'); +} done_testing; |