diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp | 34 |
2 files changed, 35 insertions, 1 deletions
diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 35ebbd9..0b55390 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -801,7 +801,7 @@ void tst_QHttpNetworkConnection::getMultiple_data() QTest::newRow("6 connections, no pipelining, 100 requests") << quint16(6) << false << 100; QTest::newRow("1 connection, no pipelining, 100 requests") << quint16(1) << false << 100; - QTest::newRow("6 connections, pipelining allowed, 100 requests") << quint16(2) << true << 100; + QTest::newRow("6 connections, pipelining allowed, 100 requests") << quint16(6) << true << 100; QTest::newRow("1 connection, pipelining allowed, 100 requests") << quint16(1) << true << 100; } diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp index b4ce561..fddab3f 100644 --- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp +++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp @@ -533,6 +533,7 @@ private slots: void objectDeleted(); void connectToDestroyedSignal(); void emitAfterReceiverDeleted(); + void enumerateMetaObject(); private: QScriptEngine *m_engine; @@ -3043,5 +3044,38 @@ void tst_QScriptExtQObject::emitAfterReceiverDeleted() } } +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" |