diff options
author | Rainer Keller <rainer.keller@theqtcompany.com> | 2015-02-27 15:53:58 +0100 |
---|---|---|
committer | Rainer Keller <rainer.keller@theqtcompany.com> | 2015-03-18 13:50:26 +0000 |
commit | 7aad6b9fd426e05fdfb3892d60432a45e4079887 (patch) | |
tree | 0e186ced86604f7b8ddb3c051145aa7f94b2c4df /src/testlib | |
parent | 88e448a90b9aa7dbbfb0737c1c6330cc3433c67e (diff) |
Testlib: Add platform name to blacklist keywords
Change-Id: I62aacea3926235b3fc5c08501af44abc57065fb0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qtestblacklist.cpp | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index 1cf2ee09e3..bf795fcd68 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -36,6 +36,9 @@ #include <QtTest/qtestcase.h> #include <QtCore/qbytearray.h> #include <QtCore/qfile.h> +#include <QtCore/qset.h> +#include <QtCore/qcoreapplication.h> +#include <QtCore/qvariant.h> #include <set> @@ -59,67 +62,71 @@ QT_BEGIN_NAMESPACE The known keys are listed below: */ -// this table can be extended with new keywords as required -const char *matchedConditions[] = +static QSet<QByteArray> keywords() { - "*", + // this list can be extended with new keywords as required + QSet<QByteArray> set = QSet<QByteArray>() + << "*" #ifdef Q_OS_LINUX - "linux", + << "linux" #endif #ifdef Q_OS_OSX - "osx", + << "osx" #endif #ifdef Q_OS_WIN - "windows", + << "windows" #endif #ifdef Q_OS_IOS - "ios", + << "ios" #endif #ifdef Q_OS_ANDROID - "android", + << "android" #endif #ifdef Q_OS_QNX - "qnx", + << "qnx" #endif #ifdef Q_OS_WINRT - "winrt", + << "winrt" #endif #ifdef Q_OS_WINCE - "wince", + << "wince" #endif #if QT_POINTER_SIZE == 8 - "64bit", + << "64bit" #else - "32bit", + << "32bit" #endif #ifdef Q_CC_GNU - "gcc", + << "gcc" #endif #ifdef Q_CC_CLANG - "clang", + << "clang" #endif #ifdef Q_CC_MSVC - "msvc", + << "msvc" #endif #ifdef Q_AUTOTEST_EXPORT - "developer-build", + << "developer-build" #endif - 0 -}; + ; + QCoreApplication *app = QCoreApplication::instance(); + if (app) { + const QVariant platformName = app->property("platformName"); + if (platformName.isValid()) + set << platformName.toByteArray(); + } + + return set; +} static bool checkCondition(const QByteArray &condition) { + static QSet<QByteArray> matchedConditions = keywords(); QList<QByteArray> conds = condition.split(' '); - std::set<QByteArray> matches; - const char **m = matchedConditions; - while (*m) { - matches.insert(*m); - ++m; - } for (int i = 0; i < conds.size(); ++i) { QByteArray c = conds.at(i); @@ -127,7 +134,7 @@ static bool checkCondition(const QByteArray &condition) if (result) c = c.mid(1); - result ^= (matches.find(c) != matches.end()); + result ^= matchedConditions.contains(c); if (!result) return false; } |