summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-11 13:37:49 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-23 18:00:54 +0200
commit2f319f3be999eb2462515cfcf2dff505592e73f5 (patch)
tree0dcff72b3d4ba19ae19a05aca114e95f9da0e4e6 /tests
parentd3c985631dceef1209c74958baac881d9a67061b (diff)
Give QPixmap a move constructor
It already has a move-assignment operator, and implements swapping. This requires a specialization of the QExplicitlySharedDataPointer destructor to be forward declared, and an implementation that is identical to the default version. Otherwise we would need QPlatformPixmap to be fully defined in the public QPixmap header. Change-Id: I2651bbc29a7083a93e3b3ad671d3aeea659b7d5a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 33e8671671..39d58effd3 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -118,6 +118,7 @@ private slots:
void refUnref();
void copy();
+ void move();
void deepCopyPreservesDpr();
void dprPassthrough();
void depthOfNullObjects();
@@ -1142,6 +1143,20 @@ void tst_QPixmap::copy()
QCOMPARE(trans, transCopy);
}
+void tst_QPixmap::move()
+{
+ QPixmap moveFrom(32, 32);
+
+ QPixmap moveAssigned;
+ moveAssigned = std::move(moveFrom);
+ QVERIFY(!moveAssigned.isNull());
+ QVERIFY(moveFrom.isNull());
+
+ QPixmap moveConstructed(std::move(moveAssigned));
+ QVERIFY(moveAssigned.isNull());
+ QVERIFY(!moveConstructed.isNull());
+}
+
// QTBUG-58653: Force a deep copy of a pixmap by
// having a QPainter and check whether DevicePixelRatio is preserved
void tst_QPixmap::deepCopyPreservesDpr()