summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qrawfont
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/text/qrawfont')
-rw-r--r--tests/auto/gui/text/qrawfont/BLACKLIST2
-rw-r--r--tests/auto/gui/text/qrawfont/CMakeLists.txt30
-rw-r--r--tests/auto/gui/text/qrawfont/testdata.qrc7
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp53
4 files changed, 31 insertions, 61 deletions
diff --git a/tests/auto/gui/text/qrawfont/BLACKLIST b/tests/auto/gui/text/qrawfont/BLACKLIST
deleted file mode 100644
index 44b3d7d481..0000000000
--- a/tests/auto/gui/text/qrawfont/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-# QTBUG-85364
-windows-10 gcc cmake
diff --git a/tests/auto/gui/text/qrawfont/CMakeLists.txt b/tests/auto/gui/text/qrawfont/CMakeLists.txt
index 04db8d8760..d2a318a2a3 100644
--- a/tests/auto/gui/text/qrawfont/CMakeLists.txt
+++ b/tests/auto/gui/text/qrawfont/CMakeLists.txt
@@ -1,17 +1,15 @@
-# Generated from qrawfont.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qrawfont Test:
#####################################################################
-qt_internal_add_test(tst_qrawfont
- SOURCES
- tst_qrawfont.cpp
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
-)
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qrawfont LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
# Resources:
set_source_files_properties("../../../shared/resources/testfont.ttf"
@@ -23,10 +21,14 @@ set(testdata_resource_files
"testfont_os2_v1.ttf"
)
-qt_internal_add_resource(tst_qrawfont "testdata"
- PREFIX
- "/"
- FILES
- ${testdata_resource_files}
+qt_internal_add_test(tst_qrawfont
+ SOURCES
+ tst_qrawfont.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ TESTDATA ${testdata_resource_files}
+ BUILTIN_TESTDATA
)
diff --git a/tests/auto/gui/text/qrawfont/testdata.qrc b/tests/auto/gui/text/qrawfont/testdata.qrc
deleted file mode 100644
index c7ac9641d1..0000000000
--- a/tests/auto/gui/text/qrawfont/testdata.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>testfont_bold_italic.ttf</file>
- <file>testfont_os2_v1.ttf</file>
- <file alias="testfont.ttf">../../../shared/resources/testfont.ttf</file>
- </qresource>
-</RCC>
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;