From 596ddb0f82e54cd828c6d2b6248a1686924671f9 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 2 Nov 2010 14:06:51 +0100 Subject: Add benchmark for emitting signals from QtScript Reviewed-by: Jedrzej Nowacki --- .../script/qscriptqobject/tst_qscriptqobject.cpp | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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("propertyName"); + QTest::addColumn("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); -- cgit v0.12