diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-11-07 15:24:21 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-11-08 14:32:09 (GMT) |
commit | 1496976a05b8804135608c7dde9bca5620950c33 (patch) | |
tree | 6073045538cbb1af8331a4b1da1a0e95cfefbab7 /tests/auto/qfontdatabase | |
parent | 96e484c95629afd1f550449296f82c0561e64d26 (diff) | |
download | Qt-1496976a05b8804135608c7dde9bca5620950c33.zip Qt-1496976a05b8804135608c7dde9bca5620950c33.tar.gz Qt-1496976a05b8804135608c7dde9bca5620950c33.tar.bz2 |
Fix localized font family access in OS X
Font family names listed in QFontDatabase::families() should be
localized names rather than their default (English) names, to be
consistent with behaviors in other Mac apps and previous Qt/Mac
based on ATS.
It should also be possible to verify if a font exists with any
family name, regardless it's localized or not. Say we have font
"Hiragino Mincho Pro", which has a Japanese name called "ヒラギ
ノ明朝 Pro", then
db.hasFamily(QString::fromUtf8("ヒラギノ明朝 Pro"))
should return true.
Task-number: QTBUG-22372
Reviewed-by: Morten Sorvig
Diffstat (limited to 'tests/auto/qfontdatabase')
-rw-r--r-- | tests/auto/qfontdatabase/tst_qfontdatabase.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp index 735c7e4..15be776 100644 --- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp @@ -80,6 +80,10 @@ private slots: void addAppFont_data(); void addAppFont(); + +#ifdef Q_WS_MAC + void localizedFonts(); +#endif }; tst_QFontDatabase::tst_QFontDatabase() @@ -275,5 +279,16 @@ void tst_QFontDatabase::addAppFont() QVERIFY(db.families() == oldFamilies); } +#ifdef Q_WS_MAC +void tst_QFontDatabase::localizedFonts() +{ + QFontDatabase db; + + QVERIFY(db.hasFamily(QString::fromUtf8("ヒラギノ明朝 Pro"))); + QVERIFY(db.hasFamily(QString::fromUtf8("华文宋体"))); + QVERIFY(!db.hasFamily(QString::fromUtf8("NotValidFont"))); +} +#endif + QTEST_MAIN(tst_QFontDatabase) #include "tst_qfontdatabase.moc" |