summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp4
-rw-r--r--tests/auto/qimagereader/baseline/35floppy.icobin4286 -> 0 bytes
-rw-r--r--tests/auto/qimagereader/baseline/35floppy.pngbin0 -> 329 bytes
-rw-r--r--tests/auto/qimagereader/baseline/connect.pngbin0 -> 12943 bytes
-rw-r--r--tests/auto/qimagereader/baseline/kde_favicon.icobin1150 -> 0 bytes
-rw-r--r--tests/auto/qimagereader/baseline/kde_favicon.pngbin0 -> 514 bytes
-rw-r--r--tests/auto/qimagereader/baseline/semitransparent.icobin9662 -> 0 bytes
-rw-r--r--tests/auto/qimagereader/baseline/semitransparent.pngbin0 -> 545 bytes
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp13
9 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index 4f49476..b2351fa 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -556,7 +556,11 @@ QImage ICOReader::iconAt(int index)
else // # colors used
icoAttrib.ncolors = header.biClrUsed ? header.biClrUsed : 1 << icoAttrib.nbits;
icoAttrib.w = iconEntry.bWidth;
+ if (icoAttrib.w == 0)
+ icoAttrib.w = header.biWidth;
icoAttrib.h = iconEntry.bHeight;
+ if (icoAttrib.h == 0)
+ icoAttrib.h = header.biHeight/2;
QImage::Format format = QImage::Format_ARGB32;
if (icoAttrib.nbits == 24)
diff --git a/tests/auto/qimagereader/baseline/35floppy.ico b/tests/auto/qimagereader/baseline/35floppy.ico
deleted file mode 100644
index 59fd37e..0000000
--- a/tests/auto/qimagereader/baseline/35floppy.ico
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/35floppy.png b/tests/auto/qimagereader/baseline/35floppy.png
new file mode 100644
index 0000000..56b9b44
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/35floppy.png
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/connect.png b/tests/auto/qimagereader/baseline/connect.png
new file mode 100644
index 0000000..9544bb9
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/connect.png
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/kde_favicon.ico b/tests/auto/qimagereader/baseline/kde_favicon.ico
deleted file mode 100644
index 15bcdbb..0000000
--- a/tests/auto/qimagereader/baseline/kde_favicon.ico
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/kde_favicon.png b/tests/auto/qimagereader/baseline/kde_favicon.png
new file mode 100644
index 0000000..e19287b
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/kde_favicon.png
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/semitransparent.ico b/tests/auto/qimagereader/baseline/semitransparent.ico
deleted file mode 100644
index dd23de9..0000000
--- a/tests/auto/qimagereader/baseline/semitransparent.ico
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/semitransparent.png b/tests/auto/qimagereader/baseline/semitransparent.png
new file mode 100644
index 0000000..a3ad780
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/semitransparent.png
Binary files differ
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 72c5c8b..e7cfe68 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -1633,7 +1633,8 @@ void tst_QImageReader::pixelCompareWithBaseline_data()
QTest::newRow("floppy (16px,32px - 16 colors)") << "35floppy.ico";
QTest::newRow("semitransparent") << "semitransparent.ico";
- QTest::newRow("slightlybroken") << "kde_favicon.ico";
+ QTest::newRow("slightlybrokenBMPHeader") << "kde_favicon.ico";
+ QTest::newRow("sightlybrokenIconHeader") << "connect.ico";
}
void tst_QImageReader::pixelCompareWithBaseline()
@@ -1641,14 +1642,20 @@ void tst_QImageReader::pixelCompareWithBaseline()
QFETCH(QString, fileName);
QImage icoImg;
+ const QString inputFileName(QString::fromAscii("images/%1").arg(fileName));
+ QFileInfo fi(inputFileName);
+
// might fail if the plugin does not exist, which is ok.
- if (icoImg.load(QString::fromAscii("images/%1").arg(fileName))) {
- QString baselineFileName = QString::fromAscii("baseline/%1").arg(fileName);
+ if (icoImg.load(inputFileName)) {
+ icoImg = icoImg.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ const QString baselineFileName(QString::fromAscii("baseline/%1.png").arg(fi.baseName()));
#if 0
icoImg.save(baselineFileName);
#else
QImage baseImg;
QVERIFY(baseImg.load(baselineFileName));
+ baseImg = baseImg.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ QCOMPARE(int(baseImg.format()), int(icoImg.format()));
QCOMPARE(baseImg, icoImg);
#endif
}