diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-10-19 11:52:42 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2021-01-06 15:03:57 +0100 |
commit | df33c79fb6579f94498164531777320e79c36fd5 (patch) | |
tree | 57a25f33d5cdcdbcbce6dceba5604a40cab76226 /tests/auto | |
parent | 3a719ff09177157439e9f6461f860dd9bb536649 (diff) |
Reset the opacity and scale properties after the exit transition
By resetting the opacity and scale properties after an exit transition
we are ensuring that it does not lose the original values that the user
may have set.
[ChangeLog][Important Behavior Changes][Popup] After the exit
transition is finished, then the opacity and scale properties will
be reset to their values before the enter transition is started.
Pick-to: 5.15
Fixes: QTBUG-87283
Change-Id: I2b192c96eaea2906d968341255e80cd19be177e6
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 4755c92b..81955e3f 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -948,6 +948,56 @@ TestCase { tryCompare(control.popup, "visible", false) } + Component { + id: reopenCombo + Window { + property alias innerCombo: innerCombo + visible: true + width: 300 + height: 300 + ComboBox { + id: innerCombo + model: 10 + anchors.verticalCenter: parent.verticalCenter + } + } + } + + // This test checks that when reopening the combobox that it is still appears at the same y position as + // previously + function test_reopen_popup() { + var control = createTemporaryObject(reopenCombo, testCase) + verify(control) + var y = 0; + for (var i = 0; i < 2; ++i) { + tryCompare(control.innerCombo.popup, "visible", false) + control.innerCombo.y = control.height - (control.innerCombo.popup.contentItem.height * 0.99) + var popupYSpy = createTemporaryObject(signalSpy, testCase, {target: control.innerCombo.popup, signalName: "yChanged"}) + verify(popupYSpy.valid) + mousePress(control.innerCombo) + compare(control.innerCombo.pressed, true) + compare(control.innerCombo.popup.visible, false) + mouseRelease(control.innerCombo) + compare(control.innerCombo.pressed, false) + compare(control.innerCombo.popup.visible, true) + if (control.innerCombo.popup.enter) + tryCompare(control.innerCombo.popup.enter, "running", false) + // Check on the second opening that it has the same y position as before + if (i !== 0) { + // y should not have changed again + verify(popupYSpy.count === 0) + verify(y === control.innerCombo.popup.y) + } else { + // In some cases on the initial show, y changes more than once + verify(popupYSpy.count >= 1) + y = control.innerCombo.popup.y + mouseClick(control.innerCombo) + compare(control.innerCombo.pressed, false) + tryCompare(control.innerCombo.popup, "visible", false) + } + } + } + function test_mouse() { var control = createTemporaryObject(comboBox, testCase, {model: 3, hoverEnabled: false}) verify(control) |