Mailinglist Archive: opensuse-commit (1903 mails)

< Previous Next >
commit libqt5-qtimageformats for openSUSE:Factory
Hello community,

here is the log from the commit of package libqt5-qtimageformats for
openSUSE:Factory checked in at 2019-04-26 22:52:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libqt5-qtimageformats (Old)
and /work/SRC/openSUSE:Factory/.libqt5-qtimageformats.new.5536 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libqt5-qtimageformats"

Fri Apr 26 22:52:39 2019 rev:33 rq:697064 version:5.12.3

Changes:
--------
---
/work/SRC/openSUSE:Factory/libqt5-qtimageformats/libqt5-qtimageformats.changes
2019-03-21 09:40:22.918979352 +0100
+++
/work/SRC/openSUSE:Factory/.libqt5-qtimageformats.new.5536/libqt5-qtimageformats.changes
2019-04-26 22:53:04.717368163 +0200
@@ -1,0 +2,8 @@
+Thu Apr 18 07:27:17 UTC 2019 - fabian@xxxxxxxxxxxxxx
+
+- Update to 5.12.3:
+ * New bugfix release
+ * For more details please see:
+ *
http://code.qt.io/cgit/qt/qtimageformats.git/plain/dist/changes-5.12.3/?h=v5.12.3
+
+-------------------------------------------------------------------

Old:
----
qtimageformats-everywhere-src-5.12.2.tar.xz

New:
----
qtimageformats-everywhere-src-5.12.3.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libqt5-qtimageformats.spec ++++++
--- /var/tmp/diff_new_pack.n3OOHH/_old 2019-04-26 22:53:06.057367299 +0200
+++ /var/tmp/diff_new_pack.n3OOHH/_new 2019-04-26 22:53:06.061367297 +0200
@@ -19,16 +19,16 @@
%define qt5_snapshot 0

Name: libqt5-qtimageformats
-Version: 5.12.2
+Version: 5.12.3
Release: 0
Summary: Qt 5 Image Format Plugins
License: LGPL-2.1-with-Qt-Company-Qt-exception-1.1 or LGPL-3.0-only
Group: Development/Libraries/X11
Url: https://www.qt.io
%define base_name libqt5
-%define real_version 5.12.2
-%define so_version 5.12.2
-%define tar_version qtimageformats-everywhere-src-5.12.2
+%define real_version 5.12.3
+%define so_version 5.12.3
+%define tar_version qtimageformats-everywhere-src-5.12.3
Source:
https://download.qt.io/official_releases/qt/5.12/%{real_version}/submodules/%{tar_version}.tar.xz
Source1: baselibs.conf
# PATCH-FIX-OPENSUSE jas_version.patch

++++++ qtimageformats-everywhere-src-5.12.2.tar.xz ->
qtimageformats-everywhere-src-5.12.3.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/qtimageformats-everywhere-src-5.12.2/.qmake.conf
new/qtimageformats-everywhere-src-5.12.3/.qmake.conf
--- old/qtimageformats-everywhere-src-5.12.2/.qmake.conf 2019-02-25
10:38:12.000000000 +0100
+++ new/qtimageformats-everywhere-src-5.12.3/.qmake.conf 2019-04-02
14:10:20.000000000 +0200
@@ -1,3 +1,3 @@
load(qt_build_config)

-MODULE_VERSION = 5.12.2
+MODULE_VERSION = 5.12.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/qtimageformats-everywhere-src-5.12.2/.tag
new/qtimageformats-everywhere-src-5.12.3/.tag
--- old/qtimageformats-everywhere-src-5.12.2/.tag 2019-02-25
10:38:12.000000000 +0100
+++ new/qtimageformats-everywhere-src-5.12.3/.tag 2019-04-02
14:10:20.000000000 +0200
@@ -1 +1 @@
-1b8478f86f15dc1dd125a2a0d8331bc3600a79c1
+17ac003f6072e62ba9de7e75f3de8b8509dcd2c3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtimageformats-everywhere-src-5.12.2/dist/changes-5.12.3
new/qtimageformats-everywhere-src-5.12.3/dist/changes-5.12.3
--- old/qtimageformats-everywhere-src-5.12.2/dist/changes-5.12.3
1970-01-01 01:00:00.000000000 +0100
+++ new/qtimageformats-everywhere-src-5.12.3/dist/changes-5.12.3
2019-04-02 14:10:20.000000000 +0200
@@ -0,0 +1,31 @@
+Qt 5.12.3 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.0 through 5.12.2.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* HEIC (macOS/iOS) *
+****************************************************************************
+
+ - Support for Size and Transformation image properties have been
+ added, so these can be queried through QImageReader prior to
+ reading the image. Automatic transformation is enabled, so images
+ that are stored rotated will by default be transformed to normal
+ orientation on reading.
+
+ - Read images will have their resolution QImage::dotsPerMeterX()/Y()
+ set according to the values in the file.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/macheif/qmacheifhandler.cpp

