diff options
Diffstat (limited to 'tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp')
-rw-r--r-- | tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index 2b69801b59..12e8083622 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -76,6 +76,9 @@ private slots: void rasterFonts(); void smoothFonts(); + void registerOpenTypePreferredNamesSystem(); + void registerOpenTypePreferredNamesApplication(); + private: QString m_ledFont; QString m_testFont; @@ -440,5 +443,31 @@ void tst_QFontDatabase::smoothFonts() QVERIFY(!QFontDatabase().isBitmapScalable(font.family())); } +void tst_QFontDatabase::registerOpenTypePreferredNamesSystem() +{ + QFontDatabase db; + // This font family was picked because it was the only one I had installed which showcased the + // problem + if (!db.hasFamily(QString::fromLatin1("Source Code Pro ExtraLight"))) + QSKIP("Source Code Pro ExtraLight is not installed"); + + QStringList styles = db.styles(QString::fromLatin1("Source Code Pro")); + QVERIFY(styles.contains(QLatin1String("ExtraLight"))); +} + +void tst_QFontDatabase::registerOpenTypePreferredNamesApplication() +{ + QFontDatabase db; + + int id = QFontDatabase::addApplicationFont(QString::fromLatin1(":/testfont_open.otf")); + if (id == -1) + QSKIP("Skip the test since app fonts are not supported on this system"); + + QStringList styles = db.styles(QString::fromLatin1("QtBidiTestFont")); + QVERIFY(styles.contains(QLatin1String("Open"))); + + QFontDatabase::removeApplicationFont(id); +} + QTEST_MAIN(tst_QFontDatabase) #include "tst_qfontdatabase.moc" |