From 8e103902def83af0a074b81c9d527d8147def162 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 6 Apr 2016 14:29:15 +0200 Subject: tests: fix tst_QFontComboBox on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After 909d3f5c7, private families will not be shown in user interface. Task-number: QTBUG-41318 Change-Id: I15ae77cacd2a27c9db4b1a8ffbb582416258988c Reviewed-by: Morten Johan Sørvig --- tests/auto/widgets/widgets/qfontcombobox/BLACKLIST | 6 ------ .../widgets/qfontcombobox/tst_qfontcombobox.cpp | 20 +++++++++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) delete mode 100644 tests/auto/widgets/widgets/qfontcombobox/BLACKLIST (limited to 'tests') diff --git a/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST b/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST deleted file mode 100644 index 8bd4caad31..0000000000 --- a/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST +++ /dev/null @@ -1,6 +0,0 @@ -[currentFont] -osx -[fontFilters] -osx -[writingSystem] -osx diff --git a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp index 5d6fdf2851..10e447c417 100644 --- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp +++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp @@ -113,18 +113,21 @@ void tst_QFontComboBox::qfontcombobox() void tst_QFontComboBox::currentFont_data() { QTest::addColumn("currentFont"); + QFontDatabase db; // Normalize the names QFont defaultFont; QFontInfo fi(defaultFont); defaultFont = QFont(fi.family()); // make sure we have a real font name and not something like 'Sans Serif'. - QTest::newRow("default") << defaultFont; + if (!db.isPrivateFamily(defaultFont.family())) + QTest::newRow("default") << defaultFont; defaultFont.setPointSize(defaultFont.pointSize() + 10); - QTest::newRow("default2") << defaultFont; - QFontDatabase db; + if (!db.isPrivateFamily(defaultFont.family())) + QTest::newRow("default2") << defaultFont; QStringList list = db.families(); for (int i = 0; i < list.count(); ++i) { QFont f = QFont(QFontInfo(QFont(list.at(i))).family()); - QTest::newRow(qPrintable(list.at(i))) << f; + if (!db.isPrivateFamily(f.family())) + QTest::newRow(qPrintable(list.at(i))) << f; } } @@ -201,6 +204,8 @@ void tst_QFontComboBox::fontFilters() fontFilters &= ~spacingMask; for (int i = 0; i < list.count(); ++i) { + if (db.isPrivateFamily(list[i])) + continue; if (fontFilters & QFontComboBox::ScalableFonts) { if (!db.isSmoothlyScalable(list[i])) continue; @@ -265,7 +270,12 @@ void tst_QFontComboBox::writingSystem() QFontDatabase db; QStringList list = db.families(writingSystem); - QCOMPARE(box.model()->rowCount(), list.count()); + int c = list.count(); + for (int i = 0; i < list.count(); ++i) { + if (db.isPrivateFamily(list[i])) + c--; + } + QCOMPARE(box.model()->rowCount(), c); if (list.count() == 0) QCOMPARE(box.currentFont(), QFont()); -- cgit v1.2.3