summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-12-11 06:04:24 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-12-11 06:04:24 (GMT)
commitb62c6de3eae005da146a9009f86851a1431b1892 (patch)
tree614266e7c294fccf1e79b5f8496fff3172bd3ccb /tests/benchmarks
parent94d45cc06dabb8b1f8fc98e9f9b3dfaf49d0c4d7 (diff)
downloadQt-b62c6de3eae005da146a9009f86851a1431b1892.zip
Qt-b62c6de3eae005da146a9009f86851a1431b1892.tar.gz
Qt-b62c6de3eae005da146a9009f86851a1431b1892.tar.bz2
Add benchmark for QtScript translation functions.
Diffstat (limited to 'tests/benchmarks')
-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 8d5f6e6..1c787e9 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"