diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-01-26 19:09:59 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-01-27 15:12:32 (GMT) |
commit | 7c824cff70d528644b992595f3195f9fd2474fc2 (patch) | |
tree | a98d63d798c01ffd1305b5af9a3e7110d7fa44de /tests/auto/linguist/lupdate | |
parent | 6874f4381278d17ad62298e145f366d4e0f038bd (diff) | |
download | Qt-7c824cff70d528644b992595f3195f9fd2474fc2.zip Qt-7c824cff70d528644b992595f3195f9fd2474fc2.tar.gz Qt-7c824cff70d528644b992595f3195f9fd2474fc2.tar.bz2 |
add ability to set working dir for test
Diffstat (limited to 'tests/auto/linguist/lupdate')
-rw-r--r-- | tests/auto/linguist/lupdate/tst_lupdate.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index b68eadc..b45383f 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -245,7 +245,8 @@ void tst_lupdate::good() qDebug() << "Checking..."; - QStringList generatedtsfiles(dir + QLatin1String("/project.ts")); + QString workDir = dir; + QStringList generatedtsfiles(QLatin1String("project.ts")); QString lupdatecmd; QFile file(dir + "/lupdatecmd"); @@ -264,17 +265,21 @@ void tst_lupdate::good() generatedtsfiles.clear(); foreach (const QByteArray &s, cmdstring.split(' ')) if (!s.isEmpty()) - generatedtsfiles << dir + QLatin1Char('/') + s; + generatedtsfiles << s; + } else if (cmdstring.startsWith("cd ")) { + cmdstring.remove(0, 3); + workDir = QDir::cleanPath(dir + QLatin1Char('/') + cmdstring); } } file.close(); } foreach (const QString &ts, generatedtsfiles) { - QFile::remove(ts); - QString beforetsfile = ts + QLatin1String(".before"); + QString genTs = workDir + QLatin1Char('/') + ts; + QFile::remove(genTs); + QString beforetsfile = dir + QLatin1Char('/') + ts + QLatin1String(".before"); if (QFile::exists(beforetsfile)) - QVERIFY2(QFile::copy(beforetsfile, ts), qPrintable(beforetsfile)); + QVERIFY2(QFile::copy(beforetsfile, genTs), qPrintable(beforetsfile)); } if (lupdatecmd.isEmpty()) @@ -282,7 +287,7 @@ void tst_lupdate::good() lupdatecmd.prepend("-silent "); QProcess proc; - proc.setWorkingDirectory(dir); + proc.setWorkingDirectory(workDir); proc.setProcessChannelMode(QProcess::MergedChannels); proc.start(m_cmdLupdate + ' ' + lupdatecmd, QIODevice::ReadWrite | QIODevice::Text); QVERIFY2(proc.waitForFinished(5000), qPrintable(lupdatecmd)); @@ -304,7 +309,8 @@ void tst_lupdate::good() } foreach (const QString &ts, generatedtsfiles) - doCompare(ts, ts + QLatin1String(".result"), false); + doCompare(workDir + QLatin1Char('/') + ts, + dir + QLatin1Char('/') + ts + QLatin1String(".result"), false); } void tst_lupdate::commandline_data() |