diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2017-10-25 15:15:09 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2017-10-30 08:11:38 +0000 |
commit | c7f2abe551c027a8eddb01dd7445dcf1fb829171 (patch) | |
tree | 280d76f8406710fc9eefa714ea4e2f9ebf00f0d6 /tests | |
parent | b0631ce6ed816e16869b87165ce8d7e34643afe8 (diff) |
Add native Darwin handler for the HEIF (.heic) format
Adds basic support for still images encoded with the HEIF standard
introduced in macOS Sierra and IOS 11.
Uses the Core Graphics Image I/O Framework as codec backend.
Reuses the helper class from the macjp2 handler.
Change-Id: I5f0c7891b189a916cccd2c27eacbac12416ce209
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 1 | ||||
-rw-r--r-- | tests/auto/heif/heif.pro | 8 | ||||
-rw-r--r-- | tests/auto/heif/tst_qheif.cpp | 70 | ||||
-rw-r--r-- | tests/shared/images/heif.qrc | 5 | ||||
-rw-r--r-- | tests/shared/images/heif/col320x480.heic | bin | 0 -> 29004 bytes |
5 files changed, 84 insertions, 0 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index bf0f8e5..daa1dfb 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -6,5 +6,6 @@ SUBDIRS = \ icns \ jp2 \ webp \ + heif \ mng \ tiff diff --git a/tests/auto/heif/heif.pro b/tests/auto/heif/heif.pro new file mode 100644 index 0000000..9ef1085 --- /dev/null +++ b/tests/auto/heif/heif.pro @@ -0,0 +1,8 @@ +TARGET = tst_qheif + +QT = core gui testlib +CONFIG -= app_bundle +CONFIG += testcase + +SOURCES += tst_qheif.cpp +RESOURCES += $$PWD/../../shared/images/heif.qrc diff --git a/tests/auto/heif/tst_qheif.cpp b/tests/auto/heif/tst_qheif.cpp new file mode 100644 index 0000000..faf22fa --- /dev/null +++ b/tests/auto/heif/tst_qheif.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the autotests in the Qt ImageFormats module. +** +** $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$ +** +****************************************************************************/ + +#include <QtTest/QtTest> +#include <QtGui/QtGui> + +class tst_qheif: public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void readImage_data(); + void readImage(); +}; + +void tst_qheif::initTestCase() +{ + if (!QImageReader::supportedImageFormats().contains("heic")) + QSKIP("The image format handler is not installed."); +} + +void tst_qheif::readImage_data() +{ + QTest::addColumn<QString>("fileName"); + QTest::addColumn<QSize>("size"); + + QTest::newRow("col") << QString("col320x480.heic") << QSize(320, 480); +} + +void tst_qheif::readImage() +{ + QFETCH(QString, fileName); + QFETCH(QSize, size); + + QString path = QStringLiteral(":/heif/") + fileName; + QImageReader reader(path); + QVERIFY(reader.canRead()); + QImage image = reader.read(); + QVERIFY(!image.isNull()); + QCOMPARE(image.size(), size); +} + +QTEST_MAIN(tst_qheif) +#include "tst_qheif.moc" diff --git a/tests/shared/images/heif.qrc b/tests/shared/images/heif.qrc new file mode 100644 index 0000000..2a41c36 --- /dev/null +++ b/tests/shared/images/heif.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>heif/col320x480.heic</file> + </qresource> +</RCC> diff --git a/tests/shared/images/heif/col320x480.heic b/tests/shared/images/heif/col320x480.heic Binary files differnew file mode 100644 index 0000000..6ca3c7b --- /dev/null +++ b/tests/shared/images/heif/col320x480.heic |