Remove the $PWD hack and tests that depended on it.

This commit is contained in:
Petr Mrázek 2014-01-05 19:54:05 +01:00
parent 9417544ca6
commit becaebd60d
3 changed files with 10 additions and 24 deletions

View File

@ -60,13 +60,14 @@ void DownloadUpdateTask::processChannels()
QList<UpdateChecker::ChannelListEntry> channels = checker->getChannelList(); QList<UpdateChecker::ChannelListEntry> channels = checker->getChannelList();
QString channelId = MMC->version().channel; QString channelId = MMC->version().channel;
m_cRepoUrl.clear();
// Search through the channel list for a channel with the correct ID. // Search through the channel list for a channel with the correct ID.
for (auto channel : channels) for (auto channel : channels)
{ {
if (channel.id == channelId) if (channel.id == channelId)
{ {
QLOG_INFO() << "Found matching channel."; QLOG_INFO() << "Found matching channel.";
m_cRepoUrl = fixPathForTests(channel.url); m_cRepoUrl = channel.url;
break; break;
} }
} }
@ -229,12 +230,12 @@ bool DownloadUpdateTask::parseVersionInfo(const QByteArray &data, VersionFileLis
if (type == "http") if (type == "http")
{ {
file.sources.append( file.sources.append(
FileSource("http", fixPathForTests(sourceObj.value("Url").toString()))); FileSource("http", sourceObj.value("Url").toString()));
} }
else if (type == "httpc") else if (type == "httpc")
{ {
file.sources.append( file.sources.append(
FileSource("httpc", fixPathForTests(sourceObj.value("Url").toString()), FileSource("httpc", sourceObj.value("Url").toString(),
sourceObj.value("CompressionType").toString())); sourceObj.value("CompressionType").toString()));
} }
else else
@ -504,17 +505,6 @@ bool DownloadUpdateTask::writeInstallScript(UpdateOperationList &opsList, QStrin
return true; return true;
} }
QString DownloadUpdateTask::fixPathForTests(const QString &path)
{
if (path.startsWith("$PWD"))
{
QString foo = path;
foo.replace("$PWD", qApp->applicationDirPath());
return QUrl::fromLocalFile(foo).toString(QUrl::FullyEncoded);
}
return path;
}
bool DownloadUpdateTask::fixPathForOSX(QString &path) bool DownloadUpdateTask::fixPathForOSX(QString &path)
{ {
if (path.startsWith("MultiMC.app/")) if (path.startsWith("MultiMC.app/"))

View File

@ -194,12 +194,6 @@ protected:
*/ */
QTemporaryDir m_updateFilesDir; QTemporaryDir m_updateFilesDir;
/*!
* Filters paths
* Path of the format $PWD/path, it is converted to a file:///$PWD/ URL
*/
static QString fixPathForTests(const QString &path);
/*! /*!
* Filters paths * Filters paths
* This fixes destination paths for OSX. * This fixes destination paths for OSX.

View File

@ -105,7 +105,9 @@ slots:
QCOMPARE(TestsInternal::readFileUtf8(script).replace(QRegExp("[\r\n]+"), "\n"), QCOMPARE(TestsInternal::readFileUtf8(script).replace(QRegExp("[\r\n]+"), "\n"),
MULTIMC_GET_TEST_FILE_UTF8(testFile).replace(QRegExp("[\r\n]+"), "\n")); MULTIMC_GET_TEST_FILE_UTF8(testFile).replace(QRegExp("[\r\n]+"), "\n"));
} }
// DISABLED: fails.
/*
void test_parseVersionInfo_data() void test_parseVersionInfo_data()
{ {
QTest::addColumn<QByteArray>("data"); QTest::addColumn<QByteArray>("data");
@ -156,7 +158,7 @@ slots:
QCOMPARE(outList, list); QCOMPARE(outList, list);
QCOMPARE(outError, error); QCOMPARE(outError, error);
} }
*/
void test_processFileLists_data() void test_processFileLists_data()
{ {
QTest::addColumn<DownloadUpdateTask *>("downloader"); QTest::addColumn<DownloadUpdateTask *>("downloader");
@ -223,7 +225,7 @@ slots:
qDebug() << expectedOperations; qDebug() << expectedOperations;
QCOMPARE(operations, expectedOperations); QCOMPARE(operations, expectedOperations);
} }
/*
void test_masterTest() void test_masterTest()
{ {
QLOG_INFO() << "#####################"; QLOG_INFO() << "#####################";
@ -245,7 +247,7 @@ slots:
QVERIFY(succeededSpy.wait()); QVERIFY(succeededSpy.wait());
} }
*/
void test_OSXPathFixup() void test_OSXPathFixup()
{ {
QString path, pathOrig; QString path, pathOrig;