summaryrefslogtreecommitdiffstats
path: root/tests/auto/qimagereader
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-06-15 11:06:19 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-06-15 12:33:51 (GMT)
commitdf55141aa260c8a10c06aa990b6f20d6fb4718f3 (patch)
tree90b6e5c168b83232187ce61cc4e5ffbf530d6118 /tests/auto/qimagereader
parentc28efecdcfdd5fa0049bf482cb102814338c0d99 (diff)
downloadQt-df55141aa260c8a10c06aa990b6f20d6fb4718f3.zip
Qt-df55141aa260c8a10c06aa990b6f20d6fb4718f3.tar.gz
Qt-df55141aa260c8a10c06aa990b6f20d6fb4718f3.tar.bz2
Fixed QImageReader::format() inconsistency.
If state is set to ReadHeader before canRead() then setFormat("png") never gets called. We should make sure that setFormat() gets set whenever canRead() returns true. Task-number: QTBUG-2263 Reviewed-by: Kent Hansen
Diffstat (limited to 'tests/auto/qimagereader')
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index aadee5b..7e57973 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -138,6 +138,9 @@ private slots:
void sizeBeforeRead_data();
void sizeBeforeRead();
+ void sizeBeforeFormat_data();
+ void sizeBeforeFormat();
+
void imageFormatBeforeRead_data();
void imageFormatBeforeRead();
@@ -706,6 +709,31 @@ void tst_QImageReader::sizeBeforeRead()
QCOMPARE(size, image.size());
}
+void tst_QImageReader::sizeBeforeFormat_data()
+{
+ imageFormat_data();
+}
+
+void tst_QImageReader::sizeBeforeFormat()
+{
+ QFETCH(QString, fileName);
+
+ QByteArray formatA, formatB;
+
+ {
+ QImageReader reader(prefix + fileName);
+ formatA = reader.format();
+ }
+
+ {
+ QImageReader reader(prefix + fileName);
+ QSize size = reader.size();
+ formatB = reader.format();
+ }
+
+ QCOMPARE(formatA, formatB);
+}
+
void tst_QImageReader::imageFormatBeforeRead_data()
{
imageFormat_data();