aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-07-11 12:06:15 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-07-11 12:57:13 +0200
commitd2d0e08e584c780b4b70a37e7b39c6bbcc7bc63e (patch)
tree22582b82dd5bb370205aa66302fb238bf5edaa6e /tests/auto/controls
parentc3431db7a3eb6b0c6e325e2d1e16eb6def9a4b4d (diff)
parent744164e6c92cb721d2a339cee8c465e1685723f9 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: .qmake.conf tests/auto/controls/data/tst_scrollindicator.qml Change-Id: I1f5581ae7814c0d4152e4c9b79a30a8af5a3a17b
Diffstat (limited to 'tests/auto/controls')
-rw-r--r--tests/auto/controls/data/TumblerDatePicker.qml1
-rw-r--r--tests/auto/controls/data/tst_busyindicator.qml27
-rw-r--r--tests/auto/controls/data/tst_drawer.qml10
-rw-r--r--tests/auto/controls/data/tst_pageindicator.qml62
-rw-r--r--tests/auto/controls/data/tst_scrollindicator.qml27
-rw-r--r--tests/auto/controls/data/tst_tumbler.qml39
6 files changed, 161 insertions, 5 deletions
diff --git a/tests/auto/controls/data/TumblerDatePicker.qml b/tests/auto/controls/data/TumblerDatePicker.qml
index ac04284a..72e57bed 100644
--- a/tests/auto/controls/data/TumblerDatePicker.qml
+++ b/tests/auto/controls/data/TumblerDatePicker.qml
@@ -87,6 +87,7 @@ Row {
id: yearTumbler
objectName: "yearTumbler"
model: ListModel {
+ objectName: "yearTumblerListModel"
Component.onCompleted: {
for (var i = 2000; i < 2100; ++i) {
append({value: i.toString()});
diff --git a/tests/auto/controls/data/tst_busyindicator.qml b/tests/auto/controls/data/tst_busyindicator.qml
index 77a2d5ba..3de8c795 100644
--- a/tests/auto/controls/data/tst_busyindicator.qml
+++ b/tests/auto/controls/data/tst_busyindicator.qml
@@ -65,6 +65,11 @@ TestCase {
BusyIndicator { }
}
+ Component {
+ id: mouseArea
+ MouseArea { }
+ }
+
function test_running() {
var control = createTemporaryObject(busyIndicator, testCase)
verify(control)
@@ -73,4 +78,26 @@ TestCase {
control.running = false
compare(control.running, false)
}
+
+ // QTBUG-61785
+ function test_mouseArea() {
+ var ma = createTemporaryObject(mouseArea, testCase, {width: testCase.width, height: testCase.height})
+ verify(ma)
+
+ var control = busyIndicator.createObject(ma, {width: testCase.width, height: testCase.height})
+ verify(control)
+
+ mousePress(control)
+ verify(ma.pressed)
+
+ mouseRelease(control)
+ verify(!ma.pressed)
+
+ var touch = touchEvent(control)
+ touch.press(0, control).commit()
+ verify(ma.pressed)
+
+ touch.release(0, control).commit()
+ verify(!ma.pressed)
+ }
}
diff --git a/tests/auto/controls/data/tst_drawer.qml b/tests/auto/controls/data/tst_drawer.qml
index 617e7677..5446b969 100644
--- a/tests/auto/controls/data/tst_drawer.qml
+++ b/tests/auto/controls/data/tst_drawer.qml
@@ -73,6 +73,16 @@ TestCase {
compare(control.parent, Overlay.overlay)
}
+ function test_invalidEdge() {
+ var control = createTemporaryObject(drawer, testCase)
+ compare(control.edge, Qt.LeftEdge)
+
+ // Test an invalid value - it should warn and ignore it.
+ ignoreWarning(Qt.resolvedUrl("tst_drawer.qml") + ":65:9: QML Drawer: invalid edge value - valid values are: Qt.TopEdge, Qt.LeftEdge, Qt.RightEdge, Qt.BottomEdge")
+ control.edge = Drawer.Right
+ compare(control.edge, Qt.LeftEdge)
+ }
+
Component {
id: rectDrawer
diff --git a/tests/auto/controls/data/tst_pageindicator.qml b/tests/auto/controls/data/tst_pageindicator.qml
index 86c0bd8b..70813cb8 100644
--- a/tests/auto/controls/data/tst_pageindicator.qml
+++ b/tests/auto/controls/data/tst_pageindicator.qml
@@ -65,6 +65,11 @@ TestCase {
PageIndicator { }
}
+ Component {
+ id: mouseArea
+ MouseArea { }
+ }
+
function test_count() {
var control = createTemporaryObject(pageIndicator, testCase)
verify(control)
@@ -83,20 +88,35 @@ TestCase {
compare(control.currentIndex, 5)
}
- function test_interactive() {
+ function test_interactive_data() {
+ return [
+ { tag: "mouse", touch: false },
+ { tag: "touch", touch: true }
+ ]
+ }
+
+ function test_interactive(data) {
var control = createTemporaryObject(pageIndicator, testCase, {count: 5, spacing: 10, padding: 10})
verify(control)
verify(!control.interactive)
compare(control.currentIndex, 0)
- mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton)
+ var touch = touchEvent(control)
+
+ if (data.touch)
+ touch.press(0, control).commit().release(0, control).commit()
+ else
+ mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.currentIndex, 0)
control.interactive = true
verify(control.interactive)
- mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton)
+ if (data.touch)
+ touch.press(0, control).commit().release(0, control).commit()
+ else
+ mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.currentIndex, 2)
// test also clicking outside delegates => the nearest should be selected
@@ -108,10 +128,44 @@ TestCase {
compare(control.currentIndex, -1)
var pos = control.mapFromItem(child, x, y)
- mouseClick(control, pos.x, pos.y, Qt.LeftButton)
+ if (data.touch)
+ touch.press(0, control, pos.x, pos.y).commit().release(0, control, pos.x, pos.y).commit()
+ else
+ mouseClick(control, pos.x, pos.y, Qt.LeftButton)
compare(control.currentIndex, i)
}
}
}
}
+
+ function test_mouseArea_data() {
+ return [
+ { tag: "interactive", interactive: true },
+ { tag: "non-interactive", interactive: false }
+ ]
+ }
+
+ // QTBUG-61785
+ function test_mouseArea(data) {
+ var ma = createTemporaryObject(mouseArea, testCase, {width: testCase.width, height: testCase.height})
+ verify(ma)
+
+ var control = pageIndicator.createObject(ma, {count: 5, interactive: data.interactive, width: testCase.width, height: testCase.height})
+ verify(control)
+
+ compare(control.interactive, data.interactive)
+
+ mousePress(control)
+ compare(ma.pressed, !data.interactive)
+
+ mouseRelease(control)
+ verify(!ma.pressed)
+
+ var touch = touchEvent(control)
+ touch.press(0, control).commit()
+ compare(ma.pressed, !data.interactive)
+
+ touch.release(0, control).commit()
+ verify(!ma.pressed)
+ }
}
diff --git a/tests/auto/controls/data/tst_scrollindicator.qml b/tests/auto/controls/data/tst_scrollindicator.qml
index 1e28c4f5..a6275f91 100644
--- a/tests/auto/controls/data/tst_scrollindicator.qml
+++ b/tests/auto/controls/data/tst_scrollindicator.qml
@@ -66,6 +66,11 @@ TestCase {
}
Component {
+ id: mouseArea
+ MouseArea { }
+ }
+
+ Component {
id: flickable
Flickable {
width: 100
@@ -231,4 +236,26 @@ TestCase {
compare(control.horizontal, true)
compare(control.vertical, false)
}
+
+ // QTBUG-61785
+ function test_mouseArea() {
+ var ma = createTemporaryObject(mouseArea, testCase, {width: testCase.width, height: testCase.height})
+ verify(ma)
+
+ var control = scrollIndicator.createObject(ma, {active: true, size: 0.9, width: testCase.width, height: testCase.height})
+ verify(control)
+
+ mousePress(control)
+ verify(ma.pressed)
+
+ mouseRelease(control)
+ verify(!ma.pressed)
+
+ var touch = touchEvent(control)
+ touch.press(0, control).commit()
+ verify(ma.pressed)
+
+ touch.release(0, control).commit()
+ verify(!ma.pressed)
+ }
}
diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml
index 00d13e23..aaf888c2 100644
--- a/tests/auto/controls/data/tst_tumbler.qml
+++ b/tests/auto/controls/data/tst_tumbler.qml
@@ -389,7 +389,7 @@ TestCase {
compare(tumbler.monthTumbler.currentIndex, 0);
compare(tumbler.monthTumbler.count, 12);
compare(tumbler.yearTumbler.currentIndex, 0);
- compare(tumbler.yearTumbler.count, 100);
+ tryCompare(tumbler.yearTumbler, "count", 100);
verify(findView(tumbler.dayTumbler).children.length >= tumbler.dayTumbler.visibleItemCount);
verify(findView(tumbler.monthTumbler).children.length >= tumbler.monthTumbler.visibleItemCount);
@@ -1057,4 +1057,41 @@ TestCase {
compare(tumbler.moving, true)
tryCompare(tumbler, "moving", false)
}
+
+ Component {
+ id: qtbug61374Component
+
+ Row {
+ property alias tumbler: tumbler
+ property alias label: label
+
+ Component.onCompleted: {
+ tumbler.currentIndex = 2
+ }
+
+ Tumbler {
+ id: tumbler
+ model: 5
+ // ...
+ }
+
+ Label {
+ id: label
+ text: tumbler.currentItem.text
+ }
+ }
+ }
+
+ function test_qtbug61374() {
+ var row = createTemporaryObject(qtbug61374Component, testCase);
+ verify(row);
+
+ var tumbler = row.tumbler;
+ tryCompare(tumbler, "currentIndex", 2);
+
+ tumblerView = findView(tumbler);
+
+ var label = row.label;
+ compare(label.text, "2");
+ }
}