Make sure widget is polished before checking its font

QWidget is polished when show() is called, so unless you do this
first, QWidget::font() will return a default constructed QFont,
and not necessarily the default specified in the platform theme.
Comparing this to QPainter::font() later, which has been resolved
against the platform theme font, and not the default constructed
font, you can get a mismatch and a false test failure. This
happened on Android.

Change-Id: I41ef5b10879bbd4bb8ef8d52ecaccf5e8e894075
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2015-01-06 15:41:05 +01:00
parent 7ad75cd8ef
commit d056618d68

View File

@ -730,6 +730,7 @@ void tst_QPainter::initFrom()
pal.setColor(QPalette::Foreground, QColor(255, 0, 0));
pal.setBrush(QPalette::Background, QColor(0, 255, 0));
widget->setPalette(pal);
widget->show();
QFont font = widget->font();
font.setPointSize(26);