diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-11-26 11:22:07 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-01-22 18:43:18 +0000 |
commit | e823c351c6226765ccfe66e2ee93a2797dcc9721 (patch) | |
tree | 8af9ead9b84269c2c935ef524f768d66d3f184bb /tests/auto | |
parent | 76ee79b8b9c412a77bb51f127ab102f2451a7bbb (diff) |
Fix resolve() on fonts returned from QWidget::font()
Set the inherited properties as resolved on the font, so non-default
values are passed on in contexts that does resolve logic like QPainter.
One test is updated as it actually tests what it is supposed to on
more configurations.
Fixes: QTBUG-39560
Change-Id: Ief668e992ccdc091337a259a4c1306a00e67c73f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 13 | ||||
-rw-r--r-- | tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp | 4 |
2 files changed, 15 insertions, 2 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 360e6986f6..3b9c9060fa 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -166,6 +166,7 @@ private slots: void getSetCheck(); void fontPropagation(); void fontPropagation2(); + void fontPropagation3(); void palettePropagation(); void palettePropagation2(); void enabledPropagation(); @@ -819,6 +820,18 @@ void tst_QWidget::fontPropagation2() QVERIFY(child5->font().italic()); } +void tst_QWidget::fontPropagation3() +{ + QWidget parent; + QWidget *child = new QWidget(&parent); + parent.setFont(QFont("Monospace", 9)); + QImage image(32, 32, QImage::Format_RGB32); + QPainter p(&image); + p.setFont(child->font()); + QCOMPARE(p.font().family(), child->font().family()); + QCOMPARE(p.font().pointSize(), child->font().pointSize()); +} + void tst_QWidget::palettePropagation() { QScopedPointer<QWidget> testWidget(new QWidget); diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 03f24ba151..0e5c40f1b6 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -741,9 +741,9 @@ void tst_QStyleSheetStyle::fontPropagation() QCOMPARE(FONTSIZE(pb), 20); QWidget window; - window.setStyleSheet("* { font-size: 10pt }"); + window.setStyleSheet("* { font-size: 9pt }"); pb.setParent(&window); - QCOMPARE(FONTSIZE(pb), 10); + QCOMPARE(FONTSIZE(pb), 9); window.setStyleSheet(""); QCOMPARE(FONTSIZE(pb), buttonFontSize); |