diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-10-31 16:08:59 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-10-31 16:08:59 +0100 |
commit | f7fd7460231ea9ad80fc85b4af793ad7ace56930 (patch) | |
tree | 2155c9399945b4ebe0b9af84da75b478afb30683 /tests/auto | |
parent | f4b2f9eeac7f9175a5834f405ad88fb6d28864e1 (diff) | |
parent | 10972ca272ae59fbe0f18eef6d9237fbd4aaca86 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
src/quicktemplates2/qquickpopup.cpp
src/quicktemplates2/qquickpopup_p_p.h
Change-Id: I33241dfd15a320e6ae2f0c056252b0ec6be7c6f6
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controls/data/tst_dialog.qml | 97 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_page.qml | 40 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_popup.qml | 31 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_scrollbar.qml | 16 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_scrollindicator.qml | 16 | ||||
-rw-r--r-- | tests/auto/drawer/tst_drawer.cpp | 2 |
6 files changed, 155 insertions, 47 deletions
diff --git a/tests/auto/controls/data/tst_dialog.qml b/tests/auto/controls/data/tst_dialog.qml index d4cbc222..69c47fed 100644 --- a/tests/auto/controls/data/tst_dialog.qml +++ b/tests/auto/controls/data/tst_dialog.qml @@ -62,16 +62,6 @@ TestCase { } Component { - id: headerBox - DialogButtonBox { position: DialogButtonBox.Header } - } - - Component { - id: footerBox - DialogButtonBox { position: DialogButtonBox.Footer } - } - - Component { id: signalSpy SignalSpy { } } @@ -79,9 +69,8 @@ TestCase { function test_defaults() { var control = dialog.createObject(testCase) verify(control) - verify(!control.header) - verify(!control.footer) - verify(control.buttonBox) + verify(control.header) + verify(control.footer) compare(control.standardButtons, 0) control.destroy() } @@ -122,22 +111,18 @@ TestCase { function test_buttonBox_data() { return [ - { tag: "default header", property: "header", buttonBox: headerBox }, - { tag: "default footer", property: "footer", buttonBox: footerBox }, - { tag: "custom header", property: "header", position: DialogButtonBox.Header }, - { tag: "custom footer", property: "footer", position: DialogButtonBox.Footer } + { tag: "default" }, + { tag: "custom", custom: true } ] } function test_buttonBox(data) { var control = dialog.createObject(testCase) - if (data.buttonBox) - control.buttonBox = data.buttonBox - else - control[data.property] = buttonBox.createObject(testCase, {position: data.position}) + if (data.custom) + control.footer = buttonBox.createObject(testCase) control.standardButtons = Dialog.Ok | Dialog.Cancel - var box = control[data.property] + var box = control.footer verify(box) compare(box.standardButtons, Dialog.Ok | Dialog.Cancel) @@ -192,30 +177,6 @@ TestCase { control.destroy() } - function test_warnings() { - var control = dialog.createObject(testCase) - verify(control) - - var testComponent = Qt.createComponent("TestItem.qml") - verify(testComponent) - - control.buttonBox = headerBox - control.header = testComponent.createObject(testCase) - ignoreWarning(Qt.resolvedUrl("tst_dialog.qml") + ":56:9: QML Dialog: Custom header detected. Cannot assign buttonBox as a header. No standard buttons will appear in the header.") - control.standardButtons = Dialog.Apply - - control.buttonBox = footerBox - control.footer = testComponent.createObject(testCase) - ignoreWarning(Qt.resolvedUrl("tst_dialog.qml") + ":56:9: QML Dialog: Custom footer detected. Cannot assign buttonBox as a footer. No standard buttons will appear in the footer.") - control.standardButtons = Dialog.Cancel - - control.buttonBox = testComponent - ignoreWarning(Qt.resolvedUrl("tst_dialog.qml") + ":56:9: QML Dialog: buttonBox must be an instance of DialogButtonBox") - control.standardButtons = Dialog.Ok - - control.destroy() - } - function test_layout() { var control = dialog.createObject(testCase, {width: 100, height: 100}) verify(control) @@ -294,4 +255,48 @@ TestCase { control.destroy() } + + function test_spacing_data() { + return [ + { tag: "content", header: false, content: true, footer: false }, + { tag: "header,content", header: true, content: true, footer: false }, + { tag: "content,footer", header: false, content: true, footer: true }, + { tag: "header,content,footer", header: true, content: true, footer: true }, + { tag: "header,footer", header: true, content: false, footer: true }, + { tag: "header", header: true, content: false, footer: false }, + { tag: "footer", header: false, content: false, footer: true }, + ] + } + + function test_spacing(data) { + var control = dialog.createObject(testCase, {spacing: 20, width: 100, height: 100}) + verify(control) + + control.open() + waitForRendering(control.contentItem) + verify(control.visible) + + control.contentItem.visible = data.content + control.header = buttonBox.createObject(control.contentItem, {visible: data.header}) + control.footer = buttonBox.createObject(control.contentItem, {visible: data.footer}) + + compare(control.header.x, 0) + compare(control.header.y, 0) + compare(control.header.width, control.width) + verify(control.header.height > 0) + + compare(control.footer.x, 0) + compare(control.footer.y, control.height - control.footer.height) + compare(control.footer.width, control.width) + verify(control.footer.height > 0) + + compare(control.contentItem.x, control.leftPadding) + compare(control.contentItem.y, control.topPadding + (data.header ? control.header.height + control.spacing : 0)) + compare(control.contentItem.width, control.availableWidth) + compare(control.contentItem.height, control.availableHeight + - (data.header ? control.header.height + control.spacing : 0) + - (data.footer ? control.footer.height + control.spacing : 0)) + + control.destroy() + } } diff --git a/tests/auto/controls/data/tst_page.qml b/tests/auto/controls/data/tst_page.qml index a1cdbf8e..9b52236e 100644 --- a/tests/auto/controls/data/tst_page.qml +++ b/tests/auto/controls/data/tst_page.qml @@ -226,4 +226,44 @@ TestCase { control.destroy() } + + function test_spacing_data() { + return [ + { tag: "content", header: false, content: true, footer: false }, + { tag: "header,content", header: true, content: true, footer: false }, + { tag: "content,footer", header: false, content: true, footer: true }, + { tag: "header,content,footer", header: true, content: true, footer: true }, + { tag: "header,footer", header: true, content: false, footer: true }, + { tag: "header", header: true, content: false, footer: false }, + { tag: "footer", header: false, content: false, footer: true }, + ] + } + + function test_spacing(data) { + var control = page.createObject(testCase, {spacing: 20, width: 100, height: 100}) + verify(control) + + control.contentItem.visible = data.content + control.header = toolBar.createObject(control.contentItem, {visible: data.header}) + control.footer = toolBar.createObject(control.contentItem, {visible: data.footer}) + + compare(control.header.x, 0) + compare(control.header.y, 0) + compare(control.header.width, control.width) + verify(control.header.height > 0) + + compare(control.footer.x, 0) + compare(control.footer.y, control.height - control.footer.height) + compare(control.footer.width, control.width) + verify(control.footer.height > 0) + + compare(control.contentItem.x, control.leftPadding) + compare(control.contentItem.y, control.topPadding + (data.header ? control.header.height + control.spacing : 0)) + compare(control.contentItem.width, control.availableWidth) + compare(control.contentItem.height, control.availableHeight + - (data.header ? control.header.height + control.spacing : 0) + - (data.footer ? control.footer.height + control.spacing : 0)) + + control.destroy() + } } diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml index c81c6341..982ac7ab 100644 --- a/tests/auto/controls/data/tst_popup.qml +++ b/tests/auto/controls/data/tst_popup.qml @@ -1229,4 +1229,35 @@ TestCase { control.destroy() } + + Component { + id: xyBindingLoop + ApplicationWindow { + id: window + width: 360 + height: 360 + visible: true + property alias popup: popup + + Popup { + id: popup + visible: true + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + Label { + text: "Content" + anchors.fill: parent + } + } + } + } + + function test_xyBindingLoop() { + var window = xyBindingLoop.createObject(testCase) + var control = window.popup + waitForRendering(control.contentItem) + compare(control.x, (control.parent.width - control.width) / 2) + compare(control.y, (control.parent.height - control.height) / 2) + window.destroy() + } } diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml index 15b4b3f0..54ecf15f 100644 --- a/tests/auto/controls/data/tst_scrollbar.qml +++ b/tests/auto/controls/data/tst_scrollbar.qml @@ -155,6 +155,22 @@ TestCase { compare(horizontal.size, container.visibleArea.widthRatio) compare(horizontal.position, container.visibleArea.xPosition) + var oldY = vertical.y + var oldHeight = vertical.height + vertical.parent = testCase + vertical.y -= 10 + container.height += 10 + compare(vertical.y, oldY - 10) + compare(vertical.height, oldHeight) + + var oldX = horizontal.x + var oldWidth = horizontal.width + horizontal.parent = testCase + horizontal.x -= 10 + container.width += 10 + compare(horizontal.x, oldX - 10) + compare(horizontal.width, oldWidth) + container.destroy() } diff --git a/tests/auto/controls/data/tst_scrollindicator.qml b/tests/auto/controls/data/tst_scrollindicator.qml index 551247f6..1ec03b15 100644 --- a/tests/auto/controls/data/tst_scrollindicator.qml +++ b/tests/auto/controls/data/tst_scrollindicator.qml @@ -150,6 +150,22 @@ TestCase { compare(horizontal.size, container.visibleArea.widthRatio) compare(horizontal.position, container.visibleArea.xPosition) + var oldY = vertical.y + var oldHeight = vertical.height + vertical.parent = testCase + vertical.y -= 10 + container.height += 10 + compare(vertical.y, oldY - 10) + compare(vertical.height, oldHeight) + + var oldX = horizontal.x + var oldWidth = horizontal.width + horizontal.parent = testCase + horizontal.x -= 10 + container.width += 10 + compare(horizontal.x, oldX - 10) + compare(horizontal.width, oldWidth) + container.destroy() } diff --git a/tests/auto/drawer/tst_drawer.cpp b/tests/auto/drawer/tst_drawer.cpp index 58a5ba3c..a523beed 100644 --- a/tests/auto/drawer/tst_drawer.cpp +++ b/tests/auto/drawer/tst_drawer.cpp @@ -380,7 +380,7 @@ void tst_Drawer::reposition() window->setWidth(window->width() + 100); QTRY_COMPARE(geometry(dimmer), QRectF(0, 150, window->width(), window->height() - 150)); - QCOMPARE(geometry(popupItem), QRectF(window->width() - drawer->width(), 150, window->width() / 2, window->height() - 150)); + QTRY_COMPARE(geometry(popupItem), QRectF(window->width() - drawer->width(), 150, window->width() / 2, window->height() - 150)); drawer->close(); QTRY_COMPARE(geometry(popupItem), QRectF(window->width(), 150, window->width() / 2, window->height() - 150)); |