summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptengine
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-02-10 10:57:05 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-02-10 11:23:31 (GMT)
commit72e0778c9b5bdae58596090b114d5d0e7092f911 (patch)
tree53c31d9b61700c2c6db672767e24953192c5373c /tests/auto/qscriptengine
parentabb425e3db6c20c5271788cb1ec4e1fe37b9ea5b (diff)
parent50bb35a5ca48816f7563d1055071b4caa7791056 (diff)
downloadQt-72e0778c9b5bdae58596090b114d5d0e7092f911.zip
Qt-72e0778c9b5bdae58596090b114d5d0e7092f911.tar.gz
Qt-72e0778c9b5bdae58596090b114d5d0e7092f911.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts: doc/src/development/qmake-manual.qdoc mkspecs/symbian-gcce/qmake.conf qmake/project.cpp src/corelib/global/qnamespace.qdoc src/declarative/graphicsitems/qdeclarativetext.cpp src/gui/text/qtextdocumentlayout.cpp src/gui/text/qtextdocumentlayout_p.h tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp tests/auto/networkselftest/networkselftest.pro tests/auto/qscriptengine/tst_qscriptengine.cpp tools/designer/src/components/signalsloteditor/signalslot_utils.cpp tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt-html-templates.qdocconf tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf tools/qdoc3/test/qt.qdocconf tools/qdoc3/test/qt_ja_JP.qdocconf tools/qdoc3/test/qt_zh_CN.qdocconf
Diffstat (limited to 'tests/auto/qscriptengine')
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index b609d8c..589b3b1 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -225,6 +225,7 @@ private slots:
void translateScriptUnicode();
void translateScriptUnicodeIdBased_data();
void translateScriptUnicodeIdBased();
+ void translateFromBuiltinCallback();
void functionScopes();
void nativeFunctionScopes();
void evaluateProgram();
@@ -5309,6 +5310,21 @@ void tst_QScriptEngine::translateScriptUnicodeIdBased()
QVERIFY(!engine.hasUncaughtException());
}
+void tst_QScriptEngine::translateFromBuiltinCallback()
+{
+ QScriptEngine eng;
+ eng.installTranslatorFunctions();
+
+ // Callback has no translation context.
+ eng.evaluate("function foo() { qsTr('foo'); }");
+
+ // Stack at translation time will be:
+ // qsTr, foo, forEach, global
+ // qsTr() needs to walk to the outer-most (global) frame before it finds
+ // a translation context, and this should not crash.
+ eng.evaluate("[10,20].forEach(foo)", "script.js");
+}
+
void tst_QScriptEngine::functionScopes()
{
QScriptEngine eng;