summaryrefslogtreecommitdiffstats
path: root/tests/tst_UpdateChecker.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-01-31 16:59:03 +0100
committerPetr Mrázek <peterix@gmail.com>2015-04-02 11:30:24 +0200
commit6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f (patch)
tree28aaf76918d1ff0ffe2a437573bb1ab7a012c4ec /tests/tst_UpdateChecker.cpp
parente508728246043fcaf8bee565e73b15e15eb2e531 (diff)
downloadMultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.gz
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.lz
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.xz
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.zip
NOISSUE Split MultiMC app object into MultiMC and Env
Diffstat (limited to 'tests/tst_UpdateChecker.cpp')
-rw-r--r--tests/tst_UpdateChecker.cpp34
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;