diff options
Diffstat (limited to 'tests/auto/quickcontrols/controls/data/tst_page.qml')
-rw-r--r-- | tests/auto/quickcontrols/controls/data/tst_page.qml | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/tests/auto/quickcontrols/controls/data/tst_page.qml b/tests/auto/quickcontrols/controls/data/tst_page.qml index ca816d963b..2396b30dff 100644 --- a/tests/auto/quickcontrols/controls/data/tst_page.qml +++ b/tests/auto/quickcontrols/controls/data/tst_page.qml @@ -1,5 +1,5 @@ // Copyright (C) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick import QtTest @@ -69,10 +69,12 @@ TestCase { ToolBar { } } - function test_defaults() { + function init() { failOnWarning(/.?/) + } - var control = createTemporaryObject(page, testCase) + function test_defaults() { + let control = createTemporaryObject(page, testCase) verify(control) verify(control.contentItem) @@ -81,9 +83,7 @@ TestCase { } function test_empty() { - failOnWarning(/.?/) - - var control = createTemporaryObject(page, testCase) + let control = createTemporaryObject(page, testCase) verify(control) verify(control.contentItem) @@ -94,7 +94,7 @@ TestCase { } function test_oneChild() { - var control = createTemporaryObject(oneChildPage, testCase) + let control = createTemporaryObject(oneChildPage, testCase) verify(control) compare(control.contentWidth, 100) @@ -106,7 +106,7 @@ TestCase { } function test_twoChildren() { - var control = createTemporaryObject(twoChildrenPage, testCase) + let control = createTemporaryObject(twoChildrenPage, testCase) verify(control) compare(control.contentWidth, 0) @@ -120,7 +120,7 @@ TestCase { } function test_contentItem() { - var control = createTemporaryObject(contentPage, testCase) + let control = createTemporaryObject(contentPage, testCase) verify(control) compare(control.contentWidth, 100) @@ -132,7 +132,7 @@ TestCase { } function test_layout() { - var control = createTemporaryObject(page, testCase, {width: 100, height: 100}) + let control = createTemporaryObject(page, testCase, {width: 100, height: 100}) verify(control) compare(control.width, 100) @@ -220,7 +220,7 @@ TestCase { } function test_spacing(data) { - var control = createTemporaryObject(page, testCase, {spacing: 20, width: 100, height: 100}) + let control = createTemporaryObject(page, testCase, {spacing: 20, width: 100, height: 100}) verify(control) control.contentItem.visible = data.content @@ -246,7 +246,7 @@ TestCase { } function test_headerFooter() { - var control = createTemporaryObject(headerFooterPage, testCase, {width: 100, height: 100}) + let control = createTemporaryObject(headerFooterPage, testCase, {width: 100, height: 100}) verify(control) compare(control.width, 100) @@ -268,5 +268,18 @@ TestCase { compare(control.contentItem.y, control.header.height) compare(control.contentItem.width, control.width) compare(control.contentItem.height, control.height - control.header.height - control.footer.height) + + // swap places and make sure geometry is updated correctly + const oldHeader = control.header + const oldFooter = control.footer + // reset both first, so one item does not end up in two places at once + control.header = null + control.footer = null + control.header = oldFooter + control.footer = oldHeader + verify(control.header.visible) + verify(control.footer.visible) + compare(control.header.y, 0) + compare(control.footer.y, control.height - control.footer.height) } } |