summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-11-02 13:06:51 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-11-08 14:44:45 (GMT)
commit596ddb0f82e54cd828c6d2b6248a1686924671f9 (patch)
tree863db896b28cde1c5778aa8fc16d4418c47e4f2e /tests/benchmarks
parent8e96ec267e388ca290b5287f3b2272e74c4bafce (diff)
downloadQt-596ddb0f82e54cd828c6d2b6248a1686924671f9.zip
Qt-596ddb0f82e54cd828c6d2b6248a1686924671f9.tar.gz
Qt-596ddb0f82e54cd828c6d2b6248a1686924671f9.tar.bz2
Add benchmark for emitting signals from QtScript
Reviewed-by: Jedrzej Nowacki
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp b/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp
index e68db06..62f3c2a 100644
--- a/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp
+++ b/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp
@@ -309,6 +309,9 @@ private slots:
void qobjectSignalHandler();
void customTypeSignalHandler();
+ void emitSignal_data();
+ void emitSignal();
+
void readButtonMetaProperty_data();
void readButtonMetaProperty();
@@ -948,6 +951,31 @@ void tst_QScriptQObject::customTypeSignalHandler()
}
}
+void tst_QScriptQObject::emitSignal_data()
+{
+ QTest::addColumn<QString>("propertyName");
+ QTest::addColumn<QString>("arguments");
+
+ QTest::newRow("voidSignal()") << "voidSignal" << "";
+
+ QTest::newRow("boolSignal(true)") << "boolSignal" << "true";
+ QTest::newRow("intSignal(123)") << "intSignal" << "123";
+ QTest::newRow("doubleSignal(123)") << "doubleSignal" << "123";
+ QTest::newRow("stringSignal('hello')") << "stringSignal" << "'hello'";
+ QTest::newRow("variantSignal(123)") << "variantSignal" << "123";
+ QTest::newRow("qobjectSignal(this)") << "qobjectSignal" << "this"; // assumes 'this' is a QObject
+}
+
+void tst_QScriptQObject::emitSignal()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(QString, arguments);
+
+ QScriptEngine engine;
+ SignalTestObject testObject;
+ callMethodHelper(engine, &testObject, propertyName, arguments);
+}
+
void tst_QScriptQObject::readButtonMetaProperty_data()
{
readMetaProperty_dataHelper(&QPushButton::staticMetaObject);