diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-03-23 15:02:35 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-03-23 15:02:35 +0100 |
commit | 5178f6269418d731efe6bec7bc541f21fdd6d7f4 (patch) | |
tree | cd09fbc67c6e92652e92951cf9c91385ddce8564 /tests/auto | |
parent | 2b0e33692b949ebaed034c72d0ea3da9f0ef6de2 (diff) | |
parent | 81f656eeac522532ff98a32aac68a1571ea54c99 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/quickcontrols2/qquickstyle.cpp
tests/auto/controls/data/tst_popup.qml
Change-Id: I7b7bb5f9c63b32eef65c9b2e68f56baa3da69cff
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 17 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_popup.qml | 35 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_spinbox.qml | 17 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_stackview.qml | 15 | ||||
-rw-r--r-- | tests/auto/customization/tst_customization.cpp | 4 |
5 files changed, 83 insertions, 5 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 30d6a93c..22b36725 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -80,6 +80,11 @@ TestCase { } } + Component { + id: mouseArea + MouseArea { } + } + function init() { // QTBUG-61225: Move the mouse away to avoid QQuickWindowPrivate::flushFrameSynchronousEvents() // delivering interfering hover events based on the last mouse position from earlier tests. For @@ -1042,24 +1047,34 @@ TestCase { } function test_wheel() { - var control = createTemporaryObject(comboBox, testCase, {model: 2, wheelEnabled: true}) + var ma = createTemporaryObject(mouseArea, testCase, {width: 100, height: 100}) + verify(ma) + + var control = comboBox.createObject(ma, {model: 2, wheelEnabled: true}) verify(control) var delta = 120 + var spy = signalSpy.createObject(ma, {target: ma, signalName: "wheel"}) + verify(spy.valid) + mouseWheel(control, control.width / 2, control.height / 2, -delta, -delta) compare(control.currentIndex, 1) + compare(spy.count, 0) // no propagation // reached bounds -> no change mouseWheel(control, control.width / 2, control.height / 2, -delta, -delta) compare(control.currentIndex, 1) + compare(spy.count, 0) // no propagation mouseWheel(control, control.width / 2, control.height / 2, delta, delta) compare(control.currentIndex, 0) + compare(spy.count, 0) // no propagation // reached bounds -> no change mouseWheel(control, control.width / 2, control.height / 2, delta, delta) compare(control.currentIndex, 0) + compare(spy.count, 0) // no propagation } function test_activation_data() { diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml index 0712b82b..dbea7496 100644 --- a/tests/auto/controls/data/tst_popup.qml +++ b/tests/auto/controls/data/tst_popup.qml @@ -1341,4 +1341,39 @@ TestCase { // TODO: do this properly by creating a component or something applicationWindow.visible = false } + + Component { + id: shortcutWindowComponent + ApplicationWindow { + id: window + width: 360 + height: 360 + visible: true + + property alias popup: popup + + Popup { + id: popup + + Shortcut { + sequence: "Tab" + onActivated: popup.visible = !popup.visible + } + } + } + } + + function test_shortcut() { + // Tests that a Shortcut with Qt.WindowShortcut context + // that is declared within a Popup is activated. + var window = createTemporaryObject(shortcutWindowComponent, testCase) + var control = window.popup + + waitForRendering(window.contentItem) + keyClick(Qt.Key_Tab) + tryCompare(control, "visible", true) + + keyClick(Qt.Key_Tab) + tryCompare(control, "visible", false) + } } diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml index 9568da1a..47c19f40 100644 --- a/tests/auto/controls/data/tst_spinbox.qml +++ b/tests/auto/controls/data/tst_spinbox.qml @@ -71,6 +71,11 @@ TestCase { SpinBox { } } + Component { + id: mouseArea + MouseArea { } + } + function test_defaults() { var control = createTemporaryObject(spinBox, testCase) verify(control) @@ -401,7 +406,10 @@ TestCase { } function test_wheel(data) { - var control = createTemporaryObject(spinBox, testCase, {wrap: data.wrap, from: data.from, to: data.to, value: data.value, stepSize: data.stepSize, wheelEnabled: true}) + var ma = createTemporaryObject(mouseArea, testCase, {width: 100, height: 100}) + verify(ma) + + var control = spinBox.createObject(ma, {wrap: data.wrap, from: data.from, to: data.to, value: data.value, stepSize: data.stepSize, wheelEnabled: true}) verify(control) var valueModifiedCount = 0 @@ -410,13 +418,16 @@ TestCase { var delta = 120 + var spy = signalSpy.createObject(ma, {target: ma, signalName: "wheel"}) + verify(spy.valid) + for (var u = 0; u < data.upSteps.length; ++u) { var wasUpEnabled = control.wrap || control.value < control.to mouseWheel(control, control.width / 2, control.height / 2, delta, delta) if (wasUpEnabled) ++valueModifiedCount compare(valueModifiedSpy.count, valueModifiedCount) - + compare(spy.count, 0) // no propagation compare(control.value, data.upSteps[u]) } @@ -426,7 +437,7 @@ TestCase { if (wasDownEnabled) ++valueModifiedCount compare(valueModifiedSpy.count, valueModifiedCount) - + compare(spy.count, 0) // no propagation compare(control.value, data.downSteps[d]) } } diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml index 3c0f0273..3827354b 100644 --- a/tests/auto/controls/data/tst_stackview.qml +++ b/tests/auto/controls/data/tst_stackview.qml @@ -1230,4 +1230,19 @@ TestCase { touch.release(0, control).commit() verify(!ma.pressed) } + + // Separate function to ensure that the temporary value created to hold the return value of the Qt.createComponent() + // call is out of scope when the caller calls gc(). + function stackViewFactory() + { + return createTemporaryObject(stackView, testCase, {initialItem: Qt.createComponent("TestItem.qml")}) + } + + function test_initalItemOwnership() + { + var control = stackViewFactory() + verify(control) + gc() + verify(control.initialItem) + } } diff --git a/tests/auto/customization/tst_customization.cpp b/tests/auto/customization/tst_customization.cpp index 91646653..41efc2a6 100644 --- a/tests/auto/customization/tst_customization.cpp +++ b/tests/auto/customization/tst_customization.cpp @@ -180,7 +180,9 @@ extern "C" Q_DECL_EXPORT void qt_addQObject(QObject *object) QString oldObjectName = qt_objectNames()->value(object); if (!oldObjectName.isEmpty()) qt_createdQObjects()->removeOne(oldObjectName); - if (!objectName.isEmpty()) { + // Only track object names from our QML files, + // not e.g. contentItem object names (like "ApplicationWindow"). + if (objectName.contains("-")) { qt_createdQObjects()->append(objectName); qt_objectNames()->insert(object, objectName); } |