summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevon Sargsyan <levon.sargsyan@qt.io>2019-12-05 12:37:27 +0100
committerLevon Sargsyan <levon.sargsyan@qt.io>2019-12-11 17:09:32 +0100
commit37a8e5abc6f6a15fd3835bdc0c0bee5efb2334aa (patch)
treec3e6755fe0c3c55aaec0b0aa3ec30be3428f1b5b
parentc09c14b1da8cf7ad6f844230ca552719776e981d (diff)
downloadqttools-37a8e5abc6f6a15fd3835bdc0c0bee5efb2334aa.tar.gz
Make testAndCompare() take an output directory as parameter
This patch introduces an extra parameter to testAndCompare(), that allows comparing expected vs actual in the provided output directory. This is necessary for further refactoring of the test, so each test point will use its own directory for its expected output. This will help to avoid name collisions. Change-Id: I6c539ac7e2ec9dae06d8f03ef30f1c218de50ac9 Reviewed-by: Levon Sargsyan <levon.sargsyan@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r--tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
index 191671361..871df4157 100644
--- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
+++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
@@ -50,7 +50,8 @@ private:
void compareLineByLine(const QStringList &expectedFiles);
void testAndCompare(const char *input,
const char *outNames,
- const char *extraParams = nullptr);
+ const char *extraParams = nullptr,
+ const char *outputPathPrefix = nullptr);
};
void tst_generatedOutput::initTestCase()
@@ -124,17 +125,28 @@ void tst_generatedOutput::compareLineByLine(const QStringList &expectedFiles)
void tst_generatedOutput::testAndCompare(const char *input,
const char *outNames,
- const char *extraParams)
+ const char *extraParams,
+ const char *outputPathPrefix)
{
- QStringList args{ "-outputdir", m_outputDir->path(), QFINDTESTDATA(input) };
+ QStringList args{ "-outputdir", m_outputDir->path() + "/" + outputPathPrefix,
+ QFINDTESTDATA(input) };
if (extraParams)
args << QString(QLatin1String(extraParams)).split(QChar(' '));
+
runQDocProcess(args);
+
if (QTest::currentTestFailed())
return;
- compareLineByLine(QString(QLatin1String(outNames)).split(QChar(' ')));
+
+ QStringList expectedOuts(QString(QLatin1String(outNames)).split(QChar(' ')));
+ if (outputPathPrefix)
+ for (auto &expectedOut : expectedOuts)
+ expectedOut = QString(outputPathPrefix) + "/" + expectedOut;
+
+ compareLineByLine(expectedOuts);
}
+
void tst_generatedOutput::htmlFromQDocFile()
{
testAndCompare("test.qdocconf",