aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-04-30 11:01:44 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-04-30 14:24:49 +0200
commit885d065902422f82d474e6a8cae43e1b3e4d94d0 (patch)
tree3e219a1ccb5815d8683af8624f4d42fd38c69bce /tests
parent4c095c5ab452371a725f55602cf19203e1568393 (diff)
Expect failure for certain fonts in TextArea test
Change f761ad3cd9ad1252f24b76ae413298dc7bed8af3 in qtbase exposes a pre-existing difference in measuring the height of QTextLayouts versus QTextDocuments when the leading is large enough to impact the font height. See QTBUG-82954 for details on this. Note that this is equivalent to the fix for the same issue in the QLabel test: c4ef0b92d5fb2c621e880347bd48d01b6f31eb24 Task-number: QTBUG-82954 Change-Id: Idee81dcceefe594059a06bd1f090650acd738f79 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_textarea.qml22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index 1e455ffc..be889c44 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -84,6 +84,10 @@ TestCase {
Rectangle { }
}
+ FontMetrics {
+ id: defaultFontMetrics
+ }
+
function test_creation() {
var control = createTemporaryObject(textArea, testCase)
verify(control)
@@ -141,7 +145,20 @@ TestCase {
compare(control.implicitBackgroundWidth, 0)
compare(control.implicitBackgroundHeight, 0)
compare(implicitWidthSpy.count, ++implicitWidthChanges)
- compare(implicitHeightSpy.count, implicitHeightChanges)
+
+ defaultFontMetrics.font = control.font
+ var leading = defaultFontMetrics.leading
+ var ascent = defaultFontMetrics.ascent
+ var descent = defaultFontMetrics.descent
+
+ var leadingOverflow = Math.ceil(ascent + descent) < Math.ceil(ascent + descent + leading)
+
+ // If the font in use triggers QTBUG-83894, it is possible that this will cause
+ // the following compare to fail if the implicitHeight from the TextEdit is ued.
+ // Unfortunately, since some styles override implicitHeight, we cannot guarantee
+ // that it will fail, so we need to simply skip the test for these cases.
+ if (!leadingOverflow)
+ compare(implicitHeightSpy.count, implicitHeightChanges)
compare(implicitBackgroundWidthSpy.count, implicitBackgroundWidthChanges)
compare(implicitBackgroundHeightSpy.count, implicitBackgroundHeightChanges)
@@ -151,7 +168,8 @@ TestCase {
compare(control.implicitBackgroundWidth, 0)
compare(control.implicitBackgroundHeight, 0)
compare(implicitWidthSpy.count, implicitWidthChanges)
- compare(implicitHeightSpy.count, implicitHeightChanges)
+ if (!leadingOverflow)
+ compare(implicitHeightSpy.count, implicitHeightChanges)
compare(implicitBackgroundWidthSpy.count, implicitBackgroundWidthChanges)
compare(implicitBackgroundHeightSpy.count, implicitBackgroundHeightChanges)
}