aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-02-23 10:00:30 +0100
committerAngelo Naselli <anaselli@linux.it>2015-02-23 10:00:30 +0100
commit0642af21a73f5128106b456195ab128bcb4619b6 (patch)
tree3ab4ec9bb66ec56b99edf8712f9e332384827619
parent3a2bd5de0400162feea41b8ea016cca00a2a6288 (diff)
downloadcolin-keep-0642af21a73f5128106b456195ab128bcb4619b6.tar
colin-keep-0642af21a73f5128106b456195ab128bcb4619b6.tar.gz
colin-keep-0642af21a73f5128106b456195ab128bcb4619b6.tar.bz2
colin-keep-0642af21a73f5128106b456195ab128bcb4619b6.tar.xz
colin-keep-0642af21a73f5128106b456195ab128bcb4619b6.zip
fixed confirmimg dialog size by adding min_size param to interactive_msg
added a test case for interactive_msg
-rw-r--r--MANIFEST3
-rw-r--r--lib/AdminPanel/Rpmdragora/pkg.pm2
-rw-r--r--lib/AdminPanel/rpmdragora.pm17
-rw-r--r--t/06-rpmdragora.t30
4 files changed, 44 insertions, 8 deletions
diff --git a/MANIFEST b/MANIFEST
index 47a24a8..156f60b 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-Changes
+hanges
COPYING.GPLv2
extras/bash_completion/mana
extras/conf/categories.conf
@@ -131,6 +131,7 @@ t/02-Users.t
t/03-Shared_GUI.t
t/04-Shared_TimeZone.t
t/05-rpmnew.t
+t/05-rpmdragora.t
t/boilerplate.t
t/manifest.t
t/pod-coverage.t
diff --git a/lib/AdminPanel/Rpmdragora/pkg.pm b/lib/AdminPanel/Rpmdragora/pkg.pm
index 36ee259..16f2711 100644
--- a/lib/AdminPanel/Rpmdragora/pkg.pm
+++ b/lib/AdminPanel/Rpmdragora/pkg.pm
@@ -812,7 +812,7 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-(
format_filesize($filesize),
$loc->N("Is it ok to continue?")),
scroll => 1,
- yesno => 1) or return 1;
+ yesno => 1, min_size => {lines => 18},) or return 1;
my $_umount_guard = MDK::Common::Func::before_leaving { urpm::removable::try_umounting_removables($urpm) };
diff --git a/lib/AdminPanel/rpmdragora.pm b/lib/AdminPanel/rpmdragora.pm
index 287dfc5..98e5d27 100644
--- a/lib/AdminPanel/rpmdragora.pm
+++ b/lib/AdminPanel/rpmdragora.pm
@@ -273,16 +273,17 @@ sub getbanner() {
$title: dialog title
$contents: dialog text
%options: optional HASH containing {
- scroll => Rich Text with scroll bar used
- yesno => dialog with "yes" and "no" buttons (deafult yes)
+ scroll => Rich Text with scroll bar used
+ yesno => dialog with "yes" and "no" buttons (deafult yes)
dont_ask_again => add a checkbox with "dont ask again text"
- main_dialog => create a main dialog instead of a popup one
+ main_dialog => create a main dialog instead of a popup one
+ min_size => {columns => X, lines => Y} for minimum dialog size,
}
=head3 OUTPUT
retval: if dont_ask_again HASH reference containig {
- value => 1 yes (or ok) pressed, 0 no pressed
+ value => 1 yes (or ok) pressed, 0 no pressed
dont_ask_again => 1 if checked
}
or if dont_ask_again is not passed:
@@ -292,7 +293,9 @@ sub getbanner() {
This function shows a dialog with contents text and return the button
pressed (1 ok or yes), optionally returns the checkbox value if dont_ask_again is
- passed
+ passed.
+ If min_size is passed a minimum dialog size is set (default is 75x6) see libyui
+ createMinSize documenatation for explanation.
=cut
@@ -316,7 +319,9 @@ sub interactive_msg {
my $dlg = $options{main_dialog} ?
$factory->createMainDialog() :
$factory->createPopupDialog();
- my $minSize = $factory->createMinSize( $dlg, 75, 6);
+ my $columns = $options{min_size}->{columns} || 75;
+ my $lines = $options{min_size}->{lines} || 6;
+ my $minSize = $factory->createMinSize( $dlg, $columns, $lines);
my $vbox = $factory->createVBox( $minSize );
my $midhbox = $factory->createHBox($vbox);
## app description
diff --git a/t/06-rpmdragora.t b/t/06-rpmdragora.t
new file mode 100644
index 0000000..e59533d
--- /dev/null
+++ b/t/06-rpmdragora.t
@@ -0,0 +1,30 @@
+use 5.006;
+use strict;
+use warnings FATAL => 'all';
+use Test::More;
+
+BEGIN {
+ use_ok( 'AdminPanel::rpmdragora' ) || print "AdminPanel::rpmdragora failed!\n";
+}
+
+
+SKIP: {
+ #remember to skip the righ number of tests
+ skip "To enable dialog tests set TEST_GUI", 1, unless $ENV{TEST_GUI};
+
+ ok( interactive_msg( "Interactive msg title",
+ join(
+ "\n\n",
+ "text line 1",
+ "text line 2",
+ "text line 3",
+ "set yesno => 1 to have a yesno dialog otherwhise just ok button is shown",
+ "press ok to continue"),
+ scroll => 1,
+ ),
+ 'interactive_msg',
+ );
+}
+
+
+done_testing;