diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2010-09-03 13:49:33 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2010-09-10 13:51:56 (GMT) |
commit | f2f6330d915cbe3d0989ad280738ed0a6954cd35 (patch) | |
tree | f92f2fd2ae59ef883a06d230d80763293c988903 /tests/auto/qfontdatabase/tst_qfontdatabase.cpp | |
parent | 1e8e290fb5d9b0d059711b9e53ea588872a59c57 (diff) | |
download | Qt-f2f6330d915cbe3d0989ad280738ed0a6954cd35.zip Qt-f2f6330d915cbe3d0989ad280738ed0a6954cd35.tar.gz Qt-f2f6330d915cbe3d0989ad280738ed0a6954cd35.tar.bz2 |
Fix Core Text font loading for certain Mac Fonts
Font names enumerated by Core Text cannot be found by
ATSFontFamilyFindFromName because ATS is expecting native names
instead of the names returned by Core Text. This patch get rid
of ATS font matching code in Cocoa code path to simplify the code,
avoid deprecation warnings (in the future) and fix this issue.
Task-number: QTBUG-11145
Reviewed-by: Eskil
Diffstat (limited to 'tests/auto/qfontdatabase/tst_qfontdatabase.cpp')
-rw-r--r-- | tests/auto/qfontdatabase/tst_qfontdatabase.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp index 357b82e..bddd92a 100644 --- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp @@ -70,6 +70,11 @@ private slots: void fixedPitch_data(); void fixedPitch(); +#ifdef Q_WS_MAC + void trickyFonts_data(); + void trickyFonts(); +#endif + void widthTwoTimes_data(); void widthTwoTimes(); @@ -131,10 +136,16 @@ void tst_QFontDatabase::fixedPitch_data() QTest::newRow( "Times New Roman" ) << QString( "Times New Roman" ) << false; QTest::newRow( "Arial" ) << QString( "Arial" ) << false; - QTest::newRow( "Script" ) << QString( "Script" ) << false; + QTest::newRow( "Andale Mono" ) << QString( "Andale Mono" ) << true; QTest::newRow( "Courier" ) << QString( "Courier" ) << true; QTest::newRow( "Courier New" ) << QString( "Courier New" ) << true; +#ifndef Q_WS_MAC + QTest::newRow( "Script" ) << QString( "Script" ) << false; QTest::newRow( "Lucida Console" ) << QString( "Lucida Console" ) << true; +#else + QTest::newRow( "Menlo" ) << QString( "Menlo" ) << true; + QTest::newRow( "Monaco" ) << QString( "Monaco" ) << true; +#endif } void tst_QFontDatabase::fixedPitch() @@ -156,6 +167,28 @@ void tst_QFontDatabase::fixedPitch() QCOMPARE(fi.fixedPitch(), fixedPitch); } +#ifdef Q_WS_MAC +void tst_QFontDatabase::trickyFonts_data() +{ + QTest::addColumn<QString>("font"); + + QTest::newRow( "Geeza Pro" ) << QString( "Geeza Pro" ); +} + +void tst_QFontDatabase::trickyFonts() +{ + QFETCH(QString, font); + + QFontDatabase fdb; + if (!fdb.families().contains(font)) + QSKIP( "Font not installed", SkipSingle); + + QFont qfont(font); + QFontInfo fi(qfont); + QCOMPARE(fi.family(), font); +} +#endif + void tst_QFontDatabase::widthTwoTimes_data() { QTest::addColumn<QString>("font"); |