diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-12-11 16:04:24 +1000 |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-12-11 16:04:24 +1000 |
commit | b62c6de3eae005da146a9009f86851a1431b1892 (patch) | |
tree | 614266e7c294fccf1e79b5f8496fff3172bd3ccb /tests/benchmarks/qscriptengine/tst_qscriptengine.cpp | |
parent | 94d45cc06dabb8b1f8fc98e9f9b3dfaf49d0c4d7 (diff) | |
download | qt4-tools-b62c6de3eae005da146a9009f86851a1431b1892.tar.gz |
Add benchmark for QtScript translation functions.
Diffstat (limited to 'tests/benchmarks/qscriptengine/tst_qscriptengine.cpp')
-rw-r--r-- | tests/benchmarks/qscriptengine/tst_qscriptengine.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp index 8d5f6e6ef6..1c787e91db 100644 --- a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp +++ b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp @@ -72,6 +72,8 @@ private slots: void toStringHandle(); void castValueToQreal(); void nativeCall(); + void translation_data(); + void translation(); }; tst_QScriptEngine::tst_QScriptEngine() @@ -259,5 +261,24 @@ 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\")"; +} + +void tst_QScriptEngine::translation() +{ + QFETCH(QString, text); + QScriptEngine engine; + engine.installTranslatorFunctions(); + + QBENCHMARK { + (void)engine.evaluate(text); + } +} + QTEST_MAIN(tst_QScriptEngine) #include "tst_qscriptengine.moc" |