summaryrefslogtreecommitdiffstats
path: root/tests/auto/qimage
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2010-11-02 14:20:38 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-11-03 10:50:48 (GMT)
commit86ea8521c6f145be24c40c799b6b4e8f6e854e2b (patch)
treebbceb07abeb3f8b974287ea648fd995b4ba8345c /tests/auto/qimage
parentd12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe (diff)
downloadQt-86ea8521c6f145be24c40c799b6b4e8f6e854e2b.zip
Qt-86ea8521c6f145be24c40c799b6b4e8f6e854e2b.tar.gz
Qt-86ea8521c6f145be24c40c799b6b4e8f6e854e2b.tar.bz2
Add member-swap to shared datatypes that don't have it.
For consistency. Merge-request: 871 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'tests/auto/qimage')
-rw-r--r--tests/auto/qimage/tst_qimage.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index 6b8028c..6cce05cd1 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -69,6 +69,7 @@ public:
tst_QImage();
private slots:
+ void swap();
void create();
void createInvalidXPM();
void createFromUChar();
@@ -155,6 +156,20 @@ tst_QImage::tst_QImage()
{
}
+void tst_QImage::swap()
+{
+ QImage i1( 16, 16, QImage::Format_RGB32 ), i2( 32, 32, QImage::Format_RGB32 );
+ i1.fill( Qt::white );
+ i2.fill( Qt::black );
+ const qint64 i1k = i1.cacheKey();
+ const qint64 i2k = i2.cacheKey();
+ i1.swap(i2);
+ QCOMPARE(i1.cacheKey(), i2k);
+ QCOMPARE(i1.size(), QSize(32,32));
+ QCOMPARE(i2.cacheKey(), i1k);
+ QCOMPARE(i2.size(), QSize(16,16));
+}
+
// Test if QImage (or any functions called from QImage) throws an
// exception when creating an extremely large image.
// QImage::create() should return "false" in this case.