summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-27 14:47:20 +0200
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-27 14:47:20 +0200
commit53866f3003435ccf000867b602681d7e2fab3354 (patch)
tree50f6f97b1da6766cf94bfa78ecb641f749acfea3 /tests
parent53f5b448f5dd33459837536a855463c917b4c14e (diff)
parentd60dc7cba21794866c9382f83080fab1a129eb08 (diff)
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixed performance regression in curve stroking. Don't disable texture_from_pixmap on GLX/X11 by default. Avoid creating copy of an image in memory when storing as png Doc update for the support of MSVC 2010 64-bit fix documentation of drawText(int, int, int, int, ... Optimization of pixel conversion when storing jpeg Don't pretend to support single buffered EGL surfaces. Named anonymous struct in the OpenGL paint engine. Fixes gray_raster incorrectly reporting out of memory error.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 3bee5d98aa..4b4bdd6a3b 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -178,6 +178,8 @@ private slots:
void testIgnoresFormatAndExtension_data();
void testIgnoresFormatAndExtension();
+ void saveFormat_data();
+ void saveFormat();
};
static const QLatin1String prefix(SRCDIR "/images/");
@@ -1905,5 +1907,46 @@ void tst_QImageReader::testIgnoresFormatAndExtension()
}
}
+
+void tst_QImageReader::saveFormat_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+
+ QTest::newRow("Format_Mono") << QImage::Format_Mono;
+ QTest::newRow("Format_MonoLSB") << QImage::Format_MonoLSB;
+ QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8;
+ QTest::newRow("Format_RGB32") << QImage::Format_RGB32;
+ QTest::newRow("Format_ARGB32") << QImage::Format_ARGB32;
+ QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_RGB16") << QImage::Format_RGB16;
+ QTest::newRow("Format_ARGB8565_Premultiplied") << QImage::Format_ARGB8565_Premultiplied;
+ QTest::newRow("Format_RGB666") << QImage::Format_RGB666;
+ QTest::newRow("Format_ARGB6666_Premultiplied") << QImage::Format_ARGB6666_Premultiplied;
+ QTest::newRow("Format_RGB555") << QImage::Format_RGB555;
+ QTest::newRow("Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied;
+ QTest::newRow("Format_RGB888") << QImage::Format_RGB888;
+ QTest::newRow("Format_RGB444") << QImage::Format_RGB444;
+ QTest::newRow("Format_ARGB4444_Premultiplied") << QImage::Format_ARGB4444_Premultiplied;
+}
+
+void tst_QImageReader::saveFormat()
+{
+ QFETCH(QImage::Format, format);
+
+ QImage orig(":/images/kollada.png");
+
+ QImage converted = orig.convertToFormat(format);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QVERIFY(converted.save(&buf, "png"));
+ buf.close();
+ QImage stored = QImage::fromData(buf.buffer(), "png");
+
+ stored = stored.convertToFormat(QImage::Format_ARGB32);
+ converted = converted.convertToFormat(QImage::Format_ARGB32);
+ QCOMPARE(stored, converted);
+}
+
+
QTEST_MAIN(tst_QImageReader)
#include "tst_qimagereader.moc"