summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-01-31 07:01:22 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-01 13:31:19 +0100
commitf68a3dc48d8fb8c04fe49dd9e5d07d7cdd221ad1 (patch)
tree137aa3af58a368da64717d2f03cadfb9e959a2d6 /tests/benchmarks
parent261721488876e5661904b880782b0254d00c25ac (diff)
Add TIFF plugin
Moved out from qtbase. Task-number: QTBUG-23887 Change-Id: I57d30173e6624d41dba1610084a7ed949ae84d1d Reviewed-by: aavit <qt_aavit@ovi.com> Sanity-Review: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/benchmarks.pro4
-rw-r--r--tests/benchmarks/tiff/tiff.pro10
-rw-r--r--tests/benchmarks/tiff/tst_qtiff.cpp151
3 files changed, 163 insertions, 2 deletions
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index bd41748..793221c 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
-SUBDIRS = \
- mng
+SUBDIRS =
+contains(QT_CONFIG, system-zlib): SUBDIRS += mng tiff
diff --git a/tests/benchmarks/tiff/tiff.pro b/tests/benchmarks/tiff/tiff.pro
new file mode 100644
index 0000000..61187d6
--- /dev/null
+++ b/tests/benchmarks/tiff/tiff.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+TARGET = tst_bench_qtiff
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT = core gui testlib
+CONFIG -= app_bundle
+
+SOURCES += tst_qtiff.cpp
+RESOURCES += ../../shared/images/tiff.qrc
diff --git a/tests/benchmarks/tiff/tst_qtiff.cpp b/tests/benchmarks/tiff/tst_qtiff.cpp
new file mode 100644
index 0000000..7b02a4d
--- /dev/null
+++ b/tests/benchmarks/tiff/tst_qtiff.cpp
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtAddOn.ImageFormats module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtGui/QtGui>
+
+class tst_qtiff: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+
+ void readImage_data();
+ void readImage();
+ void readCorruptImage_data();
+ void readCorruptImage();
+
+private:
+ QString prefix;
+};
+
+void tst_qtiff::initTestCase()
+{
+ prefix = ":/tiff/";
+}
+
+void tst_qtiff::readImage_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QSize>("size");
+
+ QTest::newRow("grayscale-ref") << QString("grayscale-ref.tif") << QSize(320, 200);
+ QTest::newRow("grayscale") << QString("grayscale.tif") << QSize(320, 200);
+ QTest::newRow("image_100dpi") << QString("image_100dpi.tif") << QSize(22, 22);
+ QTest::newRow("image") << QString("image.tif") << QSize(22, 22);
+ QTest::newRow("indexed_orientation_1") << QString("indexed_orientation_1.tiff") << QSize(64, 64);
+ QTest::newRow("indexed_orientation_2") << QString("indexed_orientation_2.tiff") << QSize(64, 64);
+ QTest::newRow("indexed_orientation_3") << QString("indexed_orientation_3.tiff") << QSize(64, 64);
+ QTest::newRow("indexed_orientation_4") << QString("indexed_orientation_4.tiff") << QSize(64, 64);
+ QTest::newRow("indexed_orientation_5") << QString("indexed_orientation_5.tiff") << QSize(64, 64);
+ QTest::newRow("indexed_orientation_6") << QString("indexed_orientation_6.tiff") << QSize(64, 64);
+ QTest::newRow("indexed_orientation_7") << QString("indexed_orientation_7.tiff") << QSize(64, 64);
+ QTest::newRow("indexed_orientation_8") << QString("indexed_orientation_8.tiff") << QSize(64, 64);
+ QTest::newRow("mono_orientation_1") << QString("mono_orientation_1.tiff") << QSize(64, 64);
+ QTest::newRow("mono_orientation_2") << QString("mono_orientation_2.tiff") << QSize(64, 64);
+ QTest::newRow("mono_orientation_3") << QString("mono_orientation_3.tiff") << QSize(64, 64);
+ QTest::newRow("mono_orientation_4") << QString("mono_orientation_4.tiff") << QSize(64, 64);
+ QTest::newRow("mono_orientation_5") << QString("mono_orientation_5.tiff") << QSize(64, 64);
+ QTest::newRow("mono_orientation_6") << QString("mono_orientation_6.tiff") << QSize(64, 64);
+ QTest::newRow("mono_orientation_7") << QString("mono_orientation_7.tiff") << QSize(64, 64);
+ QTest::newRow("mono_orientation_8") << QString("mono_orientation_8.tiff") << QSize(64, 64);
+ QTest::newRow("original_indexed") << QString("original_indexed.tiff") << QSize(64, 64);
+ QTest::newRow("original_mono") << QString("original_mono.tiff") << QSize(64, 64);
+ QTest::newRow("original_rgb") << QString("original_rgb.tiff") << QSize(64, 64);
+ QTest::newRow("rgba_adobedeflate_littleendian") << QString("rgba_adobedeflate_littleendian.tif") << QSize(200, 200);
+ QTest::newRow("rgba_lzw_littleendian") << QString("rgba_lzw_littleendian.tif") << QSize(200, 200);
+ QTest::newRow("rgba_nocompression_bigendian") << QString("rgba_nocompression_bigendian.tif") << QSize(200, 200);
+ QTest::newRow("rgba_nocompression_littleendian") << QString("rgba_nocompression_littleendian.tif") << QSize(200, 200);
+ QTest::newRow("rgba_packbits_littleendian") << QString("rgba_packbits_littleendian.tif") << QSize(200, 200);
+ QTest::newRow("rgba_zipdeflate_littleendian") << QString("rgba_zipdeflate_littleendian.tif") << QSize(200, 200);
+ QTest::newRow("rgb_orientation_1") << QString("rgb_orientation_1.tiff") << QSize(64, 64);
+ QTest::newRow("rgb_orientation_2") << QString("rgb_orientation_2.tiff") << QSize(64, 64);
+ QTest::newRow("rgb_orientation_3") << QString("rgb_orientation_3.tiff") << QSize(64, 64);
+ QTest::newRow("rgb_orientation_4") << QString("rgb_orientation_4.tiff") << QSize(64, 64);
+ QTest::newRow("rgb_orientation_5") << QString("rgb_orientation_5.tiff") << QSize(64, 64);
+ QTest::newRow("rgb_orientation_6") << QString("rgb_orientation_6.tiff") << QSize(64, 64);
+ QTest::newRow("rgb_orientation_7") << QString("rgb_orientation_7.tiff") << QSize(64, 64);
+ QTest::newRow("rgb_orientation_8") << QString("rgb_orientation_8.tiff") << QSize(64, 64);
+ QTest::newRow("teapot") << QString("teapot.tiff") << QSize(256, 256);
+}
+
+void tst_qtiff::readImage()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QSize, size);
+
+ QString path = prefix + fileName;
+ QBENCHMARK {
+ QImageReader reader(path);
+ QVERIFY(reader.canRead());
+ QImage image = reader.read();
+ QVERIFY(!image.isNull());
+ QCOMPARE(image.size(), size);
+ }
+}
+
+void tst_qtiff::readCorruptImage_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QString>("message");
+
+ QTest::newRow("corrupt-data") << QString("corrupt-data.tif") << QString();
+}
+
+void tst_qtiff::readCorruptImage()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QString, message);
+
+ QString path = prefix + fileName;
+ QBENCHMARK {
+ QImageReader reader(path);
+ if (!message.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, message.toLatin1());
+ QVERIFY(reader.canRead());
+ QImage image = reader.read();
+ QVERIFY(image.isNull());
+ }
+}
+
+QTEST_MAIN(tst_qtiff)
+#include "tst_qtiff.moc"