aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-09-29 16:34:48 +0200
committerMitch Curtis <mitch.curtis@qt.io>2016-09-30 08:09:20 +0000
commit7433cc2f91d1aba045ab4920d6732c85d2ee33b9 (patch)
treedb2cec7ab252addc0645ac964a77edb7359bce85 /tests
parent5d2c242d2d3fd6af724514ee00a6440864be0ade (diff)
Fix crash when flicking a ListView-based Tumbler
This only happens in 5.7, and seemingly only when the delegate uses attached properties (like displacement). Other fixes required and/or relevant to the patch: - Fixed some instances of displacementChanged possibly not being emitted. - Use QPointer for the attached object's Tumbler pointer, as it was being accessed while null after this patch. Change-Id: I7d881d815faf57f1a8bc0ea8e73a7331523d2f9b Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_tumbler.qml45
1 files changed, 44 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml
index 22cde065..401f7537 100644
--- a/tests/auto/controls/data/tst_tumbler.qml
+++ b/tests/auto/controls/data/tst_tumbler.qml
@@ -63,7 +63,8 @@ TestCase {
}
function cleanup() {
- tumbler.destroy();
+ if (tumbler)
+ tumbler.destroy();
}
function tumblerXCenter() {
@@ -234,6 +235,48 @@ TestCase {
tryCompare(tumbler.dayTumbler, "currentIndex", 27);
}
+ Component {
+ id: timePickerComponent
+
+ Row {
+ property alias minuteTumbler: minuteTumbler
+ property alias amPmTumbler: amPmTumbler
+
+ Tumbler {
+ id: minuteTumbler
+ currentIndex: 6
+ model: 60
+ width: 50
+ height: 150
+ }
+
+ Tumbler {
+ id: amPmTumbler
+ model: ["AM", "PM"]
+ width: 50
+ height: 150
+ contentItem: ListView {
+ anchors.fill: parent
+ model: amPmTumbler.model
+ delegate: amPmTumbler.delegate
+ }
+ }
+ }
+ }
+
+ function test_listViewTimePicker() {
+ tumbler.destroy();
+
+ var root = timePickerComponent.createObject(testCase);
+ verify(root);
+
+ mouseDrag(root.minuteTumbler, root.minuteTumbler.width / 2, root.minuteTumbler.height / 2, 0, 50);
+ // Shouldn't crash.
+ mouseDrag(root.amPmTumbler, root.amPmTumbler.width / 2, root.amPmTumbler.height / 2, 0, 50);
+
+ root.destroy();
+ }
+
function test_displacement_data() {
var data = [
// At 0 offset, the first item is current.