diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-05 08:09:00 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-05 08:09:00 (GMT) |
commit | bb587db95d7c20344c0bf06a1f080c0a2e4a9250 (patch) | |
tree | 50c4615c0c5908bb5a26c1a3ee121dd1f7f070be /tests/auto/qicon/tst_qicon.cpp | |
parent | f26f5b230e614faecce33cf52af0a0d62dcaddaa (diff) | |
parent | 555018baf3115cb2587d2217bf1a5b8f49564ad2 (diff) | |
download | Qt-bb587db95d7c20344c0bf06a1f080c0a2e4a9250.zip Qt-bb587db95d7c20344c0bf06a1f080c0a2e4a9250.tar.gz Qt-bb587db95d7c20344c0bf06a1f080c0a2e4a9250.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'tests/auto/qicon/tst_qicon.cpp')
-rw-r--r-- | tests/auto/qicon/tst_qicon.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp index 4e9a880..1dd223f 100644 --- a/tests/auto/qicon/tst_qicon.cpp +++ b/tests/auto/qicon/tst_qicon.cpp @@ -72,6 +72,8 @@ private slots: void svg(); void addFile(); void availableSizes(); + void streamAvailableSizes_data(); + void streamAvailableSizes(); void task184901_badCache(); void task223279_inconsistentAddFile(); @@ -540,6 +542,47 @@ void tst_QIcon::availableSizes() } } +void tst_QIcon::streamAvailableSizes_data() +{ + QTest::addColumn<QIcon>("icon"); + + QIcon icon; + icon.addFile(":/image.png", QSize(32,32)); + QTest::newRow( "32x32" ) << icon; + icon.addFile(":/image.png", QSize(64,64)); + QTest::newRow( "64x64" ) << icon; + icon.addFile(":/image.png", QSize(128,128)); + QTest::newRow( "128x128" ) << icon; + icon.addFile(":/image.png", QSize(256,256)); + QTest::newRow( "256x256" ) << icon; +} + +void tst_QIcon::streamAvailableSizes() +{ + QFETCH(QIcon, icon); + + QByteArray ba; + // write to QByteArray + { + QBuffer buffer(&ba); + buffer.open(QIODevice::WriteOnly); + QDataStream stream(&buffer); + stream << icon; + } + + // read from QByteArray + { + QBuffer buffer(&ba); + buffer.open(QIODevice::ReadOnly); + QDataStream stream(&buffer); + QIcon i; + stream >> i; + QCOMPARE(i.isNull(), icon.isNull()); + QCOMPARE(i.availableSizes(), icon.availableSizes()); + } +} + + static inline bool operator<(const QSize &lhs, const QSize &rhs) { if (lhs.width() < rhs.width()) |