diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-06-09 10:02:59 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-06-09 10:07:14 (GMT) |
commit | d826a08add652314bb22bee44e0d43bbd672f272 (patch) | |
tree | e47b8ab38ed4773c2b63ea7a5d7ec0f49ed9d061 /tests | |
parent | 9b88c6f485016b53d394a88106a048495cf79294 (diff) | |
download | Qt-d826a08add652314bb22bee44e0d43bbd672f272.zip Qt-d826a08add652314bb22bee44e0d43bbd672f272.tar.gz Qt-d826a08add652314bb22bee44e0d43bbd672f272.tar.bz2 |
Fix floating point exception in QImageReader::setScaledSize(QSize(0, 0))
Avoid a division by 0 when doing QImageReader::setScaledSize(QSize(0, 0))
for jpeg formats.
Reviewed-by: thierry
Task-number: 255627
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qimagereader/tst_qimagereader.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index f5313eb..0b32f0a 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -156,6 +156,9 @@ private slots: void pixelCompareWithBaseline_data(); void pixelCompareWithBaseline(); + + void task255627_setNullScaledSize_data(); + void task255627_setNullScaledSize(); }; static const QLatin1String prefix(SRCDIR "/images/"); @@ -333,6 +336,29 @@ void tst_QImageReader::setScaledSize() QCOMPARE(image.size(), newSize); } +void tst_QImageReader::task255627_setNullScaledSize_data() +{ + setScaledSize_data(); +} + +void tst_QImageReader::task255627_setNullScaledSize() +{ + QFETCH(QString, fileName); + QFETCH(QByteArray, format); + + if (!format.isEmpty() && !QImageReader::supportedImageFormats().contains(format)) + QSKIP("Qt does not support reading the \"" + format + "\" format", SkipSingle); + + QImageReader reader(prefix + fileName); + + // set a null size + reader.setScaledSize(QSize(0, 0)); + reader.setQuality(0); + QImage image = reader.read(); + QVERIFY(image.isNull()); + QCOMPARE(image.size(), QSize(0, 0)); +} + void tst_QImageReader::setClipRect_data() { QTest::addColumn<QString>("fileName"); |