From b1004c7d0a5d7abbacd687fd41a5b2683e62b27d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 29 Oct 2019 09:44:50 +0100 Subject: If only family is set, prefer that in the families list after resolving If a font with only a family set is resolved with one that has been setup with setFamilies() then the family needs to be prepended to the families list after resolving. This is so that the font still prefers the one set as just a family with no famillies set. This also amends the QFontDialog test to account for this too. [ChangeLog][QtGui][Text] Resolving a font that just has a family set with families set will prepend the family to the families so that it is still the first preference for the font. Task-number: QTBUG-46322 Change-Id: Icc4005732f95b2b4c684e592b06b31e133270e44 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/gui/text/qfont/tst_qfont.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto/gui/text') diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 66f3ee0d2c..bb047d5461 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -299,6 +299,13 @@ void tst_QFont::resolve() font5.setFamilies(fontFamilies); font6 = font6.resolve(font5); QCOMPARE(font6.families(), fontFamilies); + + QFont font7, font8; + font7.setFamily(QLatin1String("Helvetica")); + font8.setFamilies(fontFamilies); + font7 = font7.resolve(font8); + QCOMPARE(font7.families(), QStringList({"Helvetica", "Arial"})); + QCOMPARE(font7.family(), "Helvetica"); } #ifndef QT_NO_WIDGETS -- cgit v1.2.3