summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qfontdatabase
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-10-24 15:53:06 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-11-07 08:32:37 +0000
commit95d127354887425b616a5087c24b6765b7bf907b (patch)
treecc768b779673eece5a264ce58f2304838b7dd68b /tests/auto/gui/text/qfontdatabase
parentc5f18284248cf5ad1d07136764d2e4526b176344 (diff)
Windows: Don't claim bitmap fonts support all standard sizes
We were throwing away important information by claiming that all fonts support all the standard sizes in QFontDatabase on Windows This caused the font dialog to list unsupported sizes for bitmap fonts, unlike the native font dialog. We would also claim to support creating bitmap fonts at unsupported sizes, which would lead to 1. QFontInfo(font).pointSize() would return the requested size, not the actual rendered size. 2. Bitmap fonts created at 64 pixels and higher would be invisible. On Mac, there are no system bitmap fonts, and the use is not very common, but installing some bitmap fonts on the system, it does seem to ignore the sizes supported in the font and just displays the standard list instead, so we keep the current behavior there. [ChangeLog][QtGui][Text] Fixed list of supported sizes for bitmap fonts on Windows. Task-number: QTBUG-56672 Change-Id: Idbec2db9eb3381ab5ddf6259bd2befcba9b93564 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/gui/text/qfontdatabase')
-rw-r--r--tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
index c53792da99..8c26f8a91f 100644
--- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
@@ -67,6 +67,9 @@ private slots:
void condensedFontWidth();
void condensedFontMatching();
+ void rasterFonts();
+ void smoothFonts();
+
private:
QString m_ledFont;
QString m_testFont;
@@ -334,5 +337,30 @@ void tst_QFontDatabase::condensedFontMatching()
QFontMetrics(tfcBySubfamilyName).width(testString()));
}
+void tst_QFontDatabase::rasterFonts()
+{
+ QFont font(QLatin1String("Fixedsys"), 1000);
+ QFontInfo fontInfo(font);
+
+ if (fontInfo.family() != font.family())
+ QSKIP("Fixedsys font not available.");
+
+ QVERIFY(!QFontDatabase().isSmoothlyScalable(font.family()));
+ QVERIFY(fontInfo.pointSize() != font.pointSize());
+}
+
+void tst_QFontDatabase::smoothFonts()
+{
+ QFont font(QLatin1String("Arial"), 1000);
+ QFontInfo fontInfo(font);
+
+ if (fontInfo.family() != font.family())
+ QSKIP("Arial font not available.");
+
+ // Smooth and bitmap scaling are mutually exclusive
+ QVERIFY(QFontDatabase().isSmoothlyScalable(font.family()));
+ QVERIFY(!QFontDatabase().isBitmapScalable(font.family()));
+}
+
QTEST_MAIN(tst_QFontDatabase)
#include "tst_qfontdatabase.moc"