summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptextqobject
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-04-16 10:20:46 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2010-04-16 10:20:46 (GMT)
commitd626cfeae84a52f3f752be6dd5ed7df11e4b3be1 (patch)
treefe9732af8c2c49c20bc450cdb53087e185ff8633 /tests/auto/qscriptextqobject
parent140a96d0b860b045c18d53c1ac96e77b3893d31c (diff)
parentfb44c5b866da71fcbe992f6d02fb18ab2470ac53 (diff)
downloadQt-d626cfeae84a52f3f752be6dd5ed7df11e4b3be1.zip
Qt-d626cfeae84a52f3f752be6dd5ed7df11e4b3be1.tar.gz
Qt-d626cfeae84a52f3f752be6dd5ed7df11e4b3be1.tar.bz2
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
Conflicts: src/3rdparty/webkit/VERSION src/3rdparty/webkit/WebCore/ChangeLog src/3rdparty/webkit/WebCore/page/FrameView.cpp src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def src/s60installs/bwins/QtCoreu.def src/s60installs/bwins/QtGuiu.def src/s60installs/bwins/QtNetworku.def src/s60installs/eabi/QtGuiu.def tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
Diffstat (limited to 'tests/auto/qscriptextqobject')
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index c1496f7..09070e6 100644
--- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -534,6 +534,7 @@ private slots:
void connectToDestroyedSignal();
void emitAfterReceiverDeleted();
void inheritedSlots();
+ void enumerateMetaObject();
private:
QScriptEngine *m_engine;
@@ -3130,5 +3131,38 @@ void tst_QScriptExtQObject::inheritedSlots()
QCOMPARE(prototypeButtonClickedSpy.count(), 0);
}
+void tst_QScriptExtQObject::enumerateMetaObject()
+{
+ QScriptValue myClass = m_engine->newQMetaObject(m_myObject->metaObject(), m_engine->undefinedValue());
+
+ QStringList expectedNames;
+ expectedNames << "FooPolicy" << "BarPolicy" << "BazPolicy"
+ << "FooStrategy" << "BarStrategy" << "BazStrategy"
+ << "NoAbility" << "FooAbility" << "BarAbility" << "BazAbility" << "AllAbility";
+
+ for (int x = 0; x < 2; ++x) {
+ QSet<QString> actualNames;
+ if (x == 0) {
+ // From C++
+ QScriptValueIterator it(myClass);
+ while (it.hasNext()) {
+ it.next();
+ actualNames.insert(it.name());
+ }
+ } else {
+ // From JS
+ m_engine->globalObject().setProperty("MyClass", myClass);
+ QScriptValue ret = m_engine->evaluate("a=[]; for (var p in MyClass) if (MyClass.hasOwnProperty(p)) a.push(p); a");
+ QVERIFY(ret.isArray());
+ QStringList strings = qscriptvalue_cast<QStringList>(ret);
+ for (int i = 0; i < strings.size(); ++i)
+ actualNames.insert(strings.at(i));
+ }
+ QCOMPARE(actualNames.size(), expectedNames.size());
+ for (int i = 0; i < expectedNames.size(); ++i)
+ QVERIFY(actualNames.contains(expectedNames.at(i)));
+ }
+}
+
QTEST_MAIN(tst_QScriptExtQObject)
#include "tst_qscriptextqobject.moc"