Expect failure in QLabel test for certain condition

While investigating QTBUG-80554, it was discovered that a small
mismatch in how heights are calculated in QTextDocument and
QPainter will cause the tst_QLabel::sizeHint() autotest to
fail if ceil(ascent+descent+leading) is higher than
ceil(ascent+descent). This is currently blocking the fix for
QTBUG-80554, because this exposes the bug by detecting the
correct leading for a font where we previously ignored it.

Task-number: QTBUG-82954
Change-Id: I99323c8e1a0fa281aa8d754ba71432468fcb2d4c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2020-03-19 14:24:41 +01:00
parent 7c3700c070
commit c4ef0b92d5

View File

@ -38,6 +38,8 @@
#include <qmovie.h>
#include <qpicture.h>
#include <qmessagebox.h>
#include <qfontmetrics.h>
#include <qmath.h>
#include <private/qlabel_p.h>
class Widget : public QWidget
@ -373,8 +375,16 @@ void tst_QLabel::sizeHint()
l1.setAlignment(Qt::AlignVCenter);
l1.setTextInteractionFlags(Qt::TextSelectableByMouse); // will now use qtextcontrol
int h1 = l1.sizeHint().height();
QCOMPARE(h1, h);
QFontMetricsF fontMetrics(QApplication::font());
qreal leading = fontMetrics.leading();
qreal ascent = fontMetrics.ascent();
qreal descent = fontMetrics.descent();
bool leadingOverflow = qCeil(ascent + descent) < qCeil(ascent + descent + leading);
if (leadingOverflow)
QEXPECT_FAIL("", "See QTBUG-82954", Continue);
QCOMPARE(h1, h);
}
void tst_QLabel::task226479_movieResize()