aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_pageindicator.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-30 16:40:07 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-11-02 09:29:59 +0000
commit2ee0e8770bf43182aae7fd4420e7bd986ecdd68e (patch)
tree0b3fed6ecf9e17f42c8c0bedb338bce724369c50 /tests/auto/controls/data/tst_pageindicator.qml
parent304cf22b96092df1953faf584c2822e958ca40c1 (diff)
Improve the hit testing of an interactive PageIndicator
The Universal style has relatively large spacing between the dots. The small dots are hard to hit => select the nearest dot. Change-Id: I2207e887706be38c1a6091bd8aca13d26b9957a8 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/auto/controls/data/tst_pageindicator.qml')
-rw-r--r--tests/auto/controls/data/tst_pageindicator.qml18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_pageindicator.qml b/tests/auto/controls/data/tst_pageindicator.qml
index 3a37aa25..11b2ec31 100644
--- a/tests/auto/controls/data/tst_pageindicator.qml
+++ b/tests/auto/controls/data/tst_pageindicator.qml
@@ -93,6 +93,24 @@ TestCase {
mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.currentIndex, 2)
+ // test also clicking outside delegates => the nearest should be selected
+ control.padding = 10
+ control.spacing = 10
+
+ 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)
+ mouseClick(control, pos.x, pos.y, Qt.LeftButton)
+ compare(control.currentIndex, i)
+ }
+ }
+ }
+
control.destroy()
}
}