summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp24
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.