From 1496976a05b8804135608c7dde9bca5620950c33 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 7 Nov 2011 16:24:21 +0100 Subject: Fix localized font family access in OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/auto/qfontdatabase/tst_qfontdatabase.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') 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" -- cgit v1.2.1 From f322c563baabab704044810373041d99a2b03a6f Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Sun, 13 Nov 2011 13:29:38 +0100 Subject: Remove font that may not exists in some OS X systems --- tests/auto/qfontdatabase/tst_qfontdatabase.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp index 15be776cb6..7bbd32da79 100644 --- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp @@ -285,7 +285,6 @@ void tst_QFontDatabase::localizedFonts() QFontDatabase db; QVERIFY(db.hasFamily(QString::fromUtf8("ヒラギノ明朝 Pro"))); - QVERIFY(db.hasFamily(QString::fromUtf8("华文宋体"))); QVERIFY(!db.hasFamily(QString::fromUtf8("NotValidFont"))); } #endif -- cgit v1.2.1 From 11a6d868b5613dd7fdbef02198aaf9566fcd1f17 Mon Sep 17 00:00:00 2001 From: Mikko Knuutila Date: Mon, 14 Nov 2011 10:18:22 +0100 Subject: Fix for QMessageBox's autotest. Mnemonic shortcut caused string comparison to fail. Task-number: QTBUG-22119 Reviewed-by: Friedemann Kleint --- tests/auto/qmessagebox/tst_qmessagebox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp index ed085cef8b..06e242ca5e 100644 --- a/tests/auto/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp @@ -720,7 +720,8 @@ void tst_QMessageBox::detailsButtonText() QAbstractButton* btn = NULL; foreach(btn, list) { if (btn && (btn->inherits("QPushButton"))) { - if (btn->text() != QMessageBox::tr("OK") && btn->text() != QMessageBox::tr("Show Details...")) { + if (btn->text().remove("&") != QMessageBox::tr("OK") + && btn->text() != QMessageBox::tr("Show Details...")) { QFAIL(qPrintable(QString("Unexpected messagebox button text: %1").arg(btn->text()))); } } -- cgit v1.2.1