diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-04 05:56:06 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-06-04 05:56:06 +0000 |
commit | ccad00121d0a9d703cf715c54347b32bfc33bbfc (patch) | |
tree | 8e492f00f9ea81d87ae9126ad06c3dbc21fee3a3 /src/testlib/qtestcase.cpp | |
parent | dc2617f35be61b4827b8e3d192c85e2feacf7f6a (diff) | |
parent | e2f66f921594b7be4af4a058c959557489e86879 (diff) |
Merge "Merge remote-tracking branch 'origin/5.5' into dev" into refs/staging/dev
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r-- | src/testlib/qtestcase.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index e1e6805a0f..858475f396 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1374,6 +1374,7 @@ static bool installCoverageTool(const char * appname, const char * testname) namespace QTest { static QObject *currentTestObject = 0; + static QString mainSourcePath; class TestFunction { public: @@ -2167,7 +2168,7 @@ static bool qInvokeTestMethod(const char *slotName, const char *data, WatchDog * if (!data || !qstrcmp(data, table.testData(curDataIndex)->dataTag())) { foundFunction = true; - QTestPrivate::checkBlackList(slot, dataCount ? table.testData(curDataIndex)->dataTag() : 0); + QTestPrivate::checkBlackLists(slot, dataCount ? table.testData(curDataIndex)->dataTag() : 0); QTestDataSetter s(curDataIndex >= dataCount ? static_cast<QTestData *>(0) : table.testData(curDataIndex)); @@ -2682,6 +2683,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) #endif QTestPrivate::parseBlackList(); + QTestPrivate::parseGpuBlackList(); QTestResult::reset(); @@ -3032,6 +3034,13 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co found = candidate; } + // 6. Try main source directory + if (found.isEmpty()) { + QString candidate = QTest::mainSourcePath % QLatin1Char('/') % base; + if (QFileInfo(candidate).exists()) + found = candidate; + } + if (found.isEmpty()) { QTest::qWarn(qPrintable( QString::fromLatin1("testdata %1 could not be located!").arg(base)), @@ -3219,6 +3228,19 @@ QObject *QTest::testObject() } /*! \internal + */ +void QTest::setMainSourcePath(const char *file, const char *builddir) +{ + QString mainSourceFile = QFile::decodeName(file); + QFileInfo fi; + if (builddir) + fi.setFile(QDir(QFile::decodeName(builddir)), mainSourceFile); + else + fi.setFile(mainSourceFile); + QTest::mainSourcePath = fi.absolutePath(); +} + +/*! \internal This function is called by various specializations of QTest::qCompare to decide whether to report a failure and to produce verbose test output. |