diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-07-15 16:21:46 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-07-15 16:23:25 +0200 |
commit | b55c1dd1e16f39a0e8b78571acc3f117c1f18d88 (patch) | |
tree | 03793fa0ccf9b08f0ecba768589b598a85562113 /tests/auto/controls/data/tst_swipedelegate.qml | |
parent | d9726cbd58fe9329dd450586ae51117f8ac054eb (diff) | |
parent | e9becf6931e9ff12b8912ddb79e4b2cbdd2d530a (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
src/quicktemplates2/qquickswipedelegate.cpp
tests/auto/controls/data/tst_swipedelegate.qml
tests/auto/controls/data/tst_textarea.qml
tests/auto/controls/data/tst_textfield.qml
Change-Id: I244f4ead4d14238c41db0bd965d7a2938f2ea8fc
Diffstat (limited to 'tests/auto/controls/data/tst_swipedelegate.qml')
-rw-r--r-- | tests/auto/controls/data/tst_swipedelegate.qml | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml index 4b71281f..17aab877 100644 --- a/tests/auto/controls/data/tst_swipedelegate.qml +++ b/tests/auto/controls/data/tst_swipedelegate.qml @@ -1119,4 +1119,46 @@ TestCase { listView.destroy(); } + + // When the width of a SwipeDelegate changes (as it does upon portrait => landscape + // rotation, for example), the positions of the contentItem and background items + // should be updated accordingly. + function test_contentItemPosOnWidthChanged() { + var control = swipeDelegateComponent.createObject(testCase); + verify(control); + + swipe(control, 0.0, 1.0); + + var oldContentItemX = control.contentItem.x; + var oldBackgroundX = control.background.x; + control.width += 100; + compare(control.contentItem.x, oldContentItemX + 100); + compare(control.background.x, oldBackgroundX + 100); + + control.destroy(); + } + + function test_contentItemHeightOnHeightChanged() { + var control = swipeDelegateComponent.createObject(testCase); + verify(control); + + // Try when swipe.complete is false. + var originalHeight = control.height; + var originalContentItemHeight = control.contentItem.height; + verify(control.height !== 10); + control.height = 10; + compare(control.contentItem.height, control.availableHeight); + verify(control.contentItem.height < originalContentItemHeight); + compare(control.contentItem.y, control.topPadding); + + // Try when swipe.complete is true. + control.height = originalHeight; + swipe(control, 0.0, 1.0); + control.height = 10; + compare(control.contentItem.height, control.availableHeight); + verify(control.contentItem.height < originalContentItemHeight); + compare(control.contentItem.y, control.topPadding); + + control.destroy(); + } } |