[yast-commit] r60283 - in /trunk/packager: package/ src/modules/ testsuite/tests/
Author: lslezak Date: Fri Jan 8 09:09:30 2010 New Revision: 60283 URL: http://svn.opensuse.org/viewcvs/yast?rev=60283&view=rev Log: - don't display exact total remaining time when there is an overflow (i.e. for >2:00:00 and e.g. 15:20 remaining time display
2:00:00 total instead of 2:15:20) (bnc#567966)
Added: trunk/packager/testsuite/tests/PackageSlideShow.err trunk/packager/testsuite/tests/PackageSlideShow.out trunk/packager/testsuite/tests/PackageSlideShow.ycp Modified: trunk/packager/package/yast2-packager.changes trunk/packager/src/modules/PackageSlideShow.ycp Modified: trunk/packager/package/yast2-packager.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.changes?rev=60283&r1=60282&r2=60283&view=diff ============================================================================== --- trunk/packager/package/yast2-packager.changes (original) +++ trunk/packager/package/yast2-packager.changes Fri Jan 8 09:09:30 2010 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Jan 8 08:05:12 UTC 2010 - lslezak@suse.cz + +- don't display exact total remaining time when there is an + overflow (i.e. for >2:00:00 and e.g. 15:20 remaining time display + >2:00:00 total instead of 2:15:20) (bnc#567966) + +------------------------------------------------------------------- Thu Jan 7 12:16:03 UTC 2010 - lslezak@suse.cz - pass the selected CD/DVD device to the package manager in case Modified: trunk/packager/src/modules/PackageSlideShow.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/PackageSlideShow.ycp?rev=60283&r1=60282&r2=60283&view=diff ============================================================================== --- trunk/packager/src/modules/PackageSlideShow.ycp (original) +++ trunk/packager/src/modules/PackageSlideShow.ycp Fri Jan 8 09:09:30 2010 @@ -170,15 +170,15 @@ return sum; } - /** * Sum up all positive list items, but cut off individual items at a maximum value. * Negative return values indicate overflow of any individual item at "max_cutoff". - * In this case, the real sum is the absolute value of the return value. + * In this case, the absolute value of the return value is "max_cutoff" * number of overflows. + * (e.g. >2hour + >2hours + 1:13:20 => >4hours **/ integer ListSumCutOff( list<integer> sizes, integer max_cutoff ) { - boolean overflow = false; + integer overflow = 0; integer sum = 0; foreach( integer item, sizes, ``{ @@ -186,16 +186,19 @@ { if ( item > max_cutoff ) { - overflow = true; - sum = sum + max_cutoff; + overflow = overflow + 1; } else + { sum = sum + item; + } } }); - if ( overflow ) - sum = -sum; + if (overflow > 0) + { + sum = -overflow * max_cutoff; + } return sum; } Added: trunk/packager/testsuite/tests/PackageSlideShow.err URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/testsuite/tests/PackageSlideShow.err?rev=60283&view=auto ============================================================================== (empty) Added: trunk/packager/testsuite/tests/PackageSlideShow.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/testsuite/tests/PackageSlideShow.out?rev=60283&view=auto ============================================================================== --- trunk/packager/testsuite/tests/PackageSlideShow.out (added) +++ trunk/packager/testsuite/tests/PackageSlideShow.out Fri Jan 8 09:09:30 2010 @@ -0,0 +1,4 @@ +Read .target.tmpdir "/tmp" +Return 210 +Return -100 +Return -300 Added: trunk/packager/testsuite/tests/PackageSlideShow.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/testsuite/tests/PackageSlideShow.ycp?rev=60283&view=auto ============================================================================== --- trunk/packager/testsuite/tests/PackageSlideShow.ycp (added) +++ trunk/packager/testsuite/tests/PackageSlideShow.ycp Fri Jan 8 09:09:30 2010 @@ -0,0 +1,27 @@ +/** + * Testsuite for PackageSlideShow.ycp module + * + * $Id:$ + */ + +{ + +include "testsuite.ycp"; +map READ = $[ + "target" : $[ + "tmpdir" : "/tmp" + ] +]; +TESTSUITE_INIT ([READ], nil); + +import "PackageSlideShow"; + +// no cut off +TEST(``(PackageSlideShow::ListSumCutOff([60, 70, 80, 0], 100)), [], nil); + +// one cut off +TEST(``(PackageSlideShow::ListSumCutOff([60, 70, 80, 150], 100)), [], nil); + +// more cut offs +TEST(``(PackageSlideShow::ListSumCutOff([160, 170, 180, 10], 100)), [], nil); +} -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org