diff options
author | Michael Vogt <mvo@debian.org> | 2014-03-27 07:56:42 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-03-27 07:56:42 +0100 |
commit | fa211e2d3b0305cfdd184cdba9750259f6d9c98e (patch) | |
tree | 86e18d30c7fee2d307042a93fc5e9cda9795b1f0 /test/libapt | |
parent | c34d1202e991a6f0ab5bed82c2e1ca0d155038b1 (diff) |
Add progressbar to "Dpkg::Progress-Fancy"
A text progressbar is now displayed in the Dpkg::Progress-Fancy
mode. It can be turned off via the apt option
Dpkg::Progress-Fancy::Progress-Bar=false
Diffstat (limited to 'test/libapt')
-rw-r--r-- | test/libapt/install_progress_test.cc | 30 | ||||
-rw-r--r-- | test/libapt/makefile | 6 |
2 files changed, 36 insertions, 0 deletions
diff --git a/test/libapt/install_progress_test.cc b/test/libapt/install_progress_test.cc new file mode 100644 index 000000000..be1a3411e --- /dev/null +++ b/test/libapt/install_progress_test.cc @@ -0,0 +1,30 @@ +#include <config.h> + +#include <apt-pkg/install-progress.h> + +#include <string> + +#include "assert.h" + +int main() { + APT::Progress::PackageManagerFancy p; + std::string s; + + s= p.GetTextProgressStr(0.5, 60); + equals(s.size(), 60); + + s= p.GetTextProgressStr(0.5, 4); + equals(s, "[#.]"); + + s= p.GetTextProgressStr(0.1, 12); + equals(s, "[#.........]"); + + s= p.GetTextProgressStr(0.9, 12); + equals(s, "[#########.]"); + + // deal with incorrect inputs gracefully (or should we die instead?) + s= p.GetTextProgressStr(-999, 12); + equals(s, ""); + + return 0; +} diff --git a/test/libapt/makefile b/test/libapt/makefile index 66d6ea783..e03b5e6aa 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -123,3 +123,9 @@ SLIBS = -lapt-pkg SOURCE = sourcelist_test.cc include $(PROGRAM_H) +# test install-progress +PROGRAM = InstallProgress${BASENAME} +SLIBS = -lapt-pkg +SOURCE = install_progress_test.cc +include $(PROGRAM_H) + |