summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2014-01-06 07:52:54 -0500
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-11 10:37:49 +0100
commit95b6cf26837dba0ac215db552ce47031f3abfc6e (patch)
tree1ed59372fc06dd9da780c84c0229e2cc99bf94b7 /tests
parent5c4036eeb2ecdfdac5a403ce43bdd1b0c9a53efb (diff)
Add JPEG 2000 plugin.
It is moving from Qt Solutions. Change-Id: Ie0dc44d258597f871544fa43238528f42628b799 Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/jp2/jp2.pro8
-rw-r--r--tests/auto/jp2/tst_qjp2.cpp88
-rw-r--r--tests/shared/images/jp2.qrc6
-rw-r--r--tests/shared/images/jp2/logo.bmpbin0 -> 119734 bytes
-rw-r--r--tests/shared/images/jp2/logo.jp2bin0 -> 27570 bytes
6 files changed, 104 insertions, 1 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 109f216..73f1014 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -3,6 +3,7 @@ SUBDIRS = \
tga \
wbmp \
dds \
- icns
+ icns \
+ jp2
contains(QT_CONFIG, system-zlib): SUBDIRS += mng tiff
diff --git a/tests/auto/jp2/jp2.pro b/tests/auto/jp2/jp2.pro
new file mode 100644
index 0000000..26c2f83
--- /dev/null
+++ b/tests/auto/jp2/jp2.pro
@@ -0,0 +1,8 @@
+TARGET = tst_qjp2
+
+QT = core gui testlib
+CONFIG -= app_bundle
+CONFIG += testcase
+
+SOURCES += tst_qjp2.cpp
+RESOURCES += $$PWD/../../shared/images/jp2.qrc
diff --git a/tests/auto/jp2/tst_qjp2.cpp b/tests/auto/jp2/tst_qjp2.cpp
new file mode 100644
index 0000000..7608746
--- /dev/null
+++ b/tests/auto/jp2/tst_qjp2.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Petroules Corporation.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the MNG autotests in the Qt ImageFormats module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtGui/QtGui>
+
+class tst_qjp2: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void readImage_data();
+ void readImage();
+};
+
+void tst_qjp2::readImage_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QString>("referenceFileName");
+ QTest::addColumn<QSize>("size");
+
+ QTest::newRow("logo") << QString("logo.jp2") << QString("logo.bmp") << QSize(498, 80);
+}
+
+void tst_qjp2::readImage()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QString, referenceFileName);
+ QFETCH(QSize, size);
+
+ QString path = QString(":/jp2/") + fileName;
+ QImageReader reader(path);
+ QVERIFY(reader.canRead());
+ QImage image = reader.read();
+ QVERIFY(!image.isNull());
+ QCOMPARE(image.size(), size);
+
+ path = QString(":jp2/") + referenceFileName;
+ QImageReader referenceReader(path);
+ QVERIFY(referenceReader.canRead());
+ QImage referenceImage = referenceReader.read();
+ QVERIFY(!referenceImage.isNull());
+ QCOMPARE(referenceImage.size(), size);
+
+ QCOMPARE(image, referenceImage);
+}
+
+QTEST_MAIN(tst_qjp2)
+#include "tst_qjp2.moc"
diff --git a/tests/shared/images/jp2.qrc b/tests/shared/images/jp2.qrc
new file mode 100644
index 0000000..f952076
--- /dev/null
+++ b/tests/shared/images/jp2.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>jp2/logo.bmp</file>
+ <file>jp2/logo.jp2</file>
+ </qresource>
+</RCC>
diff --git a/tests/shared/images/jp2/logo.bmp b/tests/shared/images/jp2/logo.bmp
new file mode 100644
index 0000000..735ba1b
--- /dev/null
+++ b/tests/shared/images/jp2/logo.bmp
Binary files differ
diff --git a/tests/shared/images/jp2/logo.jp2 b/tests/shared/images/jp2/logo.jp2
new file mode 100644
index 0000000..f99343d
--- /dev/null
+++ b/tests/shared/images/jp2/logo.jp2
Binary files differ