new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/macheif/qmacheifhandler.cpp
---
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/macheif/qmacheifhandler.cpp
2019-02-25 10:38:12.000000000 +0100
+++
new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/macheif/qmacheifhandler.cpp
2019-04-02 14:10:20.000000000 +0200
@@ -43,22 +43,8 @@

QT_BEGIN_NAMESPACE

-class QMacHeifHandlerPrivate
-{
- Q_DECLARE_PUBLIC(QMacHeifHandler)
- Q_DISABLE_COPY(QMacHeifHandlerPrivate)
-public:
- QMacHeifHandlerPrivate(QMacHeifHandler *q_ptr)
- : writeQuality(-1), q_ptr(q_ptr)
- {}
-
- int writeQuality;
- QMacHeifHandler *q_ptr;
-};
-
-
QMacHeifHandler::QMacHeifHandler()
- : d_ptr(new QMacHeifHandlerPrivate(this))
+ : d(new QIIOFHelper(this))
{
}

@@ -90,28 +76,30 @@

bool QMacHeifHandler::read(QImage *image)
{
- return QIIOFHelpers::readImage(this, image);
+ return d->readImage(image);
}

bool QMacHeifHandler::write(const QImage &image)
{
- return QIIOFHelpers::writeImage(this, image,
QStringLiteral("public.heic"));
+ return d->writeImage(image, QStringLiteral("public.heic"));
}

QVariant QMacHeifHandler::option(ImageOption option) const
{
- return QVariant();
+ return d->imageProperty(option);
}

void QMacHeifHandler::setOption(ImageOption option, const QVariant &value)
{
- Q_UNUSED(option)
- Q_UNUSED(value)
+ d->setOption(option, value);
}

bool QMacHeifHandler::supportsOption(ImageOption option) const
{
- return false;
+ return option == Quality
+ || option == Size
+ || option == ImageTransformation
+ || option == TransformedByDefault;
}

QT_END_NAMESPACE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/macheif/qmacheifhandler.h

new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/macheif/qmacheifhandler.h
---
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/macheif/qmacheifhandler.h
2019-02-25 10:38:12.000000000 +0100
+++
new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/macheif/qmacheifhandler.h
2019-04-02 14:10:20.000000000 +0200
@@ -49,13 +49,13 @@
class QByteArray;
class QIODevice;
class QVariant;
-class QMacHeifHandlerPrivate;
+class QIIOFHelper;

class QMacHeifHandler : public QImageIOHandler
{
public:
QMacHeifHandler();
- ~QMacHeifHandler();
+ ~QMacHeifHandler() override;

bool canRead() const override;
bool read(QImage *image) override;
@@ -67,8 +67,7 @@
static bool canRead(QIODevice *iod);

private:
- Q_DECLARE_PRIVATE(QMacHeifHandler)
- QScopedPointer<QMacHeifHandlerPrivate> d_ptr;
+ QScopedPointer<QIIOFHelper> d;
};

QT_END_NAMESPACE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/shared/qiiofhelpers.cpp

new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/shared/qiiofhelpers.cpp
---
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/shared/qiiofhelpers.cpp
2019-02-25 10:38:12.000000000 +0100
+++
new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/shared/qiiofhelpers.cpp
2019-04-02 14:10:20.000000000 +0200
@@ -38,15 +38,12 @@
****************************************************************************/

#include <QGuiApplication>
-#include <qpa/qplatformnativeinterface.h>
#include <QBuffer>
#include <QImageIOHandler>
#include <QImage>
-#include <private/qcore_mac_p.h>

#include "qiiofhelpers_p.h"

-#include <ImageIO/ImageIO.h>

QT_BEGIN_NAMESPACE

