summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2014-08-13 04:21:36 -0700
committerSzabolcs David <davidsz@inf.u-szeged.hu>2014-08-13 14:41:07 +0200
commitbb2e9ce5803cd19a97175eedcb3c925b2c2325c9 (patch)
tree7276a68961c34d3dbfd604789ed75a1259f45baa /tests
parent955a8d8a05d494f74238565d1a60fa6bd29c4f2b (diff)
Add QJSValue support to the public API test
QJSValue is not a built-in QMetaType (it's ID is over 1024 [QMetaType::User]) and we can't get the QML type names from the QML engine, so I hardcoded it in this test. The check of the "void" is unnecessary, because that is built-in: QMetaType::Void Change-Id: I0d7668abedc8830b4bba39ff60bce644fe97888b Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 2f8644d48..f7cffb8b1 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -63,6 +63,10 @@ static QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *>()
static QList<const char *> knownEnumNames = QList<const char *>();
+static QStringList hardcodedTypes = QStringList()
+ << "QJSValue"
+ ;
+
static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.AcceptRequest --> NavigationRequestAction"
<< "QQuickWebEngineView.IgnoreRequest --> NavigationRequestAction"
@@ -160,7 +164,7 @@ static bool isCheckedClass(const QByteArray &typeName)
static void checkKnownType(const QByteArray &typeName)
{
- if ((typeName != "void" && !QMetaType::type(typeName)) || QMetaType::type(typeName) >= QMetaType::User) {
+ if ((!hardcodedTypes.contains(typeName) && !QMetaType::type(typeName)) || QMetaType::type(typeName) >= QMetaType::User) {
bool knownEnum = isCheckedEnum(typeName);
bool knownClass = isCheckedClass(typeName);
QVERIFY2(knownEnum || knownClass, qPrintable(QString("The API uses an unknown type [%1], you might have to add it to the typesToCheck list.").arg(typeName.constData())));