From dcfac3432f981191da68f14f21f5010fc4da51c0 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 18 Nov 2020 11:38:59 -0500 Subject: Fixed issue with status reporting --- testLibbible.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'testLibbible.cc') diff --git a/testLibbible.cc b/testLibbible.cc index 3850aa0..8a7f468 100644 --- a/testLibbible.cc +++ b/testLibbible.cc @@ -47,6 +47,19 @@ class TestLibbible : public CppUnit::TestFixture //----------------------------------------------------------------------------- +class StatusTester : public libbible::Status +{ + public: + virtual void update(unsigned long totalBytes, unsigned long completedBytes, string message); + bool hasBeenUpdated = false; +}; + +void StatusTester::update(unsigned long totalBytes, unsigned long completedBytes, string message) { + hasBeenUpdated = true; +} + +//----------------------------------------------------------------------------- + void TestLibbible::testGetModules(void) { map> mods = libbible::getModules(); for(auto pair : mods) { @@ -175,7 +188,11 @@ void TestLibbible::testSettings(void) { } void TestLibbible::testDownload(void) { + StatusTester status; + libbible::setStatusReporter(status); map> modsAvailable = libbible::downloadModsAvailable(); + //CPPUNIT_ASSERT(status.hasBeenUpdated); + status.hasBeenUpdated = false; // We try installing the first available one string language; string name; @@ -192,6 +209,7 @@ void TestLibbible::testDownload(void) { libbible::installModFromInternet(language, name); mods = libbible::getModules(); CPPUNIT_ASSERT(mods.find(name) != mods.end()); + CPPUNIT_ASSERT(status.hasBeenUpdated); } //----------------------------------------------------------------------------- -- cgit v1.2.3