@@ -57,14 +54,14 @@
QIODevice *dev = static_cast<QIODevice *>(info);
if (!dev || !buffer)
return 0;
- qint64 res = dev->read(static_cast<char *>(buffer), count);
- return qMax(qint64(0), res);
+ qint64 res = dev->read(static_cast<char *>(buffer), qint64(count));
+ return size_t(qMax(qint64(0), res));
}

static off_t cbSkipForward(void *info, off_t count)
{
QIODevice *dev = static_cast<QIODevice *>(info);
- if (!dev || !count)
+ if (!dev || count <= 0)
return 0;
qint64 res = 0;
if (!dev->isSequential()) {
@@ -72,7 +69,7 @@
dev->seek(prevPos + count);
res = dev->pos() - prevPos;
} else {
- char *buf = new char[count];
+ char *buf = new char[quint64(count)];
res = dev->read(buf, count);
delete[] buf;
}
@@ -89,8 +86,8 @@
QIODevice *dev = static_cast<QIODevice *>(info);
if (!dev || !buffer)
return 0;
- qint64 res = dev->write(static_cast<const char *>(buffer), count);
- return qMax(qint64(0), res);
+ qint64 res = dev->write(static_cast<const char *>(buffer), qint64(count));
+ return size_t(qMax(qint64(0), res));
}


@@ -118,22 +115,49 @@

bool QIIOFHelpers::readImage(QImageIOHandler *q_ptr, QImage *out)
{
+ QIIOFHelper h(q_ptr);
+ return h.readImage(out);
+}
+
+bool QIIOFHelpers::writeImage(QImageIOHandler *q_ptr, const QImage &in, const
QString &uti)
+{
+ QIIOFHelper h(q_ptr);
+ return h.writeImage(in, uti);
+}
+
+QIIOFHelper::QIIOFHelper(QImageIOHandler *q)
+ : q_ptr(q)
+{
+}
+
+bool QIIOFHelper::initRead()
+{
static const CGDataProviderSequentialCallbacks cgCallbacks = { 0,
&cbGetBytes, &cbSkipForward, &cbRewind, nullptr };

- if (!q_ptr || !q_ptr->device() || !out)
+ if (cgImageSource)
+ return true;
+ if (!q_ptr || !q_ptr->device())
return false;

- QCFType<CGDataProviderRef> cgDataProvider;
if (QBuffer *b = qobject_cast<QBuffer *>(q_ptr->device())) {
// do direct access to avoid data copy
const void *rawData = b->data().constData() + b->pos();
- cgDataProvider = CGDataProviderCreateWithData(nullptr, rawData,
b->data().size() - b->pos(), nullptr);
+ cgDataProvider = CGDataProviderCreateWithData(nullptr, rawData,
size_t(b->data().size() - b->pos()), nullptr);
} else {
cgDataProvider = CGDataProviderCreateSequential(q_ptr->device(),
&cgCallbacks);
}

- QCFType<CGImageSourceRef> cgImageSource =
CGImageSourceCreateWithDataProvider(cgDataProvider, nullptr);
- if (!cgImageSource)
+ cgImageSource = CGImageSourceCreateWithDataProvider(cgDataProvider,
nullptr);
+
+ if (cgImageSource)
+ cfImageDict = CGImageSourceCopyPropertiesAtIndex(cgImageSource, 0,
nullptr);
+
+ return (cgImageSource);
+}
+
+bool QIIOFHelper::readImage(QImage *out)
+{
+ if (!out || !initRead())
return false;

QCFType<CGImageRef> cgImage =
CGImageSourceCreateImageAtIndex(cgImageSource, 0, nullptr);
@@ -141,11 +165,117 @@
return false;

*out = qt_mac_toQImage(cgImage);
- return !out->isNull();
+ if (out->isNull())
+ return false;
+
+ int dpi = 0;
+ if (getIntProperty(kCGImagePropertyDPIWidth, &dpi))
+ out->setDotsPerMeterX(qRound(dpi / 0.0254f));
+ if (getIntProperty(kCGImagePropertyDPIHeight, &dpi))
+ out->setDotsPerMeterY(qRound(dpi / 0.0254f));
+
+ return true;
}

