aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-10-19 14:41:45 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-10-19 13:43:29 +0000
commit882741541d0560c68cdabc9f24e61a13d3de2033 (patch)
tree855b088e2fc7c14e6f759933e381216147ed7a64
parent911d98ba6c151feb27b30a39fab9fc5f634332e7 (diff)
Speedup tst_pageindicator
test_interactive() was iterating the entire rectangle 2px around each indicator pixel by pixel and sending mouse clicks and touch presses + releases at each coordinate. This resulted to a total of 845 mouse clicks and 845 touch presses and releases. Select a few interesting coordinates to reduce it down to 40 mouse clicks and touch presses and releases. Change-Id: Ie3439aae8481e019956c49d2d82067dac8741b8f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--tests/auto/controls/data/tst_pageindicator.qml36
1 files changed, 24 insertions, 12 deletions
diff --git a/tests/auto/controls/data/tst_pageindicator.qml b/tests/auto/controls/data/tst_pageindicator.qml
index 70813cb8..191228f2 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)
}
}
}