diff options
Diffstat (limited to 'tests/auto/controls')
-rw-r--r-- | tests/auto/controls/data/tst_dialogbuttonbox.qml | 17 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_slider.qml | 57 |
2 files changed, 74 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml index 43153c94..62789a47 100644 --- a/tests/auto/controls/data/tst_dialogbuttonbox.qml +++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml @@ -275,4 +275,21 @@ TestCase { compare(okButton.width + cancelButton.width, control.availableWidth - control.spacing) } + + function test_oneButtonInFixedWidthBox() { + var control = createTemporaryObject(buttonBox, testCase, + { width: 400, standardButtons: Dialog.Close }) + verify(control) + + var listView = control.contentItem + waitForRendering(listView) + + var button = control.itemAt(0) + verify(button) + + // The button should never go outside of the box. + var buttonPosInBox = button.mapToItem(control, 0, 0) + verify(buttonPosInBox.x >= 0) + verify(buttonPosInBox.x + button.width < control.width) + } } diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml index 2b3144a5..280138c5 100644 --- a/tests/auto/controls/data/tst_slider.qml +++ b/tests/auto/controls/data/tst_slider.qml @@ -772,6 +772,63 @@ TestCase { compare(control.position, 0.25) } + function test_wheelPropagation_data() { + return [ + { tag: "horizontal", orientation: Qt.Horizontal, dx: 120, dy: 0 }, + { tag: "vertical", orientation: Qt.Vertical, dx: 0, dy: 120 } + ] + } + + Component { + id: mouseAreaComponent + MouseArea {} + } + + function test_wheelPropagation(data) { + var mouseArea = createTemporaryObject(mouseAreaComponent, testCase, { width: parent.width, height: parent.height }) + verify(mouseArea) + + var mouseAreaWheelSpy = signalSpy.createObject(mouseArea, { target: mouseArea, signalName: "wheel" }) + verify(mouseAreaWheelSpy.valid) + + var control = createTemporaryObject(slider, mouseArea, + { wheelEnabled: true, orientation: data.orientation, stepSize: 1 }) + verify(control) + compare(control.value, 0.0) + + var movedCount = 0 + var movedSpy = signalSpy.createObject(control, { target: control, signalName: "moved" }) + verify(movedSpy.valid) + + // Scroll the handle to the edge. + mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy) + compare(control.value, 1.0) + compare(control.position, 1.0) + compare(movedSpy.count, ++movedCount) + compare(mouseAreaWheelSpy.count, 0) + + // Scroll again; the wheel event shouldn't go through to the MouseArea parent. + mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy) + compare(control.value, 1.0) + compare(control.position, 1.0) + compare(movedSpy.count, movedCount) + compare(mouseAreaWheelSpy.count, 0) + + // Scroll the handle to the other edge. + mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy) + compare(control.value, 0.0) + compare(control.position, 0.0) + compare(movedSpy.count, ++movedCount) + compare(mouseAreaWheelSpy.count, 0) + + // Scroll again; the wheel event shouldn't go through to the MouseArea parent. + mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy) + compare(control.value, 0.0) + compare(control.position, 0.0) + compare(movedSpy.count, movedCount) + compare(mouseAreaWheelSpy.count, 0) + } + function test_valueAt_data() { return [ { tag: "0.0..1.0", from: 0.0, to: 1.0, values: [0.0, 0.2, 0.5, 1.0] }, |