+bool QIIOFHelper::getIntProperty(CFStringRef property, int *value)
+{
+ if (!cfImageDict)
+ return false;

-bool QIIOFHelpers::writeImage(QImageIOHandler *q_ptr, const QImage &in, const
QString &uti)
+ CFNumberRef cfNumber =
static_cast<CFNumberRef>(CFDictionaryGetValue(cfImageDict, property));
+ if (cfNumber) {
+ int intVal;
+ if (CFNumberGetValue(cfNumber, kCFNumberIntType, &intVal)) {
+ if (value)
+ *value = intVal;
+ return true;
+ }
+ }
+ return false;
+}
+
+static QImageIOHandler::Transformations exif2Qt(int exifOrientation)
+{
+ switch (exifOrientation) {
+ case 1: // normal
+ return QImageIOHandler::TransformationNone;
+ case 2: // mirror horizontal
+ return QImageIOHandler::TransformationMirror;
+ case 3: // rotate 180
+ return QImageIOHandler::TransformationRotate180;
+ case 4: // mirror vertical
+ return QImageIOHandler::TransformationFlip;
+ case 5: // mirror horizontal and rotate 270 CW
+ return QImageIOHandler::TransformationFlipAndRotate90;
+ case 6: // rotate 90 CW
+ return QImageIOHandler::TransformationRotate90;
+ case 7: // mirror horizontal and rotate 90 CW
+ return QImageIOHandler::TransformationMirrorAndRotate90;
+ case 8: // rotate 270 CW
+ return QImageIOHandler::TransformationRotate270;
+ }
+ return QImageIOHandler::TransformationNone;
+}
+
+static int qt2Exif(QImageIOHandler::Transformations transformation)
+{
+ switch (transformation) {
+ case QImageIOHandler::TransformationNone:
+ return 1;
+ case QImageIOHandler::TransformationMirror:
+ return 2;
+ case QImageIOHandler::TransformationRotate180:
+ return 3;
+ case QImageIOHandler::TransformationFlip:
+ return 4;
+ case QImageIOHandler::TransformationFlipAndRotate90:
+ return 5;
+ case QImageIOHandler::TransformationRotate90:
+ return 6;
+ case QImageIOHandler::TransformationMirrorAndRotate90:
+ return 7;
+ case QImageIOHandler::TransformationRotate270:
+ return 8;
+ }
+ qWarning("Invalid Qt image transformation");
+ return 1;
+}
+
+QVariant QIIOFHelper::imageProperty(QImageIOHandler::ImageOption option)
+{
+ if (!initRead())
+ return QVariant();
+
+ switch (option) {
+ case QImageIOHandler::Size: {
+ QSize sz;
+ if (getIntProperty(kCGImagePropertyPixelWidth, &sz.rwidth())
+ && getIntProperty(kCGImagePropertyPixelHeight, &sz.rheight()))
{
+ return sz;
+ }
+ break;
+ }
+ case QImageIOHandler::ImageTransformation: {
+ int orient;
+ if (getIntProperty(kCGImagePropertyOrientation, &orient))
+ return int(exif2Qt(orient));
+ break;
+ }
+ default:
+ break;
+ }
+
+ return QVariant();
+}
+
+void QIIOFHelper::setOption(QImageIOHandler::ImageOption option, const
QVariant &value)
+{
+ if (writeOptions.size() < option + 1)
+ writeOptions.resize(option + 1);
+ writeOptions[option] = value;
+}
+
+bool QIIOFHelper::writeImage(const QImage &in, const QString &uti)
{
static const CGDataConsumerCallbacks cgCallbacks = { &cbPutBytes, nullptr
};

@@ -159,17 +289,35 @@
if (!cgImageDest || !cgImage)
return false;

- QCFType<CFNumberRef> cfVal;
- QCFType<CFDictionaryRef> cfProps;
+ QCFType<CFNumberRef> cfQuality = nullptr;
+ QCFType<CFNumberRef> cfOrientation = nullptr;
+ const void *dictKeys[2];
+ const void *dictVals[2];
+ int dictSize = 0;
+
if (q_ptr->supportsOption(QImageIOHandler::Quality)) {
bool ok = false;
- int writeQuality = q_ptr->option(QImageIOHandler::Quality).toInt(&ok);
+ int writeQuality =
writeOptions.value(QImageIOHandler::Quality).toInt(&ok);
// If quality is unset, default to 75%
- float quality = (ok && writeQuality >= 0 ? (qMin(writeQuality, 100)) :
75) / 100.0;
- cfVal = CFNumberCreate(nullptr, kCFNumberFloatType, &quality);
- cfProps = CFDictionaryCreate(nullptr, (const void
**)&kCGImageDestinationLossyCompressionQuality, (const void **)&cfVal, 1,
- &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
+ float quality = (ok && writeQuality >= 0 ? (qMin(writeQuality, 100)) :
75) / 100.0f;
+ cfQuality = CFNumberCreate(nullptr, kCFNumberFloatType, &quality);
+ dictKeys[dictSize] = static_cast<const void
*>(kCGImageDestinationLossyCompressionQuality);
+ dictVals[dictSize] = static_cast<const void *>(cfQuality);
+ dictSize++;
+ }
+ if (q_ptr->supportsOption(QImageIOHandler::ImageTransformation)) {
+ int orient =
qt2Exif(static_cast<QImageIOHandler::Transformation>(writeOptions.value(QImageIOHandler::ImageTransformation).toInt()));
+ cfOrientation = CFNumberCreate(nullptr, kCFNumberIntType, &orient);
+ dictKeys[dictSize] = static_cast<const void
*>(kCGImagePropertyOrientation);
+ dictVals[dictSize] = static_cast<const void *>(cfOrientation);
+ dictSize++;
}
+
+ QCFType<CFDictionaryRef> cfProps = nullptr;
+ if (dictSize)
+ cfProps = CFDictionaryCreate(nullptr, dictKeys, dictVals, dictSize,
+ &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
+
CGImageDestinationAddImage(cgImageDest, cgImage, cfProps);
return CGImageDestinationFinalize(cgImageDest);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/shared/qiiofhelpers_p.h

new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/shared/qiiofhelpers_p.h
---
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/shared/qiiofhelpers_p.h
2019-02-25 10:38:12.000000000 +0100
+++
new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/shared/qiiofhelpers_p.h
2019-04-02 14:10:20.000000000 +0200
@@ -52,6 +52,9 @@
//

#include <QImageIOPlugin>
+#include <private/qcore_mac_p.h>
+#include <ImageIO/ImageIO.h>
+#include <QVector>

QT_BEGIN_NAMESPACE

@@ -67,6 +70,27 @@
static bool writeImage(QImageIOHandler *q_ptr, const QImage &in, const
QString &uti);
};

+class QIIOFHelper
+{
+public:
+ QIIOFHelper(QImageIOHandler *q);
+
+ bool readImage(QImage *out);
+ bool writeImage(const QImage &in, const QString &uti);
+ QVariant imageProperty(QImageIOHandler::ImageOption option);
+ void setOption(QImageIOHandler::ImageOption option, const QVariant &value);
+
+protected:
+ bool initRead();
+ bool getIntProperty(CFStringRef property, int *value);
+
+ QImageIOHandler *q_ptr = nullptr;
+ QVector<QVariant> writeOptions;
+ QCFType<CGDataProviderRef> cgDataProvider = nullptr;
+ QCFType<CGImageSourceRef> cgImageSource = nullptr;
+ QCFType<CFDictionaryRef> cfImageDict = nullptr;
+};
+
QT_END_NAMESPACE

#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/tiff/qtiffhandler.cpp

new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/tiff/qtiffhandler.cpp
---
old/qtimageformats-everywhere-src-5.12.2/src/plugins/imageformats/tiff/qtiffhandler.cpp
2019-02-25 10:38:12.000000000 +0100
+++
new/qtimageformats-everywhere-src-5.12.3/src/plugins/imageformats/tiff/qtiffhandler.cpp
2019-04-02 14:10:20.000000000 +0200
@@ -526,7 +526,7 @@
static quint32 defaultStripSize(TIFF *tiff)
{
// Aim for 4MB strips
- qint64 scanSize = qMax(tmsize_t(1), TIFFScanlineSize(tiff));
+ qint64 scanSize = qMax(qint64(1), qint64(TIFFScanlineSize(tiff)));
qint64 numRows = (4 * 1024 * 1024) / scanSize;
quint32 reqSize = static_cast<quint32>(qBound(qint64(1), numRows,
qint64(UINT_MAX)));
return TIFFDefaultStripSize(tiff, reqSize);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtimageformats-everywhere-src-5.12.2/tests/auto/heif/tst_qheif.cpp
new/qtimageformats-everywhere-src-5.12.3/tests/auto/heif/tst_qheif.cpp
--- old/qtimageformats-everywhere-src-5.12.2/tests/auto/heif/tst_qheif.cpp
2019-02-25 10:38:12.000000000 +0100
+++ new/qtimageformats-everywhere-src-5.12.3/tests/auto/heif/tst_qheif.cpp
2019-04-02 14:10:20.000000000 +0200
@@ -37,6 +37,9 @@
void initTestCase();
void readImage_data();
void readImage();
+ void readProperties_data();
+ void readProperties();
+ void writeImage();
};

void tst_qheif::initTestCase()
@@ -49,8 +52,10 @@
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<QSize>("size");
+ QTest::addColumn<int>("transform");

- QTest::newRow("col") << QString("col320x480.heic") << QSize(320, 480);
+ QTest::newRow("col") << QString("col320x480.heic") << QSize(320, 480) <<
int(QImageIOHandler::TransformationNone);
+ QTest::newRow("rot") << QString("newlogoCCW.heic") << QSize(110, 78) <<
int(QImageIOHandler::TransformationRotate90);
}

void tst_qheif::readImage()
@@ -66,5 +71,78 @@
QCOMPARE(image.size(), size);
}

