summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfontdatabase
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-11-07 16:24:21 +0100
committerJiang Jiang <jiang.jiang@nokia.com>2011-11-08 15:32:09 +0100
commit1496976a05b8804135608c7dde9bca5620950c33 (patch)
tree6073045538cbb1af8331a4b1da1a0e95cfefbab7 /tests/auto/qfontdatabase
parent96e484c95629afd1f550449296f82c0561e64d26 (diff)
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.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
index 735c7e4350..15be776cb6 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"