summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-04-08 23:42:52 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2016-04-08 23:42:53 +0200
commitc3d188ffbbe0779a4bb62eef77b3eaa4670ea8d8 (patch)
tree05c872112283b21cbf6a1429407abb04ec88458b /tests
parenteab19a6eb3894170fcf3a91609d952d4e0335bb0 (diff)
parent50e257de2642fc980d4e82fb99d455ca784f11bd (diff)
downloadqtimageformats-c3d188ffbbe0779a4bb62eef77b3eaa4670ea8d8.tar.gz
Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: Idf9bbf8661a1589ff27e58322117d56363ec3e4a
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/jp2/tst_qjp2.cpp2
-rw-r--r--tests/auto/webp/images/kollada_animation.webpbin0 -> 24726 bytes
-rw-r--r--tests/auto/webp/tst_qwebp.cpp60
-rw-r--r--tests/auto/webp/webp.qrc1
4 files changed, 61 insertions, 2 deletions
diff --git a/tests/auto/jp2/tst_qjp2.cpp b/tests/auto/jp2/tst_qjp2.cpp
index 661a5a3..7274194 100644
--- a/tests/auto/jp2/tst_qjp2.cpp
+++ b/tests/auto/jp2/tst_qjp2.cpp
@@ -74,8 +74,6 @@ void tst_qjp2::readImage()
QImage referenceImage = referenceReader.read();
QVERIFY(!referenceImage.isNull());
QCOMPARE(referenceImage.size(), size);
-
- QCOMPARE(image, referenceImage);
}
QTEST_MAIN(tst_qjp2)
diff --git a/tests/auto/webp/images/kollada_animation.webp b/tests/auto/webp/images/kollada_animation.webp
new file mode 100644
index 0000000..c38751a
--- /dev/null
+++ b/tests/auto/webp/images/kollada_animation.webp
Binary files differ
diff --git a/tests/auto/webp/tst_qwebp.cpp b/tests/auto/webp/tst_qwebp.cpp
index 4126076..d1d30db 100644
--- a/tests/auto/webp/tst_qwebp.cpp
+++ b/tests/auto/webp/tst_qwebp.cpp
@@ -37,6 +37,8 @@ private slots:
void initTestCase();
void readImage_data();
void readImage();
+ void readAnimation_data();
+ void readAnimation();
void writeImage_data();
void writeImage();
};
@@ -69,6 +71,64 @@ void tst_qwebp::readImage()
QCOMPARE(image.size(), size);
}
+void tst_qwebp::readAnimation_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<int>("imageCount");
+ QTest::addColumn<int>("loopCount");
+ QTest::addColumn<QColor>("bgColor");
+ QTest::addColumn<QList<QRect> >("imageRects");
+ QTest::addColumn<QList<int> >("imageDelays");
+
+ QTest::newRow("kollada")
+ << QString("kollada")
+ << QSize(436, 160)
+ << 1
+ << 0
+ << QColor()
+ << (QList<QRect>() << QRect(0, 0, 436, 160))
+ << (QList<int>() << 0);
+ QTest::newRow("kollada_animation")
+ << QString("kollada_animation")
+ << QSize(536, 260)
+ << 2
+ << 2
+ << QColor(128, 128, 128, 128)
+ << (QList<QRect>() << QRect(0, 0, 436, 160) << QRect(100, 100, 436, 160))
+ << (QList<int>() << 1000 << 1200);
+}
+
+void tst_qwebp::readAnimation()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QSize, size);
+ QFETCH(int, imageCount);
+ QFETCH(int, loopCount);
+ QFETCH(QColor, bgColor);
+ QFETCH(QList<QRect>, imageRects);
+ QFETCH(QList<int>, imageDelays);
+
+ const QString path = QStringLiteral(":/images/") + fileName + QStringLiteral(".webp");
+ QImageReader reader(path);
+ QVERIFY(reader.canRead());
+ QCOMPARE(reader.size(), size);
+ QCOMPARE(reader.imageCount(), imageCount);
+ QCOMPARE(reader.loopCount(), loopCount);
+ QCOMPARE(reader.backgroundColor(), bgColor);
+
+ for (int i = 0; i < reader.imageCount(); ++i) {
+ QImage image = reader.read();
+ QVERIFY2(!image.isNull(), qPrintable(reader.errorString()));
+ QCOMPARE(image.size(), size);
+ QCOMPARE(reader.currentImageNumber(), i);
+ QCOMPARE(reader.currentImageRect(), imageRects[i]);
+ QCOMPARE(reader.nextImageDelay(), imageDelays[i]);
+ }
+
+ QVERIFY(reader.read().isNull());
+}
+
void tst_qwebp::writeImage_data()
{
QTest::addColumn<QString>("fileName");
diff --git a/tests/auto/webp/webp.qrc b/tests/auto/webp/webp.qrc
index ab0b1b2..6519e58 100644
--- a/tests/auto/webp/webp.qrc
+++ b/tests/auto/webp/webp.qrc
@@ -3,5 +3,6 @@
<file>images/kollada.png</file>
<file>images/kollada.webp</file>
<file>images/kollada_lossless.webp</file>
+ <file>images/kollada_animation.webp</file>
</qresource>
</RCC>