diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-04-07 14:48:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-04-07 12:53:23 +0000 |
commit | 017350a8a9b4ac866c9b79186bf5a1dd6f6f06ec (patch) | |
tree | f98070d9bf0bd5659d34355b5eb9647637874187 /tests | |
parent | b361a59c699fca02379c149cf0b9c59490a1ba62 (diff) | |
parent | 67d1d7843ab5e1c904c8f0f76eadb9fc3f1bbb17 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/qml/jit/qv4assembler.cpp
src/qml/jit/qv4assembler_p.h
src/qml/jit/qv4isel_masm.cpp
src/qml/jsruntime/qv4vme_moth.cpp
Change-Id: I865d794e550a263387a39ca8d051ebf48b70cbc0
Diffstat (limited to 'tests')
14 files changed, 345 insertions, 42 deletions
diff --git a/tests/auto/particles/qquickparticlesystem/data/crashaffectors.qml b/tests/auto/particles/qquickparticlesystem/data/crashaffectors.qml new file mode 100644 index 0000000000..de105916a7 --- /dev/null +++ b/tests/auto/particles/qquickparticlesystem/data/crashaffectors.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2017 reMarkable A/S +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Particles 2.0 + +ParticleSystem { + running: false + Affector { Component.onCompleted: destroy() } + Emitter { + Timer { interval: 1; running: true; onTriggered: parent.lifeSpan = 1 } + } +} diff --git a/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp index 5c82b946e5..5f9db12144 100644 --- a/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp +++ b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp @@ -42,6 +42,7 @@ public: private slots: void initTestCase(); void test_basic(); + void test_affectorscrash(); }; void tst_qquickparticlesystem::initTestCase() @@ -78,6 +79,12 @@ void tst_qquickparticlesystem::test_basic() delete view; QVERIFY(extremelyFuzzyCompare(stillAlive, 500, 5));//Small simulation variance is permissible. } +void tst_qquickparticlesystem::test_affectorscrash() +{ + QScopedPointer<QQuickView> view (createView(testFileUrl("crashaffectors.qml"), 600)); + + // This should have crashed by now +} QTEST_MAIN(tst_qquickparticlesystem); diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp index 8c30a82317..d9a4777115 100644 --- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp @@ -180,14 +180,9 @@ void tst_QQmlEngineDebugService::recursiveObjectTest( { const QMetaObject *meta = o->metaObject(); - QQmlType *type = QQmlMetaType::qmlType(meta); - QString className = type ? QString(type->qmlTypeName()) - : QString(meta->className()); - className = className.mid(className.lastIndexOf(QLatin1Char('/'))+1); - QCOMPARE(oref.debugId, QQmlDebugService::idForObject(o)); QCOMPARE(oref.name, o->objectName()); - QCOMPARE(oref.className, className); + QCOMPARE(oref.className, QQmlMetaType::prettyTypeName(o)); QCOMPARE(oref.contextDebugId, QQmlDebugService::idForObject( qmlContext(o))); @@ -201,6 +196,7 @@ void tst_QQmlEngineDebugService::recursiveObjectTest( QmlDebugObjectReference cref; foreach (const QmlDebugObjectReference &ref, oref.children) { + QVERIFY(!ref.className.isEmpty()); if (ref.debugId == debugId) { cref = ref; break; @@ -369,6 +365,7 @@ void tst_QQmlEngineDebugService::setMethodBody() { bool success; QmlDebugObjectReference obj = findRootObject(2); + QVERIFY(!obj.className.isEmpty()); QObject *root = m_components.at(2); // Without args @@ -410,6 +407,7 @@ void tst_QQmlEngineDebugService::setMethodBody() void tst_QQmlEngineDebugService::watch_property() { QmlDebugObjectReference obj = findRootObject(); + QVERIFY(!obj.className.isEmpty()); QmlDebugPropertyReference prop = findProperty(obj.properties, "width"); bool success; @@ -454,6 +452,7 @@ void tst_QQmlEngineDebugService::watch_property() void tst_QQmlEngineDebugService::watch_object() { QmlDebugObjectReference obj = findRootObject(); + QVERIFY(!obj.className.isEmpty()); bool success; @@ -519,6 +518,7 @@ void tst_QQmlEngineDebugService::watch_expression() int origWidth = m_rootItem->property("width").toInt(); QmlDebugObjectReference obj = findRootObject(); + QVERIFY(!obj.className.isEmpty()); bool success; @@ -654,6 +654,7 @@ void tst_QQmlEngineDebugService::queryObject() bool success; QmlDebugObjectReference rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); recursive ? unconnected->queryObjectRecursive(rootObject, &success) : unconnected->queryObject(rootObject, &success); @@ -665,6 +666,7 @@ void tst_QQmlEngineDebugService::queryObject() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); QmlDebugObjectReference obj = m_dbg->object(); + QVERIFY(!obj.className.isEmpty()); // check source as defined in main() QmlDebugFileReference source = obj.source; @@ -676,12 +678,15 @@ void tst_QQmlEngineDebugService::queryObject() recursiveObjectTest(m_rootItem, obj, recursive); if (recursive) { - foreach (const QmlDebugObjectReference &child, obj.children) + foreach (const QmlDebugObjectReference &child, obj.children) { + QVERIFY(!child.className.isEmpty()); QVERIFY(child.properties.count() > 0); + } QmlDebugObjectReference rect; QmlDebugObjectReference text; foreach (const QmlDebugObjectReference &child, obj.children) { + QVERIFY(!child.className.isEmpty()); if (child.className == "Rectangle") rect = child; else if (child.className == "Text") @@ -695,8 +700,10 @@ void tst_QQmlEngineDebugService::queryObject() QCOMPARE(findProperty(text.properties, "color").value, qVariantFromValue(QColor("blue"))); } else { - foreach (const QmlDebugObjectReference &child, obj.children) + foreach (const QmlDebugObjectReference &child, obj.children) { + QVERIFY(!child.className.isEmpty()); QCOMPARE(child.properties.count(), 0); + } } } @@ -715,6 +722,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() bool success; QmlDebugObjectReference rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); const QString fileName = QFileInfo(rootObject.source.url.toString()).fileName(); int lineNumber = rootObject.source.lineNumber; @@ -737,6 +745,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() QCOMPARE(m_dbg->objects().count(), 1); QmlDebugObjectReference obj = m_dbg->objects().first(); + QVERIFY(!obj.className.isEmpty()); // check source as defined in main() QmlDebugFileReference source = obj.source; @@ -748,12 +757,15 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() recursiveObjectTest(m_rootItem, obj, recursive); if (recursive) { - foreach (const QmlDebugObjectReference &child, obj.children) + foreach (const QmlDebugObjectReference &child, obj.children) { + QVERIFY(!child.className.isEmpty()); QVERIFY(child.properties.count() > 0); + } QmlDebugObjectReference rect; QmlDebugObjectReference text; foreach (const QmlDebugObjectReference &child, obj.children) { + QVERIFY(!child.className.isEmpty()); if (child.className == "Rectangle") rect = child; else if (child.className == "Text") @@ -767,8 +779,10 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() QCOMPARE(findProperty(text.properties, "color").value, qVariantFromValue(QColor("blue"))); } else { - foreach (const QmlDebugObjectReference &child, obj.children) + foreach (const QmlDebugObjectReference &child, obj.children) { + QVERIFY(!child.className.isEmpty()); QCOMPARE(child.properties.count(), 0); + } } } @@ -783,6 +797,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation_data() void tst_QQmlEngineDebugService::regression_QTCREATORBUG_7451() { QmlDebugObjectReference rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); int contextId = rootObject.contextDebugId; QQmlContext *context = qobject_cast<QQmlContext *>(QQmlDebugService::objectForId(contextId)); QQmlComponent component(context->engine()); @@ -809,6 +824,7 @@ void tst_QQmlEngineDebugService::regression_QTCREATORBUG_7451() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); foreach (QmlDebugObjectReference child, rootObject.children) { + QVERIFY(!child.className.isEmpty()); success = false; lineNumber = child.source.lineNumber; columnNumber = child.source.columnNumber; @@ -831,6 +847,7 @@ void tst_QQmlEngineDebugService::regression_QTCREATORBUG_7451() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); foreach (QmlDebugObjectReference child, rootObject.children) { + QVERIFY(!child.className.isEmpty()); success = false; lineNumber = child.source.lineNumber; columnNumber = child.source.columnNumber; @@ -846,6 +863,7 @@ void tst_QQmlEngineDebugService::queryObjectWithNonStreamableTypes() bool success; QmlDebugObjectReference rootObject = findRootObject(4, true); + QVERIFY(!rootObject.className.isEmpty()); QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); unconnected->queryObject(rootObject, &success); @@ -857,6 +875,7 @@ void tst_QQmlEngineDebugService::queryObjectWithNonStreamableTypes() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); QmlDebugObjectReference obj = m_dbg->object(); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties, "modelIndex").value, QVariant()); } @@ -950,6 +969,7 @@ void tst_QQmlEngineDebugService::queryExpressionResultBC_data() void tst_QQmlEngineDebugService::setBindingForObject() { QmlDebugObjectReference rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); QVERIFY(rootObject.debugId != -1); QmlDebugPropertyReference widthPropertyRef = findProperty(rootObject.properties, "width"); @@ -967,6 +987,7 @@ void tst_QQmlEngineDebugService::setBindingForObject() QCOMPARE(m_dbg->valid(), true); rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); widthPropertyRef = findProperty(rootObject.properties, "width"); QCOMPARE(widthPropertyRef.value, QVariant(15)); @@ -982,6 +1003,7 @@ void tst_QQmlEngineDebugService::setBindingForObject() QCOMPARE(m_dbg->valid(), true); rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); widthPropertyRef = findProperty(rootObject.properties, "width"); QCOMPARE(widthPropertyRef.value, QVariant(20)); @@ -992,13 +1014,14 @@ void tst_QQmlEngineDebugService::setBindingForObject() // set handler // rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); QCOMPARE(rootObject.children.size(), 5); // Rectangle, Text, MouseArea, Component.onCompleted, NonScriptPropertyElement QmlDebugObjectReference mouseAreaObject = rootObject.children.at(2); + QVERIFY(!mouseAreaObject.className.isEmpty()); m_dbg->queryObjectRecursive(mouseAreaObject, &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); mouseAreaObject = m_dbg->object(); - QCOMPARE(mouseAreaObject.className, QString("MouseArea")); QmlDebugPropertyReference onEnteredRef = findProperty(mouseAreaObject.properties, "onEntered"); @@ -1015,11 +1038,14 @@ void tst_QQmlEngineDebugService::setBindingForObject() QCOMPARE(m_dbg->valid(), true); rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); mouseAreaObject = rootObject.children.at(2); + QVERIFY(!mouseAreaObject.className.isEmpty()); m_dbg->queryObjectRecursive(mouseAreaObject, &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); mouseAreaObject = m_dbg->object(); + QVERIFY(!mouseAreaObject.className.isEmpty()); onEnteredRef = findProperty(mouseAreaObject.properties, "onEntered"); QCOMPARE(onEnteredRef.name, QString("onEntered")); QCOMPARE(onEnteredRef.value, QVariant("function() { [code] }")); @@ -1028,6 +1054,7 @@ void tst_QQmlEngineDebugService::setBindingForObject() void tst_QQmlEngineDebugService::resetBindingForObject() { QmlDebugObjectReference rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); QVERIFY(rootObject.debugId != -1); QmlDebugPropertyReference widthPropertyRef = findProperty(rootObject.properties, "width"); @@ -1048,6 +1075,7 @@ void tst_QQmlEngineDebugService::resetBindingForObject() QCOMPARE(m_dbg->valid(), true); rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); widthPropertyRef = findProperty(rootObject.properties, "width"); QCOMPARE(widthPropertyRef.value, QVariant(0)); @@ -1063,6 +1091,7 @@ void tst_QQmlEngineDebugService::resetBindingForObject() QCOMPARE(m_dbg->valid(), true); rootObject = findRootObject(); + QVERIFY(!rootObject.className.isEmpty()); QmlDebugPropertyReference boldPropertyRef = findProperty(rootObject.properties, "font.bold"); QCOMPARE(boldPropertyRef.value.toBool(), false); @@ -1076,7 +1105,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() const int sourceIndex = 3; QmlDebugObjectReference obj = findRootObject(sourceIndex); - + QVERIFY(!obj.className.isEmpty()); QVERIFY(obj.debugId != -1); QVERIFY(obj.children.count() >= 2); bool success; @@ -1092,6 +1121,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); obj = findRootObject(sourceIndex); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties,"width").value.toInt(),200); @@ -1102,6 +1132,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() obj = findRootObject(sourceIndex, true); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties,"width").value.toInt(),100); @@ -1111,6 +1142,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QVERIFY(state.children.count() > 0); QmlDebugObjectReference propertyChange = state.children[0]; + QVERIFY(!propertyChange.className.isEmpty()); QVERIFY(propertyChange.debugId != -1); m_dbg->setBindingForObject(propertyChange.debugId, "width",QVariant(300),true, @@ -1120,6 +1152,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() // check properties changed in state obj = findRootObject(sourceIndex); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties,"width").value.toInt(),100); @@ -1128,6 +1161,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); obj = findRootObject(sourceIndex); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties,"width").value.toInt(),300); // check changing properties of base state from within a state @@ -1141,6 +1175,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); obj = findRootObject(sourceIndex); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties,"width").value.toInt(),300); m_dbg->queryExpressionResult(obj.debugId,QString("state=\"\""), &success); @@ -1148,6 +1183,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); obj = findRootObject(sourceIndex); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties,"width").value.toInt(), 400); // reset binding while in a state @@ -1156,6 +1192,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); obj = findRootObject(sourceIndex); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties,"width").value.toInt(), 300); m_dbg->resetBindingForObject(propertyChange.debugId, "width", &success); @@ -1164,6 +1201,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QCOMPARE(m_dbg->valid(), true); obj = findRootObject(sourceIndex); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties,"width").value.toInt(), 400); // re-add binding @@ -1174,6 +1212,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QCOMPARE(m_dbg->valid(), true); obj = findRootObject(sourceIndex); + QVERIFY(!obj.className.isEmpty()); QCOMPARE(findProperty(obj.properties,"width").value.toInt(), 300); } @@ -1182,7 +1221,7 @@ void tst_QQmlEngineDebugService::queryObjectTree() const int sourceIndex = 3; QmlDebugObjectReference obj = findRootObject(sourceIndex, true); - + QVERIFY(!obj.className.isEmpty()); QVERIFY(obj.debugId != -1); QVERIFY(obj.children.count() >= 2); @@ -1192,16 +1231,16 @@ void tst_QQmlEngineDebugService::queryObjectTree() QVERIFY(state.children.count() > 0); QmlDebugObjectReference propertyChange = state.children[0]; + QVERIFY(!propertyChange.className.isEmpty()); QVERIFY(propertyChange.debugId != -1); QmlDebugPropertyReference propertyChangeTarget = findProperty(propertyChange.properties,"target"); QCOMPARE(propertyChangeTarget.objectDebugId, propertyChange.debugId); QmlDebugObjectReference targetReference = qvariant_cast<QmlDebugObjectReference>(propertyChangeTarget.value); + QVERIFY(!targetReference.className.isEmpty()); QVERIFY(targetReference.debugId != -1); - - // check transition QmlDebugObjectReference transition = obj.children[0]; QCOMPARE(transition.className, QString("Transition")); @@ -1210,12 +1249,14 @@ void tst_QQmlEngineDebugService::queryObjectTree() QVERIFY(transition.children.count() > 0); QmlDebugObjectReference animation = transition.children[0]; + QVERIFY(!animation.className.isEmpty()); QVERIFY(animation.debugId != -1); QmlDebugPropertyReference animationTarget = findProperty(animation.properties,"target"); QCOMPARE(animationTarget.objectDebugId, animation.debugId); targetReference = qvariant_cast<QmlDebugObjectReference>(animationTarget.value); + QVERIFY(!targetReference.className.isEmpty()); QVERIFY(targetReference.debugId != -1); QCOMPARE(findProperty(animation.properties,"property").value.toString(), QString("width")); diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp index 6d0d884ed7..584bd10151 100644 --- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp @@ -315,8 +315,8 @@ private slots: void stepToEndOfScript_data() { redundancy_data(); } void stepToEndOfScript(); - void lastLineOfLoop_data(); - void lastLineOfLoop(); + void lastLineOfConditional_data(); + void lastLineOfConditional(); private: QV4Debugger *debugger() const { @@ -801,32 +801,60 @@ void tst_qv4debugger::stepToEndOfScript() QCOMPARE(state.lineNumber, -4); // A return instruction without proper line number. } -void tst_qv4debugger::lastLineOfLoop_data() +void tst_qv4debugger::lastLineOfConditional_data() { - QTest::addColumn<QString>("loopHead"); - QTest::addColumn<QString>("loopTail"); - - QTest::newRow("for") << "for (var i = 0; i < 10; ++i) {\n" << "}\n"; - QTest::newRow("for..in") << "for (var i in [0, 1, 2, 3, 4]) {\n" << "}\n"; - QTest::newRow("while") << "while (ret < 10) {\n" << "}\n"; - QTest::newRow("do..while") << "do {\n" << "} while (ret < 10);\n"; + QTest::addColumn<QString>("head"); + QTest::addColumn<QString>("tail"); + QTest::addColumn<int>("breakPoint"); + QTest::addColumn<int>("lastLine"); + + QTest::newRow("for {block}") << "for (var i = 0; i < 10; ++i) {\n" << "}" << 4 << 7; + QTest::newRow("for..in {block}") << "for (var i in [0, 1, 2, 3, 4]) {\n" << "}" << 4 << 7; + QTest::newRow("while {block}") << "while (ret < 10) {\n" << "}" << 4 << 7; + QTest::newRow("do..while {block}") << "do {\n" << "} while (ret < 10);" << 4 << 7; + + QTest::newRow("if true {block}") << "if (true) {\n" << "}" + << 4 << 7; + QTest::newRow("if false {block}") << "if (false) {\n" << "}" + << 2 << 8; + QTest::newRow("if true else {block}") << "if (true) {\n" << "} else {\n ret += 8;\n}" + << 4 << 7; + QTest::newRow("if false else {block}") << "if (false) {\n" << "} else {\n ret += 8;\n}" + << 8 << 9; + + QTest::newRow("for statement") << "for (var i = 0; i < 10; ++i)\n" << "" << 4 << 2; + QTest::newRow("for..in statement") << "for (var i in [0, 1, 2, 3, 4])\n" << "" << 4 << 2; + QTest::newRow("while statement") << "while (ret < 10)\n" << "" << 4 << 2; + QTest::newRow("do..while statement") << "do\n" << "while (ret < 10);" << 4 << 7; + + // For two nested if statements without blocks, we need to map the jump from the inner to the + // outer one on the outer "if". There is just no better place. + QTest::newRow("if true statement") << "if (true)\n" << "" << 4 << 2; + QTest::newRow("if false statement") << "if (false)\n" << "" << 2 << 8; + + // Also two nested ifs without blocks. + QTest::newRow("if true else statement") << "if (true)\n" << "else\n ret += 8;" << 4 << 2; + QTest::newRow("if false else statement") << "if (false)\n" << "else\n ret += 8;" << 8 << 9; } -void tst_qv4debugger::lastLineOfLoop() +void tst_qv4debugger::lastLineOfConditional() { - QFETCH(QString, loopHead); - QFETCH(QString, loopTail); + QFETCH(QString, head); + QFETCH(QString, tail); + QFETCH(int, breakPoint); + QFETCH(int, lastLine); QString script = - "var ret = 0;\n" - + loopHead + + "var ret = 2;\n" + + head + " if (ret == 2)\n" " ret += 4;\n" // breakpoint, then step over - " else \n" + " else\n" " ret += 1;\n" - + loopTail; + + tail + "\n" + + "ret -= 5;"; - debugger()->addBreakPoint("trueBranch", 4); + debugger()->addBreakPoint("trueBranch", breakPoint); m_debuggerAgent->m_resumeSpeed = QV4Debugger::StepOver; evaluateJavaScript(script, "trueBranch"); QVERIFY(m_debuggerAgent->m_wasPaused); @@ -834,10 +862,10 @@ void tst_qv4debugger::lastLineOfLoop() QVERIFY(m_debuggerAgent->m_statesWhenPaused.count() > 1); QV4Debugger::ExecutionState firstState = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(firstState.fileName, QString("trueBranch")); - QCOMPARE(firstState.lineNumber, 4); + QCOMPARE(firstState.lineNumber, breakPoint); QV4Debugger::ExecutionState secondState = m_debuggerAgent->m_statesWhenPaused.at(1); QCOMPARE(secondState.fileName, QString("trueBranch")); - QCOMPARE(secondState.lineNumber, 7); + QCOMPARE(secondState.lineNumber, lastLine); } void tst_qv4debugger::redundancy_data() diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp index 3e27951d78..c0252a0290 100644 --- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp +++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp @@ -386,6 +386,7 @@ void QQmlEngineDebugClient::decode(QPacket &ds, { QmlDebugObjectReference obj; obj.debugId = prop.value.toInt(); + obj.className = prop.valueTypeName; prop.value = qVariantFromValue(obj); break; } diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index 007eb0dc83..59566ad927 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -36,6 +36,7 @@ PRIVATETESTS += \ qqmlcpputils \ qqmldirparser \ v4misc \ + qmlcachegen !boot2qt { PRIVATETESTS += \ diff --git a/tests/auto/qml/qmlcachegen/qmlcachegen.pro b/tests/auto/qml/qmlcachegen/qmlcachegen.pro new file mode 100644 index 0000000000..8d8b37be15 --- /dev/null +++ b/tests/auto/qml/qmlcachegen/qmlcachegen.pro @@ -0,0 +1,7 @@ +CONFIG += testcase +TARGET = tst_qmlcachegen +macos:CONFIG -= app_bundle + +SOURCES += tst_qmlcachegen.cpp + +QT += core-private qml-private testlib diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp new file mode 100644 index 0000000000..b7e616a050 --- /dev/null +++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> + +#include <QQmlComponent> +#include <QQmlEngine> +#include <QProcess> +#include <QLibraryInfo> +#include <QSysInfo> + +class tst_qmlcachegen: public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + + void loadGeneratedFile(); + void translationExpressionSupport(); +}; + +// A wrapper around QQmlComponent to ensure the temporary reference counts +// on the type data as a result of the main thread <> loader thread communication +// are dropped. Regular Synchronous loading will leave us with an event posted +// to the gui thread and an extra refcount that will only be dropped after the +// event delivery. A plain sendPostedEvents() however is insufficient because +// we can't be sure that the event is posted after the constructor finished. +class CleanlyLoadingComponent : public QQmlComponent +{ +public: + CleanlyLoadingComponent(QQmlEngine *engine, const QUrl &url) + : QQmlComponent(engine, url, QQmlComponent::Asynchronous) + { waitForLoad(); } + CleanlyLoadingComponent(QQmlEngine *engine, const QString &fileName) + : QQmlComponent(engine, fileName, QQmlComponent::Asynchronous) + { waitForLoad(); } + + void waitForLoad() + { + QTRY_VERIFY(status() == QQmlComponent::Ready || status() == QQmlComponent::Error); + } +}; + +static bool generateCache(const QString &qmlFileName) +{ + QProcess proc; + proc.setProcessChannelMode(QProcess::ForwardedChannels); + proc.setProgram(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator() + QLatin1String("qmlcachegen")); + proc.setArguments(QStringList() << (QLatin1String("--target-architecture=") + QSysInfo::buildCpuArchitecture()) << (QLatin1String("--target-abi=") + QSysInfo::buildAbi()) << qmlFileName); + proc.start(); + if (!proc.waitForFinished()) + return false; + if (proc.exitStatus() != QProcess::NormalExit) + return false; + return proc.exitCode() == 0; +} + +void tst_qmlcachegen::initTestCase() +{ + qputenv("QML_FORCE_DISK_CACHE", "1"); +} + +void tst_qmlcachegen::loadGeneratedFile() +{ + QTemporaryDir tempDir; + QVERIFY(tempDir.isValid()); + + const auto writeTempFile = [&tempDir](const QString &fileName, const char *contents) { + QFile f(tempDir.path() + '/' + fileName); + const bool ok = f.open(QIODevice::WriteOnly | QIODevice::Truncate); + Q_ASSERT(ok); + f.write(contents); + return f.fileName(); + }; + + const QString testFilePath = writeTempFile("test.qml", "import QtQml 2.0\n" + "QtObject {\n" + " property int value: Math.min(100, 42);\n" + "}"); + + QVERIFY(generateCache(testFilePath)); + + const QString cacheFilePath = testFilePath + QLatin1Char('c'); + QVERIFY(QFile::exists(cacheFilePath)); + QVERIFY(QFile::remove(testFilePath)); + + QQmlEngine engine; + CleanlyLoadingComponent component(&engine, QUrl::fromLocalFile(testFilePath)); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + QCOMPARE(obj->property("value").toInt(), 42); +} + +void tst_qmlcachegen::translationExpressionSupport() +{ + QTemporaryDir tempDir; + QVERIFY(tempDir.isValid()); + + const auto writeTempFile = [&tempDir](const QString &fileName, const char *contents) { + QFile f(tempDir.path() + '/' + fileName); + const bool ok = f.open(QIODevice::WriteOnly | QIODevice::Truncate); + Q_ASSERT(ok); + f.write(contents); + return f.fileName(); + }; + + const QString testFilePath = writeTempFile("test.qml", "import QtQml.Models 2.2\n" + "import QtQml 2.2\n" + "QtObject {\n" + " property ListModel model: ListModel {\n" + " ListElement {\n" + " text: qsTr(\"All\")\n" + " }\n" + " ListElement {\n" + " text: QT_TR_NOOP(\"Ok\")\n" + " }\n" + " }\n" + " property string text: model.get(0).text + \" \" + model.get(1).text\n" + "}"); + + + QVERIFY(generateCache(testFilePath)); + + const QString cacheFilePath = testFilePath + QLatin1Char('c'); + QVERIFY(QFile::exists(cacheFilePath)); + QVERIFY(QFile::remove(testFilePath)); + + QQmlEngine engine; + CleanlyLoadingComponent component(&engine, QUrl::fromLocalFile(testFilePath)); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + QCOMPARE(obj->property("text").toString(), QString("All Ok")); +} + +QTEST_GUILESS_MAIN(tst_qmlcachegen) + +#include "tst_qmlcachegen.moc" diff --git a/tests/auto/qmltest/BLACKLIST b/tests/auto/qmltest/BLACKLIST index d324e9da5d..e0a4ce1743 100644 --- a/tests/auto/qmltest/BLACKLIST +++ b/tests/auto/qmltest/BLACKLIST @@ -10,3 +10,7 @@ linux [ListView::test_listInteractiveCurrentIndexEnforce] linux macos-10.12 +[TextEdit::test_textentry] +macos-10.12 +[TextEdit::test_textentry_char] +macos-10.12 diff --git a/tests/auto/quick/qquickapplication/BLACKLIST b/tests/auto/quick/qquickapplication/BLACKLIST new file mode 100644 index 0000000000..81592db56f --- /dev/null +++ b/tests/auto/quick/qquickapplication/BLACKLIST @@ -0,0 +1,2 @@ +[active] +osx-10.11 diff --git a/tests/auto/quick/qquickflickable/BLACKLIST b/tests/auto/quick/qquickflickable/BLACKLIST index 647bf819a5..f35397f119 100644 --- a/tests/auto/quick/qquickflickable/BLACKLIST +++ b/tests/auto/quick/qquickflickable/BLACKLIST @@ -17,3 +17,5 @@ osx osx-10.10 [flickVelocity] osx-10.10 +[nestedSliderUsingTouch:keepNeither] +ubuntu-16.04 diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 3ecebfb48f..f8277c6895 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -63,9 +63,7 @@ public: , touchReleases(0) , ungrabs(0) , m_active(false) - { - setFlags(ItemAcceptsDrops); - } + { } QPointF pos() const { return m_pos; } @@ -2044,10 +2042,10 @@ void tst_qquickflickable::nestedSliderUsingTouch() QCOMPARE(tda->active(), !ungrabs); QTest::touchEvent(window, touchDevice).release(0, p0, window); QQuickTouchUtils::flush(window); - QCOMPARE(tda->touchPointStates.first(), Qt::TouchPointPressed); - QCOMPARE(tda->touchUpdates, updates); - QCOMPARE(tda->touchReleases, releases); - QCOMPARE(tda->ungrabs, ungrabs); + QTRY_COMPARE(tda->touchPointStates.first(), Qt::TouchPointPressed); + QTRY_COMPARE(tda->touchUpdates, updates); + QTRY_COMPARE(tda->touchReleases, releases); + QTRY_COMPARE(tda->ungrabs, ungrabs); } // QTBUG-31328 diff --git a/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST new file mode 100644 index 0000000000..cab6e2f7bf --- /dev/null +++ b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST @@ -0,0 +1,4 @@ +[nonOverlapping] +ubuntu-16.04 +[nested] +ubuntu-16.04 diff --git a/tests/auto/quick/qquickwindow/BLACKLIST b/tests/auto/quick/qquickwindow/BLACKLIST new file mode 100644 index 0000000000..b2720c2642 --- /dev/null +++ b/tests/auto/quick/qquickwindow/BLACKLIST @@ -0,0 +1,2 @@ +[requestActivate] +osx-10.11 |