summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tst_DownloadUpdateTask.cpp6
-rw-r--r--tests/tst_UpdateChecker.cpp34
2 files changed, 6 insertions, 34 deletions
diff --git a/tests/tst_DownloadUpdateTask.cpp b/tests/tst_DownloadUpdateTask.cpp
index e6784402..8d8905b5 100644
--- a/tests/tst_DownloadUpdateTask.cpp
+++ b/tests/tst_DownloadUpdateTask.cpp
@@ -91,7 +91,7 @@ slots:
void test_writeInstallScript()
{
- DownloadUpdateTask task(
+ DownloadUpdateTask task(QCoreApplication::applicationDirPath(),
QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/")).toString(), 0);
DownloadUpdateTask::UpdateOperationList ops;
@@ -105,7 +105,7 @@ slots:
QCOMPARE(TestsInternal::readFileUtf8(script).replace(QRegExp("[\r\n]+"), "\n"),
MULTIMC_GET_TEST_FILE_UTF8(testFile).replace(QRegExp("[\r\n]+"), "\n"));
}
-
+
// DISABLED: fails.
/*
void test_parseVersionInfo_data()
@@ -166,7 +166,7 @@ slots:
QTest::addColumn<DownloadUpdateTask::VersionFileList>("newVersion");
QTest::addColumn<DownloadUpdateTask::UpdateOperationList>("expectedOperations");
- DownloadUpdateTask *downloader = new DownloadUpdateTask(QString(), -1);
+ DownloadUpdateTask *downloader = new DownloadUpdateTask(QCoreApplication::applicationDirPath(), QString(), -1);
// update fileOne, keep fileTwo, remove fileThree
QTest::newRow("test 1")
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;