diff options
Diffstat (limited to 'tests/auto/qvariant')
-rw-r--r-- | tests/auto/qvariant/tst_qvariant.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 24bfffc..62babdb 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -100,6 +100,7 @@ private slots: void constructor(); void copy_constructor(); void isNull(); + void swap(); void canConvert_data(); void canConvert(); @@ -372,6 +373,16 @@ void tst_QVariant::isNull() QVERIFY(var7.isNull()); } +void tst_QVariant::swap() +{ + QVariant v1 = 1, v2 = 2.0; + v1.swap(v2); + QCOMPARE(v1.type(),QVariant::Double); + QCOMPARE(v1.toDouble(),2.0); + QCOMPARE(v2.type(),QVariant::Int); + QCOMPARE(v2.toInt(),1); +} + void tst_QVariant::canConvert_data() { QTest::addColumn<QVariant>("val"); |