summaryrefslogtreecommitdiff
path: root/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-12-11 16:04:24 +1000
committerMichael Brasser <michael.brasser@nokia.com>2009-12-11 16:04:24 +1000
commitb62c6de3eae005da146a9009f86851a1431b1892 (patch)
tree614266e7c294fccf1e79b5f8496fff3172bd3ccb /tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
parent94d45cc06dabb8b1f8fc98e9f9b3dfaf49d0c4d7 (diff)
downloadqt4-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.cpp21
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"