aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-08-06 13:20:07 +0200
committerAndy Shaw <andy.shaw@qt.io>2020-08-17 10:53:15 +0200
commit64230bf97c18297f45bd5d7ccf99b510c8a612bd (patch)
tree8baf4aa3e4e19a7e2c39bad9004d3783a2a448c6 /tests
parent0ba45442f3f1102af73ec2666e4e5c24ed516331 (diff)
Get the scale of the popup item when setting the parent item
As there are some styles that will do an transition which animates the scale then we need to size and position based on the final scale it will have to avoid a jump after it has finished the transition. Pick-to: 5.15 Fixes: QTBUG-84488 Change-Id: I4571eb18c921e81de319838ac0e8d3fe3513d438 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_combobox.qml22
-rw-r--r--tests/auto/controls/data/tst_popup.qml3
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 7369f263..79ffa176 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -911,6 +911,28 @@ TestCase {
compare(control.popup.visible, true)
verify(control.popup.contentItem.y < control.y)
+
+ // Account for when a transition of a scale from 0.9-1.0 that it is placed above right away and not below
+ // first just because there is room at the 0.9 scale
+ if (control.popup.enter !== null) {
+ // hide
+ mouseClick(control)
+ compare(control.pressed, false)
+ tryCompare(control.popup, "visible", false)
+ control.y = control.Window.height - (control.popup.contentItem.height * 0.99)
+ var popupYSpy = createTemporaryObject(signalSpy, testCase, {target: control.popup, signalName: "yChanged"})
+ verify(popupYSpy.valid)
+ mousePress(control)
+ compare(control.pressed, true)
+ compare(control.popup.visible, false)
+ mouseRelease(control)
+ compare(control.pressed, false)
+ compare(control.popup.visible, true)
+ tryCompare(control.popup.enter, "running", false)
+ verify(control.popup.contentItem.y < control.y)
+ verify(popupYSpy.count === 1)
+ }
+
// follow the control outside the horizontal window bounds
control.x = -control.width / 2
compare(control.x, -control.width / 2)
diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml
index 0c6ab78a..11de3c83 100644
--- a/tests/auto/controls/data/tst_popup.qml
+++ b/tests/auto/controls/data/tst_popup.qml
@@ -1275,6 +1275,9 @@ TestCase {
{ visible: true, width: 100, height: 100 })
verify(control)
verify(control.visible)
+ // If there is a transition then make sure it is finished
+ if (control.enter !== null)
+ tryCompare(control.enter, "running", false)
compare(control.parent, control.Overlay.overlay)
compare(control.x, 0)
compare(control.y, 0)