aboutsummaryrefslogtreecommitdiffstats
path: root/t/03-Shared_GUI.t
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2014-05-24 18:34:36 +0200
committerAngelo Naselli <anaselli@linux.it>2014-05-24 18:34:36 +0200
commit8fe5bbdfe2fa5e24c8dbfa2dadd8d5bb800ce308 (patch)
tree6c9bcfd4565402f57fb1ea4c67f4a1cb67682a26 /t/03-Shared_GUI.t
parentcf8adc6a37a52b7d6f57ef8d54b06e18c2289d89 (diff)
downloadmanatools-8fe5bbdfe2fa5e24c8dbfa2dadd8d5bb800ce308.tar
manatools-8fe5bbdfe2fa5e24c8dbfa2dadd8d5bb800ce308.tar.gz
manatools-8fe5bbdfe2fa5e24c8dbfa2dadd8d5bb800ce308.tar.bz2
manatools-8fe5bbdfe2fa5e24c8dbfa2dadd8d5bb800ce308.tar.xz
manatools-8fe5bbdfe2fa5e24c8dbfa2dadd8d5bb800ce308.zip
Added AdminPanel::Shared::GUI (common GUI dialogs) and tests
Diffstat (limited to 't/03-Shared_GUI.t')
-rw-r--r--t/03-Shared_GUI.t63
1 files changed, 63 insertions, 0 deletions
diff --git a/t/03-Shared_GUI.t b/t/03-Shared_GUI.t
new file mode 100644
index 00000000..06f571f0
--- /dev/null
+++ b/t/03-Shared_GUI.t
@@ -0,0 +1,63 @@
+#!perl -T
+use 5.006;
+use strict;
+use warnings FATAL => 'all';
+use Test::More;
+
+BEGIN {
+ use_ok( 'AdminPanel::Shared::GUI' ) || print "AdminPanel::Shared::GUI failed!\n";
+ use_ok( 'AdminPanel::Shared' ) || print "AdminPanel::Shared failed!\n";
+}
+
+ 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...", 9, 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", reachtext => 1}), 'wmb2');
+
+ ok($gui->infoMsgBox({text => "Info message!<br> line two", title => "INFO", reachtext => 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", reachtext=>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_button => 1,
+ list => ['item 1', 'item 2', 'item 3', 'item 4']}), 'ask_fromList');
+ diag "ask_fromList got: < " . ($item ? $item : "none") . " >";
+ ok($gui->AboutDialog({ name => "Shared::GUI TABBED",
+ version => $AdminPanel::Shared::VERSION,
+ credits => "Copyright (C) 2014 Angelo Naselli",
+ license => $AdminPanel::Shared::License,
+ 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 => $AdminPanel::Shared::License,
+ authors => "Angelo Naselli <anaselli\@linux.it>\nMatteo Pasotti <matteo.pasotti\@gmail.com>",
+ dialog_mode => 1,
+ }), 'ClassicAboutDialog');
+ }
+
+
+ #TODO $gui->AboutDialog
+
+
+done_testing;