diff options
Diffstat (limited to 'tests/auto/qicoimageformat')
-rw-r--r-- | tests/auto/qicoimageformat/icons/valid/Qt.ico | bin | 0 -> 31371 bytes | |||
-rw-r--r-- | tests/auto/qicoimageformat/tst_qicoimageformat.cpp | 33 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qicoimageformat/icons/valid/Qt.ico b/tests/auto/qicoimageformat/icons/valid/Qt.ico Binary files differnew file mode 100644 index 0000000..fef1dee --- /dev/null +++ b/tests/auto/qicoimageformat/icons/valid/Qt.ico diff --git a/tests/auto/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/qicoimageformat/tst_qicoimageformat.cpp index 799a20b..95d2a6d 100644 --- a/tests/auto/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/qicoimageformat/tst_qicoimageformat.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_QIcoImageFormat::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_QIcoImageFormat::canRead() @@ -199,6 +202,7 @@ void tst_QIcoImageFormat::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_QIcoImageFormat::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_QIcoImageFormat::jumpToNextImage() @@ -275,6 +280,7 @@ void tst_QIcoImageFormat::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_QIcoImageFormat::nextImageDelay() @@ -294,6 +300,33 @@ void tst_QIcoImageFormat::nextImageDelay() } } +void tst_QIcoImageFormat::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_QIcoImageFormat::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_QIcoImageFormat) #include "tst_qicoimageformat.moc" |