diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-11-26 01:00:05 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-11-26 09:11:06 +0100 |
commit | e80067f2651a00f3d164aa4eba863141b281e740 (patch) | |
tree | 8477dce4b5c7ccd96b0c4086b52a636140dc893a /tests | |
parent | c0a8c84eb4bfa8be5fc77d44d25c1a523c022d5c (diff) | |
parent | 9248166095b1e3383a43f106219e888b6d43b7d6 (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
src/qml/qmldirparser/qqmldirparser.cpp
src/qml/qmldirparser/qqmldirparser_p.h
Change-Id: Ia68a8d4f345e6e456eebc3f215fc90d3819ddd70
Diffstat (limited to 'tests')
4 files changed, 124 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp index 1e690e38dd..bc4ba9437c 100644 --- a/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp +++ b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp @@ -375,6 +375,9 @@ void tst_qqmldirparser::parse() QCOMPARE(toStringList(p.dependencies()), dependencies); QCOMPARE(p.designerSupported(), designerSupported); + + p.clear(); + QVERIFY(p.typeNamespace().isEmpty()); } QTEST_MAIN(tst_qqmldirparser) diff --git a/tests/auto/qmltest/events/tst_drag.qml b/tests/auto/qmltest/events/tst_drag.qml index 2653848adc..5c5b885e6c 100644 --- a/tests/auto/qmltest/events/tst_drag.qml +++ b/tests/auto/qmltest/events/tst_drag.qml @@ -150,6 +150,15 @@ Rectangle{ SignalSpy {} } + Component { + id: mouseAreaComponent + + MouseArea { + anchors.fill: parent + hoverEnabled: true + } + } + TestCase { name:"mouserelease" when:windowShown @@ -295,5 +304,26 @@ Rectangle{ else verify(contentYSpy.count > 0) } + + function test_negativeDragDistance_data() { + return [ + { tag: "horizontal", startX: 100, startY: 100, xDistance: -90, yDistance: 0 }, + { tag: "vertical", startX: 100, startY: 100, xDistance: 0, yDistance: -90 } + ] + } + + // Tests that dragging to the left or top actually results in intermediate mouse moves. + function test_negativeDragDistance(data) { + let mouseArea = createTemporaryObject(mouseAreaComponent, root) + verify(mouseArea) + + let positionSpy = signalSpyComponent.createObject(mouseArea, + { target: mouseArea, signalName: "positionChanged" }) + verify(positionSpy) + verify(positionSpy.valid) + + mouseDrag(mouseArea, data.startX, data.startY, data.xDistance, data.yDistance) + verify(positionSpy.count > 2, "Expected more than 2 mouse position changes, but only got " + positionSpy.count) + } } } diff --git a/tests/auto/quick/qquickvisualdatamodel/data/filterGroupForDelegate.qml b/tests/auto/quick/qquickvisualdatamodel/data/filterGroupForDelegate.qml new file mode 100644 index 0000000000..d72ca51d7f --- /dev/null +++ b/tests/auto/quick/qquickvisualdatamodel/data/filterGroupForDelegate.qml @@ -0,0 +1,77 @@ +import QtQml.Models 2.12 +import Qt.labs.qmlmodels 1.0 +import QtQuick 2.12 + +Item { + id: root + width: 200 + height: 320 + + property int numChanges: 0 + property bool ok: true + + DelegateModel { + id: theModel + + model: ListModel { + ListElement { role: "section" } + ListElement { role: "item" } + ListElement { role: "section" } + ListElement { role: "item" } + ListElement { role: "section" } + ListElement { role: "item" } + ListElement { role: "item" } + ListElement { role: "item" } + } + + filterOnGroup: "expanded" + groups: DelegateModelGroup { + name: "expanded" + } + + delegate: DelegateChooser { + role: "role" + + DelegateChoice { + roleValue: "section" + Text { + text: "+ Section " + index + + Timer { + interval: (index + 10) + repeat: true + running: true + onTriggered: { + ++ root.numChanges; + if (model.role !== "section") { + root.ok = false; + console.warn("wrong!", root.numChanges); + } + let i = parent.DelegateModel.itemsIndex + 1; + for (; i < theModel.items.count; ++i) { + let item = theModel.items.get(i); + if (item.model.role === "section") + break; + item.inExpanded = !item.inExpanded; + } + } + } + } + } + + DelegateChoice { + roleValue: "item" + Text { + text: "Item " + index + } + } + } + + Component.onCompleted: items.addGroups(0, items.count, ["expanded"]) + } + + ListView { + anchors.fill: parent + model: theModel + } +} diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index fe56cad018..c5a3bceee0 100644 --- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -433,6 +433,7 @@ private slots: void invalidContext(); void externalManagedModel(); void delegateModelChangeDelegate(); + void checkFilterGroupForDelegate(); private: template <int N> void groups_verify( @@ -4342,6 +4343,19 @@ void tst_qquickvisualdatamodel::delegateModelChangeDelegate() QCOMPARE(visualModel->count(), 3); } +void tst_qquickvisualdatamodel::checkFilterGroupForDelegate() +{ + QQuickView view; + view.setSource(testFileUrl("filterGroupForDelegate.qml")); + view.show(); + + QQuickItem *obj = view.rootObject(); + QVERIFY(obj); + + QTRY_VERIFY(obj->property("numChanges").toInt() > 100); + QVERIFY(obj->property("ok").toBool()); +} + QTEST_MAIN(tst_qquickvisualdatamodel) #include "tst_qquickvisualdatamodel.moc" |