summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmap
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/qmap
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/qmap')
-rw-r--r--tests/auto/qmap/tst_qmap.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qmap/tst_qmap.cpp b/tests/auto/qmap/tst_qmap.cpp
index a1b8de7..311b0b6 100644
--- a/tests/auto/qmap/tst_qmap.cpp
+++ b/tests/auto/qmap/tst_qmap.cpp
@@ -65,6 +65,8 @@ private slots:
void beginEnd();
void key();
+ void swap();
+
void operator_eq();
void empty();
@@ -392,6 +394,16 @@ void tst_QMap::key()
}
}
+void tst_QMap::swap()
+{
+ QMap<int,QString> m1, m2;
+ m1[0] = "m1[0]";
+ m2[1] = "m2[1]";
+ m1.swap(m2);
+ QCOMPARE(m1.value(1),QLatin1String("m2[1]"));
+ QCOMPARE(m2.value(0),QLatin1String("m1[0]"));
+}
+
void tst_QMap::operator_eq()
{
{