diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-10-12 13:08:06 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2020-10-12 14:08:06 +0200 |
commit | bdc9d272eebff66827b566b1b24b6697c797807a (patch) | |
tree | 095ba22c989db874fe3ce01997afd1858c7ff968 /tests/auto/gui/text | |
parent | 18357033b498c3447e408a4aede8e1c7051e06ee (diff) |
Fallback to using the family when doing an exact match
If the difference between the families sizes is just 1 where one of them
is 0 in size then we can fallback to the family in that case.
Pick-to: 5.15
Fixes: QTBUG-87267
Change-Id: I62b25b06c88000b4d7defe91871c07873b1fc792
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/auto/gui/text')
-rw-r--r-- | tests/auto/gui/text/qfont/tst_qfont.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 93fcd71bb6..d651ffe7c7 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -130,6 +130,21 @@ void tst_QFont::exactMatch() QVERIFY(!QFont("serif").exactMatch()); QVERIFY(!QFont("monospace").exactMatch()); + // Confirm that exactMatch is true for a valid font + QFontDatabase db; + const QString family = db.families().first(); + const QString style = db.styles(family).first(); + const int pointSize = db.pointSizes(family, style).first(); + font = db.font(family, style, pointSize); + QVERIFY(font.exactMatch()); + + if (db.families().contains("Arial")) { + font = QFont("Arial"); + QVERIFY(font.exactMatch()); + font = QFont(QString()); + font.setFamilies({"Arial"}); + QVERIFY(font.exactMatch()); + } } void tst_QFont::italicOblique() |