aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_popup.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-20 16:23:57 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-21 21:39:27 +0000
commit8a4af9e87704f7b8ed269114d3ab75430bd61998 (patch)
tree31e825e3d439a2f5d789a2e6bfc5226771609e04 /tests/auto/controls/data/tst_popup.qml
parent29668bf3ebef803d67aa4e0bff8cc784149996a9 (diff)
QQuickPopup: fix negative margins
The documentation states: A popup with negative margins is not pushed within the bounds of the enclosing window. Therefore QQuickPopupPrivate::reposition() must not subtract negative margins to calculate the available bounds. Change-Id: I626772970bf3d5d9eefbb13811ea1003a85bcf0b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_popup.qml')
-rw-r--r--tests/auto/controls/data/tst_popup.qml24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml
index 919bfffc..ae1c7185 100644
--- a/tests/auto/controls/data/tst_popup.qml
+++ b/tests/auto/controls/data/tst_popup.qml
@@ -355,6 +355,30 @@ TestCase {
control.destroy()
}
+ function test_negativeMargins() {
+ var control = popupControl.createObject(testCase, {implicitWidth: testCase.width, implicitHeight: testCase.height})
+ verify(control)
+
+ control.open()
+ verify(control.visible)
+
+ compare(control.x, 0)
+ compare(control.y, 0)
+
+ compare(control.margins, -1)
+ compare(control.topMargin, -1)
+ compare(control.leftMargin, -1)
+ compare(control.rightMargin, -1)
+ compare(control.bottomMargin, -1)
+
+ control.x = -10
+ control.y = -10
+ compare(control.x, 0)
+ compare(control.y, 0)
+
+ control.destroy()
+ }
+
function test_margins() {
var control = popupControl.createObject(testCase, {width: 100, height: 100})
verify(control)