aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-10-22 22:18:32 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-10-22 22:20:46 +0200
commitd1990ff285a8a265fc41d193179ce8fb6746f7b3 (patch)
treed4e78a873de079a04d2b4d64d81e4a4af84b3ae7 /tests/auto
parent309170a7f97759aa3f2e25a6c5202a6438a8bf4f (diff)
parent53c4bc2d1004fe963759b4009508bbc3e3fbca3e (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/controls/data/tst_container.qml30
-rw-r--r--tests/auto/controls/data/tst_pageindicator.qml36
-rw-r--r--tests/auto/controls/data/tst_tooltip.qml31
3 files changed, 82 insertions, 15 deletions
diff --git a/tests/auto/controls/data/tst_container.qml b/tests/auto/controls/data/tst_container.qml
index 94f22ad2..c5e74eeb 100644
--- a/tests/auto/controls/data/tst_container.qml
+++ b/tests/auto/controls/data/tst_container.qml
@@ -128,7 +128,7 @@ TestCase {
}
Component {
- id: repeaterContainer
+ id: repeaterContainer1
Container {
id: container
Item { objectName: "0" }
@@ -143,9 +143,33 @@ TestCase {
}
}
+ Component {
+ id: repeaterContainer2
+ Container {
+ id: container
+ contentItem: Item {
+ Repeater {
+ model: container.contentModel
+ }
+ Rectangle { objectName: "extra" }
+ }
+ Rectangle { objectName: "0" }
+ Rectangle { objectName: "1" }
+ Rectangle { objectName: "2" }
+ Rectangle { objectName: "3" }
+ }
+ }
+
+ function test_repeater_data() {
+ return [
+ { tag: "1", component: repeaterContainer1 },
+ { tag: "2", component: repeaterContainer2 }
+ ]
+ }
+
// don't crash (QTBUG-61310)
- function test_repeater() {
- var control = createTemporaryObject(repeaterContainer)
+ function test_repeater(data) {
+ var control = createTemporaryObject(data.component)
verify(control)
compare(control.itemAt(0).objectName, "0")
diff --git a/tests/auto/controls/data/tst_pageindicator.qml b/tests/auto/controls/data/tst_pageindicator.qml
index f3151882..dc411e45 100644
--- a/tests/auto/controls/data/tst_pageindicator.qml
+++ b/tests/auto/controls/data/tst_pageindicator.qml
@@ -122,18 +122,30 @@ TestCase {
// test also clicking outside delegates => the nearest should be selected
for (var i = 0; i < control.count; ++i) {
var child = control.contentItem.children[i]
- for (var x = -2; x <= child.width + 2; ++x) {
- for (var y = -2; y <= child.height + 2; ++y) {
- control.currentIndex = -1
- compare(control.currentIndex, -1)
-
- var pos = control.mapFromItem(child, x, y)
- 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)
- }
+
+ var points = [
+ Qt.point(child.width / 2, -2), // top
+ Qt.point(-2, child.height / 2), // left
+ Qt.point(child.width + 2, child.height / 2), // right
+ Qt.point(child.width / 2, child.height + 2), // bottom
+
+ Qt.point(-2, -2), // top-left
+ Qt.point(child.width + 2, -2), // top-right
+ Qt.point(-2, child.height + 2), // bottom-left
+ Qt.point(child.width + 2, child.height + 2), // bottom-right
+ ]
+
+ for (var j = 0; j < points.length; ++j) {
+ control.currentIndex = -1
+ compare(control.currentIndex, -1)
+
+ var point = points[j]
+ var pos = control.mapFromItem(child, x, y)
+ 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)
}
}
}
diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml
index bd46fabd..e7cc6787 100644
--- a/tests/auto/controls/data/tst_tooltip.qml
+++ b/tests/auto/controls/data/tst_tooltip.qml
@@ -298,4 +298,35 @@ TestCase {
keyPress(Qt.Key_A)
compare(shortcutActivatedSpy.count, 1)
}
+
+ Component {
+ id: hoverComponent
+ MouseArea {
+ id: hoverArea
+ property alias tooltip: tooltip
+ hoverEnabled: true
+ width: testCase.width
+ height: testCase.height
+ ToolTip {
+ id: tooltip
+ x: 10; y: 10
+ width: 10; height: 10
+ visible: hoverArea.containsMouse
+ }
+ }
+ }
+
+ // QTBUG-63644
+ function test_hover() {
+ var root = createTemporaryObject(hoverComponent, testCase)
+ verify(root)
+
+ var tooltip = root.tooltip
+ verify(tooltip)
+
+ for (var pos = 0; pos <= 25; pos += 5) {
+ mouseMove(root, pos, pos)
+ verify(tooltip.visible)
+ }
+ }
}