diff options
author | Robin Burchell <robin+qt@viroteck.net> | 2014-05-31 11:51:44 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-05 19:10:58 +0200 |
commit | 9e01483cdfff068517e29c674e0332818e76cb21 (patch) | |
tree | a843f62d0bd1f2ceb23f3715ded6867e71b234ea /tests | |
parent | 3b00497d50a022a359cce59696195dce43615b00 (diff) |
Make the ICO image handler capable of reading CUR files too.
This simple patch was an unfortunate victim of the Gitorious to
Gerrit transition. (https://qt.gitorious.org/qt/qt/merge_requests/1179)
As noted in the Gitorious review, a small bug in readHeader is also fixed: ||
instead of &&.
Done-with: Pali Rohár
Task-number: QTBUG-12684
Change-Id: I1fe16359b9b68c10e518904c6a5c58b00fb7379b
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gui/image/qicoimageformat/icons/valid/yellow.cur | bin | 0 -> 4286 bytes | |||
-rw-r--r-- | tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp | 19 |
2 files changed, 15 insertions, 4 deletions
diff --git a/tests/auto/gui/image/qicoimageformat/icons/valid/yellow.cur b/tests/auto/gui/image/qicoimageformat/icons/valid/yellow.cur Binary files differnew file mode 100644 index 0000000000..0a649aa7f7 --- /dev/null +++ b/tests/auto/gui/image/qicoimageformat/icons/valid/yellow.cur diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp index cd9d4b448e..71adbabb84 100644 --- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp @@ -111,9 +111,17 @@ void tst_QIcoImageFormat::cleanupTestCase() void tst_QIcoImageFormat::format() { - QImageReader reader(m_IconPath + "/valid/35FLOPPY.ICO", "ico"); - QByteArray fmt = reader.format(); - QCOMPARE(const_cast<const char*>(fmt.data()), "ico" ); + { + QImageReader reader(m_IconPath + "/valid/35FLOPPY.ICO", "ico"); + QByteArray fmt = reader.format(); + QCOMPARE(const_cast<const char*>(fmt.data()), "ico" ); + } + + { + QImageReader reader(m_IconPath + "/valid/yellow.cur", "ico"); + QByteArray fmt = reader.format(); + QCOMPARE(const_cast<const char*>(fmt.data()), "ico" ); + } } void tst_QIcoImageFormat::canRead_data() @@ -133,6 +141,7 @@ void tst_QIcoImageFormat::canRead_data() 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; + QTest::newRow("CUR file") << "valid/yellow.cur" << 1; } void tst_QIcoImageFormat::canRead() @@ -203,7 +212,7 @@ void tst_QIcoImageFormat::imageCount_data() 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; - + QTest::newRow("CUR file") << "valid/yellow.cur" << 1; } void tst_QIcoImageFormat::imageCount() @@ -231,6 +240,7 @@ void tst_QIcoImageFormat::jumpToNextImage_data() QTest::newRow("16px16c, 32px32c, 32px256c 2") << "valid/WORLDH.ico" << 3; QTest::newRow("includes 32BPP w/alpha") << "valid/semitransparent.ico" << 9; QTest::newRow("PNG compression") << "valid/Qt.ico" << 4; + QTest::newRow("CUR file") << "valid/yellow.cur" << 1; } void tst_QIcoImageFormat::jumpToNextImage() @@ -281,6 +291,7 @@ void tst_QIcoImageFormat::nextImageDelay_data() 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; + QTest::newRow("CUR file") << "valid/yellow.cur" << 1; } void tst_QIcoImageFormat::nextImageDelay() |