From c7f2abe551c027a8eddb01dd7445dcf1fb829171 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 25 Oct 2017 15:15:09 +0200 Subject: Add native Darwin handler for the HEIF (.heic) format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/auto/auto.pro | 1 + tests/auto/heif/heif.pro | 8 ++++ tests/auto/heif/tst_qheif.cpp | 70 +++++++++++++++++++++++++++++++ tests/shared/images/heif.qrc | 5 +++ tests/shared/images/heif/col320x480.heic | Bin 0 -> 29004 bytes 5 files changed, 84 insertions(+) create mode 100644 tests/auto/heif/heif.pro create mode 100644 tests/auto/heif/tst_qheif.cpp create mode 100644 tests/shared/images/heif.qrc create mode 100644 tests/shared/images/heif/col320x480.heic (limited to 'tests') 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 +#include + +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("fileName"); + QTest::addColumn("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 @@ + + + heif/col320x480.heic + + diff --git a/tests/shared/images/heif/col320x480.heic b/tests/shared/images/heif/col320x480.heic new file mode 100644 index 0000000..6ca3c7b Binary files /dev/null and b/tests/shared/images/heif/col320x480.heic differ -- cgit v1.2.1