diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-08-01 11:24:18 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2016-08-02 12:49:59 +0000 |
commit | 1b7b2d7ddb6a02fd2ccd1f29a431005b9e693723 (patch) | |
tree | 8b2835ae856604c7f54d02333f70cbcb35c0f172 /tests/auto/controls/data/tst_swipedelegate.qml | |
parent | e336afdb67d572087dda352b485ac309756639af (diff) |
SwipeDelegate: warn about horizontally anchoring background/contentItem
SwipeDelegate must have control over the x positions of these items in
order to move them during swipes.
Task-number: QTBUG-55040
Change-Id: Ie1e91fa4705cffe7573205279feff9bab048acd5
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_swipedelegate.qml')
-rw-r--r-- | tests/auto/controls/data/tst_swipedelegate.qml | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml index c6afd89e..a7c084bd 100644 --- a/tests/auto/controls/data/tst_swipedelegate.qml +++ b/tests/auto/controls/data/tst_swipedelegate.qml @@ -952,4 +952,85 @@ TestCase { control.destroy(); } + + Component { + id: backgroundFillComponent + SwipeDelegate { + background: Item { anchors.fill: parent } + } + } + + Component { + id: backgroundCenterInComponent + SwipeDelegate { + background: Item { anchors.centerIn: parent } + } + } + + Component { + id: backgroundLeftComponent + SwipeDelegate { + background: Item { anchors.left: parent.left } + } + } + + Component { + id: backgroundRightComponent + SwipeDelegate { + background: Item { anchors.right: parent.right } + } + } + + Component { + id: contentItemFillComponent + SwipeDelegate { + contentItem: Item { anchors.fill: parent } + } + } + + Component { + id: contentItemCenterInComponent + SwipeDelegate { + contentItem: Item { anchors.centerIn: parent } + } + } + + Component { + id: contentItemLeftComponent + SwipeDelegate { + contentItem: Item { anchors.left: parent.left } + } + } + + Component { + id: contentItemRightComponent + SwipeDelegate { + contentItem: Item { anchors.right: parent.right } + } + } + + function test_horizontalAnchors_data() { + return [ + { tag: "background, fill", component: backgroundFillComponent, itemName: "background", warningLocation: ":959:25" }, + { tag: "background, centerIn", component: backgroundCenterInComponent, itemName: "background", warningLocation: ":966:25" }, + { tag: "background, left", component: backgroundLeftComponent, itemName: "background", warningLocation: ":973:25" }, + { tag: "background, right", component: backgroundRightComponent, itemName: "background", warningLocation: ":980:25" }, + { tag: "contentItem, fill", component: contentItemFillComponent, itemName: "contentItem", warningLocation: ":987:26" }, + { tag: "contentItem, centerIn", component: contentItemCenterInComponent, itemName: "contentItem", warningLocation: ":994:26" }, + { tag: "contentItem, left", component: contentItemLeftComponent, itemName: "contentItem", warningLocation: ":1001:26" }, + { tag: "contentItem, right", component: contentItemRightComponent, itemName: "contentItem", warningLocation: ":1008:26" } + ]; + } + + function test_horizontalAnchors(data) { + var warningMessage = Qt.resolvedUrl("tst_swipedelegate.qml") + data.warningLocation + + ": QML : SwipeDelegate: cannot use horizontal anchors with " + data.itemName + "; unable to layout the item." + + ignoreWarning(warningMessage); + + var control = data.component.createObject(testCase); + verify(control.contentItem); + + control.destroy(); + } } |