diff options
Diffstat (limited to 'tests/auto/qicoimageformat/tst_qticoimageformat.cpp')
-rw-r--r-- | tests/auto/qicoimageformat/tst_qticoimageformat.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qicoimageformat/tst_qticoimageformat.cpp b/tests/auto/qicoimageformat/tst_qticoimageformat.cpp index 51ee4aa..fbd3821 100644 --- a/tests/auto/qicoimageformat/tst_qticoimageformat.cpp +++ b/tests/auto/qicoimageformat/tst_qticoimageformat.cpp @@ -70,6 +70,8 @@ private slots: void loopCount(); void nextImageDelay_data(); void nextImageDelay(); + void pngCompression_data(); + void pngCompression(); private: QString m_IconPath; @@ -130,6 +132,7 @@ void tst_QtIcoImageFormat::canRead_data() QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << 0; QTest::newRow("103x16px, 24BPP") << "valid/trolltechlogo_tiny.ico" << 1; QTest::newRow("includes 32BPP w/alpha") << "valid/semitransparent.ico" << 1; + QTest::newRow("PNG compression") << "valid/Qt.ico" << 1; } void tst_QtIcoImageFormat::canRead() @@ -199,6 +202,7 @@ void tst_QtIcoImageFormat::imageCount_data() QTest::newRow("16px16c, 32px32c, 32px256c") << "valid/WORLDH.ico" << 3; QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << 0; QTest::newRow("includes 32BPP w/alpha") << "valid/semitransparent.ico" << 9; + QTest::newRow("PNG compression") << "valid/Qt.ico" << 4; } @@ -226,6 +230,7 @@ void tst_QtIcoImageFormat::jumpToNextImage_data() QTest::newRow("16px16c, 32px32c, 32px256c") << "valid/WORLD.ico" << 3; QTest::newRow("16px16c, 32px32c, 32px256c") << "valid/WORLDH.ico" << 3; QTest::newRow("includes 32BPP w/alpha") << "valid/semitransparent.ico" << 9; + QTest::newRow("PNG compression") << "valid/Qt.ico" << 4; } void tst_QtIcoImageFormat::jumpToNextImage() @@ -275,6 +280,7 @@ void tst_QtIcoImageFormat::nextImageDelay_data() QTest::newRow("16px16c, 32px32c, 32px256c") << "valid/WORLDH.ico" << 3; QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << -1; QTest::newRow("includes 32BPP w/alpha") << "valid/semitransparent.ico" << 9; + QTest::newRow("PNG compression") << "valid/Qt.ico" << 4; } void tst_QtIcoImageFormat::nextImageDelay() @@ -294,5 +300,32 @@ void tst_QtIcoImageFormat::nextImageDelay() } } +void tst_QtIcoImageFormat::pngCompression_data() +{ + QTest::addColumn<QString>("fileName"); + QTest::addColumn<int>("index"); + QTest::addColumn<int>("width"); + QTest::addColumn<int>("height"); + + QTest::newRow("PNG compression") << "valid/Qt.ico" << 4 << 256 << 256; +} + +void tst_QtIcoImageFormat::pngCompression() +{ + QFETCH(QString, fileName); + QFETCH(int, index); + QFETCH(int, width); + QFETCH(int, height); + + QImageReader reader(m_IconPath + "/" + fileName); + + QImage image; + reader.jumpToImage(index); + reader.read(&image); + + QCOMPARE(image.width(), width); + QCOMPARE(image.height(), height); +} + QTEST_MAIN(tst_QtIcoImageFormat) #include "tst_qticoimageformat.moc" |