summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-15 19:21:00 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-15 19:21:00 (GMT)
commit0398173542384f1600e1652bbb6449fe735b9359 (patch)
tree5d8924c18efcc82a9f1d7220c9687d30f5cc4be4 /tests
parentde1c505ddb5acedf96168df00172b9e3a694a32d (diff)
parentf62d8eb38d35d394aca01f9ec309a43525afb557 (diff)
downloadQt-0398173542384f1600e1652bbb6449fe735b9359.zip
Qt-0398173542384f1600e1652bbb6449fe735b9359.tar.gz
Qt-0398173542384f1600e1652bbb6449fe735b9359.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Add translation context to qsTr() benchmark QtScript: Add autotest for enumeration of QMetaObject properties QNAM HTTP: Pipelining changes
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp2
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp34
-rw-r--r--tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp11
3 files changed, 42 insertions, 5 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"
diff --git a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp
index 6c6f0b1..35e2f28 100644
--- a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp
@@ -269,19 +269,22 @@ void tst_QScriptEngine::nativeCall()
void tst_QScriptEngine::translation_data()
{
QTest::addColumn<QString>("text");
- QTest::newRow("no translation") << "\"hello world\"";
- QTest::newRow("qsTr") << "qsTr(\"hello world\")";
- QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")";
+ QTest::addColumn<QString>("fileName");
+ QTest::newRow("no translation") << "\"hello world\"" << "";
+ QTest::newRow("qsTr") << "qsTr(\"hello world\")" << "";
+ QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")" << "";
+ QTest::newRow("qsTr:script.js") << "qsTr(\"hello world\")" << "script.js";
}
void tst_QScriptEngine::translation()
{
QFETCH(QString, text);
+ QFETCH(QString, fileName);
QScriptEngine engine;
engine.installTranslatorFunctions();
QBENCHMARK {
- (void)engine.evaluate(text);
+ (void)engine.evaluate(text, fileName);
}
}