Work around QFont bug in QFontDialog test

The QFontDialog test will currently fail for some PCF bitmap fonts
because the list of smooth sizes it uses to populate its size list
contains unsupported sizes. We work around this by adding
QEXPECT_FAIL when we detect that the failure is going to happen.

Task-number: QTBUG-46056
Task-number: QTBUG-53299
Change-Id: Ia665cca220f3622405d1a2336e8d587545cccbc6
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2016-05-11 13:43:16 +03:00 committed by Tony Sarajärvi
parent ed38750c03
commit 186d391f25

View File

@ -193,11 +193,14 @@ void tst_QFontDialog::task256466_wrongStyle()
for (int i = 0; i < familyList->model()->rowCount(); ++i) {
QModelIndex currentFamily = familyList->model()->index(i, 0);
familyList->setCurrentIndex(currentFamily);
int expectedSize = sizeList->currentIndex().data().toInt();
const QFont current = dialog.currentFont(),
expected = fdb.font(currentFamily.data().toString(),
styleList->currentIndex().data().toString(), sizeList->currentIndex().data().toInt());
styleList->currentIndex().data().toString(), expectedSize);
QCOMPARE(current.family(), expected.family());
QCOMPARE(current.style(), expected.style());
if (expectedSize == 0 && !QFontDatabase().isScalable(current.family(), current.styleName()))
QEXPECT_FAIL("", "QTBUG-53299: Smooth sizes for unscalable font contains unsupported size", Continue);
QCOMPARE(current.pointSizeF(), expected.pointSizeF());
}
}