[autotest] Fix ComboBox::test_font() for macOS style
macOS style does not support a different font than the default system font. Task-number: QTBUG-95678 Change-Id: Ib06118920e9cc6fcdc2af3ab34d76a4bc347a3d9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
c837be7bea
commit
fce8ba8e1a
|
@ -52,6 +52,7 @@ import QtQuick
|
|||
import QtQuick.Window
|
||||
import QtTest
|
||||
import QtQuick.Controls
|
||||
import QtQuick.NativeStyle as NativeStyle
|
||||
|
||||
TestCase {
|
||||
id: testCase
|
||||
|
@ -1255,9 +1256,14 @@ TestCase {
|
|||
verify(control.button)
|
||||
verify(control.combobox)
|
||||
|
||||
var macOSStyle = Qt.platform.pluginName === "cocoa"
|
||||
&& control.combobox.background instanceof NativeStyle.StyleItem
|
||||
var expectedComboBoxFontPixelSize = macOSStyle
|
||||
? control.combobox.background.styleFont(control.combobox).pixelSize
|
||||
: 30
|
||||
compare(control.font.pixelSize, 30)
|
||||
compare(control.button.font.pixelSize, 20)
|
||||
compare(control.combobox.font.pixelSize, 30)
|
||||
compare(control.combobox.font.pixelSize, expectedComboBoxFontPixelSize)
|
||||
|
||||
// verify(control.combobox.popup)
|
||||
// var popup = control.combobox.popup
|
||||
|
@ -1278,13 +1284,21 @@ TestCase {
|
|||
// compare(listview.contentItem.children[idx2].font.pixelSize, 25)
|
||||
|
||||
control.font.pixelSize = control.font.pixelSize + 10
|
||||
compare(control.combobox.font.pixelSize, 40)
|
||||
if (!macOSStyle) expectedComboBoxFontPixelSize += 10
|
||||
compare(control.combobox.font.pixelSize, expectedComboBoxFontPixelSize)
|
||||
// waitForRendering(listview)
|
||||
// compare(listview.contentItem.children[idx1].font.pixelSize, 25)
|
||||
// compare(listview.contentItem.children[idx2].font.pixelSize, 25)
|
||||
|
||||
control.combobox.font.pixelSize = control.combobox.font.pixelSize + 5
|
||||
compare(control.combobox.font.pixelSize, 45)
|
||||
if (!macOSStyle) {
|
||||
// We only support the default system font (and font size) on MacOS style.
|
||||
// Therefore, adjusting the font is not supported on MacOS style.
|
||||
// Current behavior is that the font property *is* changed, but it is not
|
||||
// guaranteed that the drawing will be correct.
|
||||
// However, this might change in the future, so we don't test it.
|
||||
compare(control.combobox.font.pixelSize, 45)
|
||||
}
|
||||
// waitForRendering(listview)
|
||||
|
||||
// idx1 = getChild(listview.contentItem, "delegate", -1)
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
# QTBUG-95678
|
||||
# Blacklisted in order to get the native macOS style under
|
||||
# regression control
|
||||
[ComboBox::test_font]
|
||||
*
|
||||
[ComboBox::test_popup]
|
||||
*
|
||||
[Popup::test_font]
|
||||
|
|
Loading…
Reference in New Issue