diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-11-03 23:18:40 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-11-03 23:21:50 (GMT) |
commit | 1c558dafd37f2e750ce9a672ba245f36dda8b42c (patch) | |
tree | f90db0496eb752842ee7d78b359f57fc6494072a /tests/auto/declarative/qmlpropertymap | |
parent | 020d4e79b1573f2eff68e148ace8180b99f1d2c4 (diff) | |
download | Qt-1c558dafd37f2e750ce9a672ba245f36dda8b42c.zip Qt-1c558dafd37f2e750ce9a672ba245f36dda8b42c.tar.gz Qt-1c558dafd37f2e750ce9a672ba245f36dda8b42c.tar.bz2 |
autotests.
Diffstat (limited to 'tests/auto/declarative/qmlpropertymap')
-rw-r--r-- | tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp b/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp index a7211bd..9be77e8 100644 --- a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp +++ b/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp @@ -55,6 +55,7 @@ public: private slots: void insert(); void operatorInsert(); + void operatorValue(); void clear(); void changed(); void count(); @@ -66,6 +67,7 @@ void tst_QmlPropertyMap::insert() map.insert(QLatin1String("key1"),100); map.insert(QLatin1String("key2"),200); QVERIFY(map.keys().count() == 2); + QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); @@ -88,6 +90,20 @@ void tst_QmlPropertyMap::operatorInsert() QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); } +void tst_QmlPropertyMap::operatorValue() +{ + QmlPropertyMap map; + map.insert(QLatin1String("key1"),100); + map.insert(QLatin1String("key2"),200); + QVERIFY(map.keys().count() == 2); + QVERIFY(map.contains(QLatin1String("key1"))); + + QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); + QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); + QCOMPARE(map[QLatin1String("key1")], map.value(QLatin1String("key1"))); + QCOMPARE(map[QLatin1String("key2")], map.value(QLatin1String("key2"))); +} + void tst_QmlPropertyMap::clear() { QmlPropertyMap map; @@ -98,6 +114,7 @@ void tst_QmlPropertyMap::clear() map.clear(QLatin1String("key1")); QVERIFY(map.keys().count() == 1); + QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key1")), QVariant()); } @@ -143,6 +160,7 @@ void tst_QmlPropertyMap::count() //clearing doesn't remove the key map.clear(QLatin1String("key3")); QCOMPARE(map.count(), 3); + QCOMPARE(map.size(), map.count()); } QTEST_MAIN(tst_QmlPropertyMap) |