summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpixmap/tst_qpixmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qpixmap/tst_qpixmap.cpp')
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index fdf8311..551e261 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -95,6 +95,8 @@ public slots:
void cleanup();
private slots:
+ void swap();
+
void setAlphaChannel_data();
void setAlphaChannel();
@@ -247,6 +249,20 @@ void tst_QPixmap::cleanup()
{
}
+void tst_QPixmap::swap()
+{
+ QPixmap p1( 16, 16 ), p2( 32, 32 );
+ p1.fill( Qt::white );
+ p2.fill( Qt::black );
+ const qint64 p1k = p1.cacheKey();
+ const qint64 p2k = p2.cacheKey();
+ p1.swap(p2);
+ QCOMPARE(p1.cacheKey(), p2k);
+ QCOMPARE(p1.size(), QSize(32,32));
+ QCOMPARE(p2.cacheKey(), p1k);
+ QCOMPARE(p2.size(), QSize(16,16));
+}
+
void tst_QPixmap::setAlphaChannel_data()
{
QTest::addColumn<int>("red");