+void tst_qheif::readProperties_data()
+{
+ readImage_data();
+}
+
+void tst_qheif::readProperties()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QSize, size);
+ QFETCH(int, transform);
+
+ QSize rawSize = (transform & QImageIOHandler::TransformationRotate90) ?
size.transposed() : size;
+
+ QString path = QStringLiteral(":/heif/") + fileName;
+ QImageReader reader(path);
+ QCOMPARE(reader.size(), rawSize);
+ QCOMPARE(int(reader.transformation()), transform);
+
+ QImage image = reader.read();
+ QCOMPARE(image.size(), size);
+
+ QCOMPARE(reader.size(), rawSize);
+ QCOMPARE(int(reader.transformation()), transform);
+}
+
+void tst_qheif::writeImage()
+{
+ QImage img(20, 10, QImage::Format_ARGB32_Premultiplied);
+ img.fill(Qt::green);
+
+ QBuffer buf1, buf2;
+ QImage rimg1;
+
+ {
+ buf1.open(QIODevice::WriteOnly);
+ QImageWriter writer(&buf1, "heic");
+ QVERIFY(writer.write(img));
+ buf1.close();
+ QVERIFY(buf1.size() > 0);
+
+ buf1.open(QIODevice::ReadOnly);
+ QImageReader reader(&buf1);
+ QVERIFY(reader.read(&rimg1));
+ buf1.close();
+ QVERIFY(rimg1.size() == img.size());
+ }
+
+ {
+ buf2.open(QIODevice::WriteOnly);
+ QImageWriter writer(&buf2, "heic");
+ writer.setQuality(20);
+ QVERIFY(writer.write(img));
+ buf2.close();
+ QVERIFY(buf2.size() > 0);
+ QVERIFY(buf2.size() < buf1.size());
+ }
+
+ {
+ buf2.open(QIODevice::WriteOnly);
+ QImageWriter writer(&buf2, "heic");
+ writer.setTransformation(QImageIOHandler::TransformationRotate270);
+ QVERIFY(writer.write(img));
+ buf2.close();
+
+ QImage rimg2;
+ buf2.open(QIODevice::ReadOnly);
+ QImageReader reader(&buf2);
+ QVERIFY(reader.read(&rimg2));
+ buf2.close();
+ QVERIFY(rimg2.size() == img.size().transposed());
+ }
+}
+
QTEST_MAIN(tst_qheif)
#include "tst_qheif.moc"
Binary files
old/qtimageformats-everywhere-src-5.12.2/tests/shared/images/heif/newlogoCCW.heic
and
new/qtimageformats-everywhere-src-5.12.3/tests/shared/images/heif/newlogoCCW.heic
differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtimageformats-everywhere-src-5.12.2/tests/shared/images/heif.qrc
new/qtimageformats-everywhere-src-5.12.3/tests/shared/images/heif.qrc
--- old/qtimageformats-everywhere-src-5.12.2/tests/shared/images/heif.qrc
2019-02-25 10:38:12.000000000 +0100
+++ new/qtimageformats-everywhere-src-5.12.3/tests/shared/images/heif.qrc
2019-04-02 14:10:20.000000000 +0200
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>heif/col320x480.heic</file>
+ <file>heif/newlogoCCW.heic</file>
</qresource>
</RCC>


< Previous Next >
This Thread
  • No further messages