diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-01-14 12:00:56 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-01-16 12:46:52 +0100 |
commit | 291aea14636a0e779d874a01630524facb1397dd (patch) | |
tree | 044ff4131a9b3f5a3edb00e6a807d0609c04a182 /tests/auto/qml | |
parent | 39f1e0d66dc434e764731fbfed29c8fd98d217aa (diff) | |
parent | 88e87647c3b7d651dba2c8e61f945d47ecdd02c4 (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
.qmake.conf
src/qml/jsruntime/qv4context_p.h
src/qml/jsruntime/qv4debugging.cpp
src/qml/jsruntime/qv4engine.cpp
src/qml/jsruntime/qv4functionobject_p.h
src/qml/jsruntime/qv4qobjectwrapper.cpp
src/quick/scenegraph/shaders/visualization.frag
tests/auto/qml/qjsengine/tst_qjsengine.cpp
Change-Id: I492e8546c278f80a300a2129e9a29d861e144a30
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/qjsengine/tst_qjsengine.cpp | 11 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/date.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qml/qv4debugger/tst_qv4debugger.cpp | 38 |
4 files changed, 57 insertions, 1 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 13e60fefd9..9f86c8e4e1 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -175,6 +175,7 @@ private slots: void privateMethods(); void engineForObject(); + void intConversion_QTBUG43309(); signals: void testSignal(); @@ -3639,6 +3640,16 @@ void tst_QJSEngine::engineForObject() QVERIFY(!qjsEngine(&object)); } +void tst_QJSEngine::intConversion_QTBUG43309() +{ + // This failed in the interpreter: + QJSEngine engine; + QString jsCode = "var n = 0.1; var m = (n*255) | 0; m"; + QJSValue result = engine.evaluate( jsCode ); + QVERIFY(result.isNumber()); + QCOMPARE(result.toNumber(), 25.0); +} + QTEST_MAIN(tst_QJSEngine) #include "tst_qjsengine.moc" diff --git a/tests/auto/qml/qqmlecmascript/data/date.qml b/tests/auto/qml/qqmlecmascript/data/date.qml index 0dcba71ae3..41dcaafa33 100644 --- a/tests/auto/qml/qqmlecmascript/data/date.qml +++ b/tests/auto/qml/qqmlecmascript/data/date.qml @@ -17,4 +17,10 @@ Item { var dt = new Date(""); return isNaN(dt); } + + function test_rfc2822_date() + { + var dt = new Date("Wed, 18 Sep 2013 07:00:51 -0700"); + return dt.getTime(); + } } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index e137f6b042..8b95770312 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -7360,7 +7360,8 @@ void tst_qqmlecmascript::dateParse() QMetaObject::invokeMethod(object, "test_is_invalid_qtDateTime", Q_RETURN_ARG(QVariant, q)); QVERIFY(q.toBool() == true); - + QMetaObject::invokeMethod(object, "test_rfc2822_date", Q_RETURN_ARG(QVariant, q)); + QCOMPARE(q.toLongLong(), 1379512851000LL); } void tst_qqmlecmascript::utcDate() diff --git a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp index 70e6739aff..628cd143cf 100644 --- a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp @@ -287,6 +287,8 @@ private slots: // exceptions: void pauseOnThrow(); + void breakInCatch(); + void breakInWith(); void evaluateExpression(); @@ -613,6 +615,42 @@ void tst_qv4debugger::pauseOnThrow() QCOMPARE(m_debuggerAgent->m_thrownValue.toString(), QString("hard")); } +void tst_qv4debugger::breakInCatch() +{ + QString script = + "try {\n" + " throw 'catch...'\n" + "} catch (e) {\n" + " console.log(e, 'me');\n" + "}\n"; + + m_debuggerAgent->addBreakPoint("breakInCatch", 4); + evaluateJavaScript(script, "breakInCatch"); + QVERIFY(m_debuggerAgent->m_wasPaused); + QCOMPARE(m_debuggerAgent->m_pauseReason, BreakPoint); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); + QV4::Debugging::Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); + QCOMPARE(state.fileName, QString("breakInCatch")); + QCOMPARE(state.lineNumber, 4); +} + +void tst_qv4debugger::breakInWith() +{ + QString script = + "with (42) {\n" + " console.log('give the answer');\n" + "}\n"; + + m_debuggerAgent->addBreakPoint("breakInWith", 2); + evaluateJavaScript(script, "breakInWith"); + QVERIFY(m_debuggerAgent->m_wasPaused); + QCOMPARE(m_debuggerAgent->m_pauseReason, BreakPoint); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); + QV4::Debugging::Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); + QCOMPARE(state.fileName, QString("breakInWith")); + QCOMPARE(state.lineNumber, 2); +} + void tst_qv4debugger::evaluateExpression() { QString script = |