diff options
-rw-r--r-- | tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp index 3bfc21c..d7bb04b 100644 --- a/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp @@ -69,6 +69,8 @@ private slots: void property(); void setProperty(); void propertyFlags(); + void readMetaProperty(); + void writeMetaProperty(); }; tst_QScriptValue::tst_QScriptValue() @@ -201,5 +203,28 @@ void tst_QScriptValue::propertyFlags() } } +void tst_QScriptValue::readMetaProperty() +{ + QScriptEngine engine; + QScriptValue object = engine.newQObject(QCoreApplication::instance()); + QScriptString propertyName = engine.toStringHandle("objectName"); + QBENCHMARK { + for (int i = 0; i < 10000; ++i) + object.property(propertyName); + } +} + +void tst_QScriptValue::writeMetaProperty() +{ + QScriptEngine engine; + QScriptValue object = engine.newQObject(QCoreApplication::instance()); + QScriptString propertyName = engine.toStringHandle("objectName"); + QScriptValue value(&engine, "foo"); + QBENCHMARK { + for (int i = 0; i < 10000; ++i) + object.setProperty(propertyName, value); + } +} + QTEST_MAIN(tst_QScriptValue) #include "tst_qscriptvalue.moc" |