diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-12-04 13:44:11 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-12-05 10:58:58 +0000 |
commit | c98f8abe34c526bbf66000567b8e1084a788b26b (patch) | |
tree | bfe628b0d943d325f62db81b8b4cadc5b5d26e77 /tests | |
parent | 64c44f392b3912849e5eb81a98eae60d11c6dddb (diff) |
SplitView: react to changes in implicit size of split items
Change-Id: Id81aac71f26ec9cbf643fdc480d76841d1e3be47
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_splitview.qml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_splitview.qml b/tests/auto/controls/data/tst_splitview.qml index 9fd5b855..8879c849 100644 --- a/tests/auto/controls/data/tst_splitview.qml +++ b/tests/auto/controls/data/tst_splitview.qml @@ -1179,6 +1179,60 @@ TestCase { compareSizes(control, data.expectedGeometries) } + function test_splitItemImplicitSizeChanges_data() { + var defaultSplitViewWidth = testCase.width + var defaultSplitViewHeight = testCase.height + + var data = [ + { + tag: "growImplicitWidth", + orientation: Qt.Horizontal, + splitItemImplicitWidth: 50, + expectedGeometries: [ + { x: 0, y: 0, width: 50, height: defaultSplitViewHeight }, + { x: 50, y: 0, width: defaultHorizontalHandleWidth, height: defaultSplitViewHeight }, + { x: 50 + defaultHorizontalHandleWidth, y: 0, width: 100, height: defaultSplitViewHeight }, + { x: 50 + 100 + defaultHorizontalHandleWidth, y: 0, width: defaultHorizontalHandleWidth, + height: defaultSplitViewHeight }, + { x: 50 + 100 + defaultHorizontalHandleWidth * 2, y: 0, + width: defaultSplitViewWidth - 50 - 100 - defaultHorizontalHandleWidth * 2, height: defaultSplitViewHeight } + ] + }, + { + tag: "growImplicitHeight", + orientation: Qt.Vertical, + splitItemImplicitHeight: 50, + expectedGeometries: [ + { x: 0, y: 0, width: defaultSplitViewWidth, height: 50 }, + { x: 0, y: 50, width: defaultSplitViewWidth, height: defaultVerticalHandleHeight }, + { x: 0, y: 50 + defaultVerticalHandleHeight, width: defaultSplitViewWidth, height: 100 }, + { x: 0, y: 50 + 100 + defaultVerticalHandleHeight, width: defaultSplitViewWidth, + height: defaultVerticalHandleHeight }, + { x: 0, y: 50 + 100 + defaultVerticalHandleHeight * 2, width: defaultSplitViewWidth, + height: defaultSplitViewHeight - 50 - 100 - defaultVerticalHandleHeight * 2 } + ] + } + ] + return data + } + + // Tests that implicitWidth/Height changes in items are noticed by SplitView. + function test_splitItemImplicitSizeChanges(data) { + var control = createTemporaryObject(threeSizedItemsComponent, testCase, + { "handle": handleComponent, "orientation": data.orientation }) + verify(control) + + var firstItem = control.itemAt(0) + + if (data.hasOwnProperty("splitItemImplicitWidth")) + firstItem.implicitWidth = data.splitItemImplicitWidth + + if (data.hasOwnProperty("splitItemImplicitHeight")) + firstItem.implicitHeight = data.splitItemImplicitHeight + + compareSizes(control, data.expectedGeometries) + } + Component { id: largerHandle Rectangle { |