aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-06-19 18:28:36 +0200
committerLiang Qi <liang.qi@qt.io>2018-06-19 17:23:10 +0000
commitba64b7d013fb95fb7b3afe9f1724edae7fcca2ed (patch)
tree9aaddf6c214b41999a584129e63282b443734ca9 /tests/auto/qml
parent9333ea8649838d7e0400b0e94c8cbd4fa5d216b0 (diff)
parent5100d558742c682d83e0d4033d78ed4c9f521f56 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: .qmake.conf src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp src/qml/compiler/qv4codegen.cpp tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp Change-Id: I010505326d76ee728ffe5fbd4c7879f28adadb12
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp22
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugprocess.cpp2
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp10
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp32
4 files changed, 64 insertions, 2 deletions
diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
index 7d99ab0a90..a176f674e6 100644
--- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
+++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
@@ -310,6 +310,7 @@ private slots:
// context access:
void readArguments_data() { redundancy_data(); }
void readArguments();
+ void readComplicatedArguments();
void readLocals_data() { redundancy_data(); }
void readLocals();
void readObject_data() { redundancy_data(); }
@@ -562,6 +563,27 @@ void tst_qv4debugger::readArguments()
QCOMPARE(frame0.value(QStringLiteral("b")).toString(), QStringLiteral("two"));
}
+void tst_qv4debugger::readComplicatedArguments()
+{
+ m_debuggerAgent->collector.setRedundantRefs(false);
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "var f = function(a) {\n"
+ " a = 12;\n"
+ " return a;\n"
+ "}\n"
+ "f(1, 2);\n";
+ debugger()->addBreakPoint("readArguments", 3);
+ evaluateJavaScript(script, "readArguments");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QVERIFY(m_debuggerAgent->m_capturedScope.size() > 1);
+ const TestAgent::NamedRefs &frame0 = m_debuggerAgent->m_capturedScope.at(0);
+ QCOMPARE(frame0.size(), 2);
+ QVERIFY(frame0.contains(QStringLiteral("a")));
+ QCOMPARE(frame0.type(QStringLiteral("a")), QStringLiteral("number"));
+ QCOMPARE(frame0.value(QStringLiteral("a")).toInt(), 12);
+}
+
void tst_qv4debugger::readLocals()
{
QFETCH(bool, redundantRefs);
diff --git a/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp
index 0005477075..6f74edf863 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp
+++ b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp
@@ -41,7 +41,6 @@ QQmlDebugProcess::QQmlDebugProcess(const QString &executable, QObject *parent)
, m_receivedBindErrors(0)
{
m_process.setProcessChannelMode(QProcess::MergedChannels);
- m_timer.setSingleShot(true);
m_timer.setInterval(15000);
connect(&m_process, &QProcess::readyReadStandardOutput,
this, &QQmlDebugProcess::processAppOutput);
@@ -128,7 +127,6 @@ void QQmlDebugProcess::timeout()
qWarning() << "Timeout while waiting for QML debugging messages "
"in application output. Process is in state" << m_process.state()
<< ", Output:" << m_output << ".";
- m_eventLoop.quit();
}
bool QQmlDebugProcess::waitForSessionStart()
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 42ee089bb5..cb167fb6bf 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -201,6 +201,7 @@ private slots:
void basicBlockMergeAfterLoopPeeling();
+ void modulusCrash();
void malformedExpression();
void scriptScopes();
@@ -4148,6 +4149,15 @@ void tst_QJSEngine::basicBlockMergeAfterLoopPeeling()
}
+void tst_QJSEngine::modulusCrash()
+{
+ QJSEngine engine;
+ QJSValue result = engine.evaluate(
+ "var a = -2147483648; var b = -1; var c = a % b; c;"
+ );
+ QVERIFY(result.isNumber() && result.toNumber() == 0.);
+}
+
void tst_QJSEngine::malformedExpression()
{
QJSEngine engine;
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index 09480a8e1a..f179093a3d 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -78,6 +78,7 @@ private slots:
void testGroupedPropertyRevisions();
void componentFromEval();
void qrcUrls();
+ void cppSignalAndEval();
public slots:
QObject *createAQObjectForOwnershipTest ()
@@ -920,6 +921,37 @@ void tst_qqmlengine::qrcUrls()
}
}
+class ObjectCaller : public QObject
+{
+ Q_OBJECT
+signals:
+ void doubleReply(const double a);
+};
+
+void tst_qqmlengine::cppSignalAndEval()
+{
+ ObjectCaller objectCaller;
+ QQmlEngine engine;
+ engine.rootContext()->setContextProperty(QLatin1Literal("CallerCpp"), &objectCaller);
+ QQmlComponent c(&engine);
+ c.setData("import QtQuick 2.9\n"
+ "Item {\n"
+ " property var r: 0\n"
+ " Connections {\n"
+ " target: CallerCpp;\n"
+ " onDoubleReply: {\n"
+ " eval('var z = 1');\n"
+ " r = a;\n"
+ " }\n"
+ " }\n"
+ "}",
+ QUrl(QStringLiteral("qrc:/main.qml")));
+ QScopedPointer<QObject> object(c.create());
+ QVERIFY(!object.isNull());
+ emit objectCaller.doubleReply(1.1234);
+ QCOMPARE(object->property("r"), 1.1234);
+}
+
QTEST_MAIN(tst_qqmlengine)
#include "tst_qqmlengine.moc"