diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-20 22:43:14 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-20 22:43:14 +0100 |
commit | 205e714cf8dfba9327eaddbb52e03c1448bef047 (patch) | |
tree | eaefe818853c0980adc3965b2447ceed49e9e048 /tests | |
parent | f8fd551aa96fa83d4cad3b43b4c84aa04cce3e7a (diff) | |
parent | deb779cdbaeeaea52ca0e99c9295db587c25f41c (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: I61d779eb40e3a278aa2ef429e014d351da34f80a
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/TumblerListView.qml | 12 | ||||
-rw-r--r-- | tests/auto/controls/data/TumblerPathView.qml | 11 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_tumbler.qml | 21 | ||||
-rw-r--r-- | tests/auto/customization/tst_customization.cpp | 2 | ||||
-rw-r--r-- | tests/auto/sanity/BLACKLIST | 16 |
5 files changed, 37 insertions, 25 deletions
diff --git a/tests/auto/controls/data/TumblerListView.qml b/tests/auto/controls/data/TumblerListView.qml index 4e71f471..1248bec0 100644 --- a/tests/auto/controls/data/TumblerListView.qml +++ b/tests/auto/controls/data/TumblerListView.qml @@ -49,15 +49,21 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.2 ListView { anchors.fill: parent - model: parent.model - delegate: parent.delegate - snapMode: ListView.SnapToItem highlightRangeMode: ListView.StrictlyEnforceRange preferredHighlightBegin: height / 2 - (height / parent.visibleItemCount / 2) preferredHighlightEnd: height / 2 + (height / parent.visibleItemCount / 2) clip: true + model: parent.model + delegate: Text { + objectName: text + text: "Custom" + modelData + opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2) + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } } diff --git a/tests/auto/controls/data/TumblerPathView.qml b/tests/auto/controls/data/TumblerPathView.qml index 4f6f653f..7b7cd5f4 100644 --- a/tests/auto/controls/data/TumblerPathView.qml +++ b/tests/auto/controls/data/TumblerPathView.qml @@ -49,16 +49,23 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.2 PathView { id: pathView - model: parent.model - delegate: parent.delegate clip: true pathItemCount: parent.visibleItemCount + 1 preferredHighlightBegin: 0.5 preferredHighlightEnd: 0.5 dragMargin: width / 2 + model: parent.model + delegate: Text { + objectName: text + text: "Custom" + modelData + opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2) + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } path: Path { startX: pathView.width / 2 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); diff --git a/tests/auto/customization/tst_customization.cpp b/tests/auto/customization/tst_customization.cpp index cd939bcc..91b5706c 100644 --- a/tests/auto/customization/tst_customization.cpp +++ b/tests/auto/customization/tst_customization.cpp @@ -103,7 +103,7 @@ static const ControlInfo ControlInfos[] = { { "ToolButton", QStringList() << "background" << "contentItem" }, { "ToolSeparator", QStringList() << "background" << "contentItem" }, { "ToolTip", QStringList() << "background" << "contentItem" }, - // { "Tumbler", QStringList() << "background" << "contentItem" } ### TODO: fix and enable deferred execution + { "Tumbler", QStringList() << "background" << "contentItem" } }; class tst_customization : public QQmlDataTest diff --git a/tests/auto/sanity/BLACKLIST b/tests/auto/sanity/BLACKLIST index 94e4fd32..42ad3448 100644 --- a/tests/auto/sanity/BLACKLIST +++ b/tests/auto/sanity/BLACKLIST @@ -2,19 +2,3 @@ * [attachedObjects:material/SwitchDelegate.qml] * -[ids:imagine/BusyIndicator.qml] -* -[ids:imagine/DelayButton.qml] -* -[ids:imagine/GroupBox.qml] -* -[ids:imagine/ProgressBar.qml] -* -[ids:imagine/ProgressBar.qml] -* -[ids:imagine/SpinBox.qml] -* -[ids:imagine/Switch.qml] -* -[ids:imagine/SwitchDelegate.qml] -* |