summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2014-05-08 07:50:25 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-09 13:34:41 +0200
commit3a96f1a674778ecd79745db7fc5dbff3236a0853 (patch)
tree0d77e24b01f97f98bee7084f9b1aada1b64940f2
parentac5cdf7600948a3e403ca3262d7597dc198a0755 (diff)
Add enum type parameter support to public API test
This test fails since we use enum type (JavaScriptConsoleMessageLevel) as function parameter type. In these cases the given typeName does not contains the class name in isCheckedEnum(). Change-Id: Iab1b257883ff415a2b9c63af106ed3d92050896d Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 5cafc2bc..bd5abd7a 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -62,6 +62,8 @@ static QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *>()
// << &QQuickWebEngineNavigationRequest::staticMetaObject
;
+static QList<const char *> knownEnumNames = QList<const char *>();
+
static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.AcceptRequest --> NavigationRequestAction"
<< "QQuickWebEngineView.IgnoreRequest --> NavigationRequestAction"
@@ -82,6 +84,12 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.ReloadNavigation --> NavigationType"
<< "QQuickWebEngineView.FormResubmittedNavigation --> NavigationType"
<< "QQuickWebEngineView.OtherNavigation --> NavigationType"
+ << "QQuickWebEngineView.NewViewInWindow --> NewViewDestination"
+ << "QQuickWebEngineView.NewViewInTab --> NewViewDestination"
+ << "QQuickWebEngineView.NewViewInDialog --> NewViewDestination"
+ << "QQuickWebEngineView.Info --> JavaScriptConsoleMessageLevel"
+ << "QQuickWebEngineView.Warning --> JavaScriptConsoleMessageLevel"
+ << "QQuickWebEngineView.Error --> JavaScriptConsoleMessageLevel"
<< "QQuickWebEngineView.title --> QString"
<< "QQuickWebEngineView.url --> QUrl"
<< "QQuickWebEngineView.icon --> QUrl"
@@ -94,7 +102,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.navigationHistoryChanged() --> void"
<< "QQuickWebEngineView.loadingChanged(QQuickWebEngineLoadRequest*) --> void"
<< "QQuickWebEngineView.loadProgressChanged() --> void"
- << "QQuickWebEngineView.javaScriptConsoleMessage(int,QString,int,QString) --> void"
+ << "QQuickWebEngineView.javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString) --> void"
<< "QQuickWebEngineView.urlChanged() --> void"
<< "QQuickWebEngineView.iconChanged() --> void"
<< "QQuickWebEngineView.linkHovered(QUrl) --> void"
@@ -131,6 +139,12 @@ static bool isCheckedEnum(const QByteArray &typeName)
if (mo->enumerator(i).name() == enumName)
return true;
}
+ } else if (tokens.size() == 1) {
+ QByteArray &enumName = tokens[0];
+ foreach (const char *knownEnumName, knownEnumNames) {
+ if (enumName == knownEnumName)
+ return true;
+ }
}
return false;
}
@@ -181,8 +195,10 @@ static void gatherAPI(const QString &prefix, const QMetaMethod &method, QStringL
static void gatherAPI(const QString &prefix, const QMetaObject *meta, QStringList *output)
{
// *Offset points us only at the leaf class members, we don't have inheritance in our API yet anyway.
- for (int i = meta->enumeratorOffset(); i < meta->enumeratorCount(); ++i)
+ for (int i = meta->enumeratorOffset(); i < meta->enumeratorCount(); ++i) {
+ knownEnumNames << meta->enumerator(i).name();
gatherAPI(prefix, meta->enumerator(i), output);
+ }
for (int i = meta->propertyOffset(); i < meta->propertyCount(); ++i)
gatherAPI(prefix, meta->property(i), output);
for (int i = meta->methodOffset(); i < meta->methodCount(); ++i)