aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_tumbler.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-01-18 13:36:26 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2018-01-18 13:36:26 +0100
commitdeb779cdbaeeaea52ca0e99c9295db587c25f41c (patch)
tree82765e08678818ed21a6f9d5354ac852b0613460 /tests/auto/controls/data/tst_tumbler.qml
parent26056b52b182b4452855f54a2c811d64246c434a (diff)
parentd64774add9fafa24406a202d0313e10780e1e715 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/imports/controls/Tumbler.qml src/quicktemplates2/qquicktumbler.cpp src/quicktemplates2/qquicktumbler_p.h src/quicktemplates2/qquicktumbler_p_p.h Change-Id: I8d50991183fe3c5b50a49e00f01bcd3049f5346c
Diffstat (limited to 'tests/auto/controls/data/tst_tumbler.qml')
-rw-r--r--tests/auto/controls/data/tst_tumbler.qml21
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml
index fbcb2c40..03908566 100644
--- a/tests/auto/controls/data/tst_tumbler.qml
+++ b/tests/auto/controls/data/tst_tumbler.qml
@@ -289,11 +289,10 @@ TestCase {
compare(tumblerView.currentIndex, data.currentIndex);
compare(tumblerView.currentItem.text, data.currentIndex.toString());
- var fuzz = 1;
if (data.wrap) {
- fuzzyCompare(tumblerView.offset, data.currentIndex > 0 ? tumblerView.count - data.currentIndex : 0, fuzz);
+ tryCompare(tumblerView, "offset", data.currentIndex > 0 ? tumblerView.count - data.currentIndex : 0);
} else {
- fuzzyCompare(tumblerView.contentY, tumblerDelegateHeight * data.currentIndex - tumblerView.preferredHighlightBegin, fuzz);
+ tryCompare(tumblerView, "contentY", tumblerDelegateHeight * data.currentIndex - tumblerView.preferredHighlightBegin);
}
}
@@ -682,6 +681,17 @@ TestCase {
compare(tumbler.currentIndex, 3);
}
+ function findFirstDelegateWithText(view, text) {
+ var delegate = null;
+ var contentItem = view.hasOwnProperty("contentItem") ? view.contentItem : view;
+ for (var i = 0; i < contentItem.children.length && !delegate; ++i) {
+ var child = contentItem.children[i];
+ if (child.hasOwnProperty("text") && child.text === text)
+ delegate = child;
+ }
+ return delegate;
+ }
+
function test_customContentItemAfterConstruction_data() {
return [
{ tag: "ListView", componentPath: "TumblerListView.qml" },
@@ -707,6 +717,11 @@ TestCase {
tumblerView = findView(tumbler);
compare(tumblerView.currentIndex, 2);
+ var delegate = findFirstDelegateWithText(tumblerView, "Custom2");
+ verify(delegate);
+ compare(delegate.height, defaultImplicitDelegateHeight);
+ tryCompare(delegate.Tumbler, "displacement", 0);
+
tumblerView.incrementCurrentIndex();
compare(tumblerView.currentIndex, 3);
compare(tumbler.currentIndex, 3);