diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-04-29 22:45:14 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-05-07 07:48:43 +0000 |
commit | 6afdbfdaafcc4d24e08357dfea96b85787efb1f7 (patch) | |
tree | f75fc26e4dff8d035f3c285daf5d8cd5dafd8044 /tests/auto/gui | |
parent | c57520e491f420dc83d44ce5382c403192ce4836 (diff) |
Use "monospace" as fallback system FixedFont in KDE theme; logging
Also de-duplicate the "monospace" string in qgenericunixthemes.cpp,
and add tst_QFontDatabase::systemFixedFont() to verify that
QFontDatabase::systemFont(QFontDatabase::FixedFont) really returns
a monospace font across platforms. Replace commented-out qDebug()s
with qt.text.font.match and qt.text.font.db logging categories to
troubleshoot when the test fails (among other uses). Add qt.qpa.fonts
logging category to unix themes to show default system and fixed fonts
(font engines on other platforms are already using this category).
Fixes: QTBUG-54623
Change-Id: I2aa62b8c783d9ddb591a5e06e8df85c4af5bcb0c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r-- | tests/auto/gui/text/qfontdatabase/BLACKLIST | 3 | ||||
-rw-r--r-- | tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qfontdatabase/BLACKLIST b/tests/auto/gui/text/qfontdatabase/BLACKLIST new file mode 100644 index 0000000000..7f479e4b0e --- /dev/null +++ b/tests/auto/gui/text/qfontdatabase/BLACKLIST @@ -0,0 +1,3 @@ +[systemFixedFont] # QTBUG-54623 +winrt +b2qt diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index 68664cdd2f..064e37f73c 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -35,6 +35,8 @@ #include <private/qrawfont_p.h> #include <qpa/qplatformfontdatabase.h> +Q_LOGGING_CATEGORY(lcTests, "qt.text.tests") + class tst_QFontDatabase : public QObject { Q_OBJECT @@ -49,6 +51,7 @@ private slots: void fixedPitch_data(); void fixedPitch(); + void systemFixedFont(); #ifdef Q_OS_MAC void trickyFonts_data(); @@ -156,6 +159,16 @@ void tst_QFontDatabase::fixedPitch() QCOMPARE(fi.fixedPitch(), fixedPitch); } +void tst_QFontDatabase::systemFixedFont() // QTBUG-54623 +{ + QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont); + QFontInfo fontInfo(font); + bool fdbSaysFixed = QFontDatabase().isFixedPitch(fontInfo.family(), fontInfo.styleName()); + qCDebug(lcTests) << "system fixed font is" << font << "really fixed?" << fdbSaysFixed << fontInfo.fixedPitch(); + QVERIFY(fdbSaysFixed); + QVERIFY(fontInfo.fixedPitch()); +} + #ifdef Q_OS_MAC void tst_QFontDatabase::trickyFonts_data() { |