diff options
author | miniak <milan.burda@gmail.com> | 2009-07-20 16:47:40 (GMT) |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@trolltech.com> | 2009-07-20 16:48:50 (GMT) |
commit | a1314799a70db18d54123956b92a239bd50387a9 (patch) | |
tree | 721cdc1aee83aa320fef6cdea9f515cd93832b3e /tests/auto/qicoimageformat | |
parent | 1768c145e07417a53abeb18bebda085b21d8f1d5 (diff) | |
download | Qt-a1314799a70db18d54123956b92a239bd50387a9.zip Qt-a1314799a70db18d54123956b92a239bd50387a9.tar.gz Qt-a1314799a70db18d54123956b92a239bd50387a9.tar.bz2 |
Adding test case for PNG compression icon loading
Merge-request: 431
Reviewed-by: Joerg Bornemann <joerg.bornemann@trolltech.com>
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_qticoimageformat.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_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" |