diff options
author | Christian Stenger <christian.stenger@qt.io> | 2018-11-26 10:57:23 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2018-11-27 08:13:27 +0000 |
commit | 217636886ced0b83a8fd5467242a742a91998457 (patch) | |
tree | a97d0bcb6485edcb3a9ece9425f5c64c76f04ea7 /tests | |
parent | dd5c6c73d071531b0d2f2c36bbf9537a9bc9163d (diff) |
Tests: Fix QmlJs auto tests
Change-Id: Iba5e5e786e8241db120359f95850207021d61c49
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qml/reformatter/tst_reformatter.cpp | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp index 8c60c1c498..bca2e8d7a8 100644 --- a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp +++ b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp @@ -223,8 +223,9 @@ void tst_FileFormat::testLibraryPaths() project->setSourceDirectory(testDataDir); - QStringList expectedPaths(QStringList() << SRCDIR "/otherLibrary" - << SRCDIR "/data/library"); + const QDir base(testDataDir); + const QStringList expectedPaths({base.relativeFilePath(SRCDIR "/otherLibrary"), + base.relativeFilePath(SRCDIR "/data/library")}); qDebug() << expectedPaths << project->importPaths(); QCOMPARE(project->importPaths().toSet(), expectedPaths.toSet()); delete project; diff --git a/tests/auto/qml/reformatter/tst_reformatter.cpp b/tests/auto/qml/reformatter/tst_reformatter.cpp index f3164f440e..64506195c4 100644 --- a/tests/auto/qml/reformatter/tst_reformatter.cpp +++ b/tests/auto/qml/reformatter/tst_reformatter.cpp @@ -93,10 +93,18 @@ void tst_Reformatter::test() // compare line by line int commonLines = qMin(newLines.size(), sourceLines.size()); + bool insideMultiLineComment = false; for (int i = 0; i < commonLines; ++i) { // names intentional to make 'Actual (sourceLine): ...\nExpected (newLinee): ...' line up const QString &sourceLine = sourceLines.at(i); const QString &newLinee = newLines.at(i); + if (!insideMultiLineComment && sourceLine.trimmed().startsWith("/*")) { + insideMultiLineComment = true; + sourceLines.insert(i, "\n"); + continue; + } + if (sourceLine.trimmed().endsWith("*/")) + insideMultiLineComment = false; if (sourceLine.trimmed().isEmpty() && newLinee.trimmed().isEmpty()) continue; bool fail = !QCOMPARE_NOEXIT(newLinee, sourceLine); |