summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/text/qrawfont/tst_qrawfont.cpp')
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp53
1 files changed, 15 insertions, 38 deletions
diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
index a730174ee9..5ec2536718 100644
--- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QtGui/QFontDatabase>
@@ -121,7 +96,7 @@ void tst_QRawFont::initTestCase()
if (testFont.isEmpty() || testFontBoldItalic.isEmpty())
QFAIL("qrawfont unittest font files not found!");
- if (QFontDatabase::families().count() == 0)
+ if (QFontDatabase::families().size() == 0)
QSKIP("No fonts available!!!");
}
@@ -423,13 +398,13 @@ void tst_QRawFont::textLayout()
void tst_QRawFont::fontTable_data()
{
- QTest::addColumn<QByteArray>("tagName");
+ QTest::addColumn<QFont::Tag>("tag");
QTest::addColumn<QFont::HintingPreference>("hintingPreference");
QTest::addColumn<int>("offset");
QTest::addColumn<quint32>("expectedValue");
QTest::newRow("Head table, magic number, default hinting")
- << QByteArray("head")
+ << QFont::Tag("head")
<< QFont::PreferDefaultHinting
<< 12
<< (QSysInfo::ByteOrder == QSysInfo::BigEndian
@@ -437,7 +412,7 @@ void tst_QRawFont::fontTable_data()
: 0xF53C0F5F);
QTest::newRow("Head table, magic number, no hinting")
- << QByteArray("head")
+ << QFont::Tag("head")
<< QFont::PreferNoHinting
<< 12
<< (QSysInfo::ByteOrder == QSysInfo::BigEndian
@@ -445,7 +420,7 @@ void tst_QRawFont::fontTable_data()
: 0xF53C0F5F);
QTest::newRow("Head table, magic number, vertical hinting")
- << QByteArray("head")
+ << QFont::Tag("head")
<< QFont::PreferVerticalHinting
<< 12
<< (QSysInfo::ByteOrder == QSysInfo::BigEndian
@@ -453,7 +428,7 @@ void tst_QRawFont::fontTable_data()
: 0xF53C0F5F);
QTest::newRow("Head table, magic number, full hinting")
- << QByteArray("head")
+ << QFont::Tag("head")
<< QFont::PreferFullHinting
<< 12
<< (QSysInfo::ByteOrder == QSysInfo::BigEndian
@@ -463,7 +438,7 @@ void tst_QRawFont::fontTable_data()
void tst_QRawFont::fontTable()
{
- QFETCH(QByteArray, tagName);
+ QFETCH(QFont::Tag, tag);
QFETCH(QFont::HintingPreference, hintingPreference);
QFETCH(int, offset);
QFETCH(quint32, expectedValue);
@@ -471,11 +446,13 @@ void tst_QRawFont::fontTable()
QRawFont font(testFont, 10, hintingPreference);
QVERIFY(font.isValid());
- QByteArray table = font.fontTable(tagName);
+ QByteArray table = font.fontTable(tag);
QVERIFY(!table.isEmpty());
const quint32 *value = reinterpret_cast<const quint32 *>(table.constData() + offset);
QCOMPARE(*value, expectedValue);
+
+ QCOMPARE(font.fontTable(tag.toString()), table);
}
typedef QList<QFontDatabase::WritingSystem> WritingSystemList;
@@ -515,7 +492,7 @@ void tst_QRawFont::supportedWritingSystems_data()
void tst_QRawFont::supportedWritingSystems()
{
QFETCH(QString, fileName);
- QFETCH(WritingSystemList, writingSystems);
+ QFETCH(const WritingSystemList, writingSystems);
QFETCH(QFont::HintingPreference, hintingPreference);
QRawFont font(fileName, 10, hintingPreference);
@@ -524,7 +501,7 @@ void tst_QRawFont::supportedWritingSystems()
WritingSystemList actualWritingSystems = font.supportedWritingSystems();
QCOMPARE(actualWritingSystems.size(), writingSystems.size());
- foreach (QFontDatabase::WritingSystem writingSystem, writingSystems)
+ for (QFontDatabase::WritingSystem writingSystem : writingSystems)
QVERIFY(actualWritingSystems.contains(writingSystem));
}
@@ -1077,7 +1054,7 @@ void tst_QRawFont::qtbug65923_partal_clone_data()
void tst_QRawFont::qtbug65923_partal_clone()
{
QFile file(testFont);
- file.open(QIODevice::ReadOnly);
+ QVERIFY(file.open(QIODevice::ReadOnly));
QByteArray fontData = file.readAll();
QRawFont outerFont;