summaryrefslogtreecommitdiffstats
path: root/tests/auto/qicon
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-06-02 08:14:04 (GMT)
committeraxis <qt-info@nokia.com>2009-06-02 08:14:04 (GMT)
commit3c594257c4aedf113de92c5888e74f676ba87385 (patch)
treee309c7502e13f552203b509494a20792125fed29 /tests/auto/qicon
parent539989f41316329e7aba69ba97e1579eed6036e6 (diff)
parent0ff7b68f2e3f184d809cf6fd13ff930efa493e9f (diff)
downloadQt-3c594257c4aedf113de92c5888e74f676ba87385.zip
Qt-3c594257c4aedf113de92c5888e74f676ba87385.tar.gz
Qt-3c594257c4aedf113de92c5888e74f676ba87385.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: configure.exe examples/itemviews/puzzle/puzzle.pro examples/qtconcurrent/imagescaling/imagescaling.pro examples/widgets/movie/movie.pro tools/configure/configureapp.cpp Will rebuild configure.exe in next commit.
Diffstat (limited to 'tests/auto/qicon')
-rw-r--r--tests/auto/qicon/tst_qicon.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp
index c7bee47..4cbc0e7 100644
--- a/tests/auto/qicon/tst_qicon.cpp
+++ b/tests/auto/qicon/tst_qicon.cpp
@@ -76,6 +76,8 @@ private slots:
void svg();
void addFile();
void availableSizes();
+ void streamAvailableSizes_data();
+ void streamAvailableSizes();
void task184901_badCache();
void task223279_inconsistentAddFile();
@@ -541,6 +543,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())