summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpolygon/tst_qpolygon.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2010-11-02 14:20:37 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-11-03 10:50:48 (GMT)
commitd12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe (patch)
tree32306cd47731503f85a3d88881a5e28901506432 /tests/auto/qpolygon/tst_qpolygon.cpp
parent9ff533aa0ddf944b73b0c29193fc9936c644142e (diff)
downloadQt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.zip
Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.tar.gz
Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.tar.bz2
Containers: add member-swap
Member-swap is required by the STL Sequence concept, but is also needed to write exception-safe code. Merge-request: 871 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'tests/auto/qpolygon/tst_qpolygon.cpp')
-rw-r--r--tests/auto/qpolygon/tst_qpolygon.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qpolygon/tst_qpolygon.cpp b/tests/auto/qpolygon/tst_qpolygon.cpp
index eb7cbd5..a79c0c8 100644
--- a/tests/auto/qpolygon/tst_qpolygon.cpp
+++ b/tests/auto/qpolygon/tst_qpolygon.cpp
@@ -63,6 +63,7 @@ public:
private slots:
void makeEllipse();
+ void swap();
};
tst_QPolygon::tst_QPolygon()
@@ -91,5 +92,14 @@ void tst_QPolygon::makeEllipse()
QVERIFY( !err );
}
+void tst_QPolygon::swap()
+{
+ QPolygon p1(QVector<QPoint>() << QPoint(0,0) << QPoint(10,10) << QPoint(-10,10));
+ QPolygon p2(QVector<QPoint>() << QPoint(0,0) << QPoint( 0,10) << QPoint( 10,10) << QPoint(10,0));
+ p1.swap(p2);
+ QCOMPARE(p1.count(),4);
+ QCOMPARE(p2.count(),3);
+}
+
QTEST_APPLESS_MAIN(tst_QPolygon)
#include "tst_qpolygon.moc"