diff options
| author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2026-03-25 14:26:30 +0100 |
|---|---|---|
| committer | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2026-05-13 22:08:26 +0000 |
| commit | 7ed797e35fa91f0c25b1f1c4bfac1adfbc2c2f2a (patch) | |
| tree | 1ee08cf083d03140fe515b5390e4e47f32bbf2cd /tests | |
| parent | 8f00abd0ded163ccd2b64a5cbbf6019fc0bd835e (diff) | |
The ComboBox popup wasn't implemented in the style, and would instead
fall back to the DefaultComboBox implementation, which didn't look
native.
Make it look more native by giving it its own customized popup.
The macos/MenuItem.qml implementation can be reused for the combobox
delegate, since menus and combobox popups look pretty much identical on
the platform.
ComboBox::test_popup is poorly implemented for popups with popupType:
Popup.Window. Skip some of the testing when insets are negative.
Pick-to: 6.11 6.8
Fixes: QTBUG-145217
Change-Id: I96885177cf419d235e5ab461b0af607148e0e376
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/auto/quickcontrols/controls/data/tst_combobox.qml | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/auto/quickcontrols/controls/data/tst_combobox.qml b/tests/auto/quickcontrols/controls/data/tst_combobox.qml index dc886c6e73..0f274ccad2 100644 --- a/tests/auto/quickcontrols/controls/data/tst_combobox.qml +++ b/tests/auto/quickcontrols/controls/data/tst_combobox.qml @@ -966,8 +966,10 @@ TestCase { if(control.popup.popupType === Popup.Item) { compare(control.popup.contentItem.parent.x, -control.width / 2 + leftLayoutMargin) } else if (control.popup.popupType === Popup.Window) { - const x = control.popup.contentItem.parent.mapToGlobal(0, 0).x - compare(x - prevX, -control.width / 2 + leftLayoutMargin) + if (control.popup.leftInset >= 0) { + const x = control.popup.contentItem.parent.mapToGlobal(0, 0).x + compare(x - prevX, -control.width / 2 + leftLayoutMargin) + } } control.x = testCase.width - control.width / 2 @@ -976,8 +978,10 @@ TestCase { if (control.popup.popupType === Popup.Item) { compare(control.popup.contentItem.parent.x, testCase.width - control.width / 2 + leftLayoutMargin) } else if (control.popup.popupType === Popup.Window) { - const x = control.popup.contentItem.parent.mapToGlobal(0, 0).x - compare(x - prevX, testCase.width - control.width / 2 + leftLayoutMargin) + if (control.popup.leftInset >= 0) { + const x = control.popup.contentItem.parent.mapToGlobal(0, 0).x + compare(x - prevX, testCase.width - control.width / 2 + leftLayoutMargin) + } } // close the popup when hidden (QTBUG-67684) @@ -1008,6 +1012,7 @@ TestCase { let control = createTemporaryObject(reopenCombo, testCase) verify(control) let y = 0; + control.innerCombo.popup.popupType = Popup.Item for (let i = 0; i < 2; ++i) { tryCompare(control.innerCombo.popup, "visible", false) control.innerCombo.y = control.height - (control.innerCombo.popup.contentItem.height * 0.99) @@ -1109,6 +1114,8 @@ TestCase { let highlightedSpy = signalSpy.createObject(control, {target: control, signalName: "highlighted"}) verify(highlightedSpy.valid) + control.popup.popupType = Popup.Item + touch.press(0, control).commit() touch.release(0, control).commit() compare(control.popup.visible, true) @@ -1219,6 +1226,8 @@ TestCase { let closedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "closed"}) verify(openedSpy.valid) + control.popup.popupType = Popup.Item + // click - gain focus - show popup mouseClick(control) verify(control.activeFocus) |
