diff options
Diffstat (limited to 'tests/tst_UpdateChecker.cpp')
-rw-r--r-- | tests/tst_UpdateChecker.cpp | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/tests/tst_UpdateChecker.cpp b/tests/tst_UpdateChecker.cpp index 8ed82faf..49a4a6a3 100644 --- a/tests/tst_UpdateChecker.cpp +++ b/tests/tst_UpdateChecker.cpp @@ -1,10 +1,6 @@ #include <QTest> #include <QSignalSpy> -#include "logic/settings/SettingsObject.h" -#include "logic/settings/Setting.h" - -#include "BuildConfig.h" #include "TestUtil.h" #include "logic/updater/UpdateChecker.h" @@ -24,19 +20,6 @@ QDebug operator<<(QDebug dbg, const UpdateChecker::ChannelListEntry &c) return dbg.maybeSpace(); } -class ResetSetting -{ -public: - ResetSetting(std::shared_ptr<Setting> setting) : setting(setting), oldValue(setting->get()) {} - ~ResetSetting() - { - setting->set(oldValue); - } - - std::shared_ptr<Setting> setting; - QVariant oldValue; -}; - class UpdateCheckerTest : public QObject { Q_OBJECT @@ -99,7 +82,6 @@ slots: } void tst_ChannelListParsing() { - ResetSetting resetUpdateChannel(MMC->settings()->getSetting("UpdateChannel")); QFETCH(QString, channel); QFETCH(QString, channelUrl); @@ -107,15 +89,11 @@ slots: QFETCH(bool, valid); QFETCH(QList<UpdateChecker::ChannelListEntry>, result); - MMC->settings()->set("UpdateChannel", channel); - - UpdateChecker checker; + UpdateChecker checker(channelUrl, 0); QSignalSpy channelListLoadedSpy(&checker, SIGNAL(channelListLoaded())); QVERIFY(channelListLoadedSpy.isValid()); - checker.setChannelListUrl(channelUrl); - checker.updateChanList(false); if (valid) @@ -147,18 +125,12 @@ slots: } void tst_UpdateChecking() { - ResetSetting resetUpdateChannel(MMC->settings()->getSetting("UpdateChannel")); - QFETCH(QString, channel); QFETCH(QString, channelUrl); QFETCH(int, currentBuild); QFETCH(QList<QVariant>, result); - MMC->settings()->set("UpdateChannel", channel); - BuildConfig.VERSION_BUILD = currentBuild; - - UpdateChecker checker; - checker.setChannelListUrl(channelUrl); + UpdateChecker checker(channelUrl, currentBuild); QSignalSpy updateAvailableSpy(&checker, SIGNAL(updateAvailable(QString,QString,int))); QVERIFY(updateAvailableSpy.isValid()); @@ -170,7 +142,7 @@ slots: checker.m_channels[0].url = QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/")).toString(); - checker.checkForUpdate(false); + checker.checkForUpdate(channel, false); QVERIFY(updateAvailableSpy.wait()); QList<QVariant> res = result; |