diff options
author | Charles Yin <charles.yin@nokia.com> | 2011-03-02 01:19:07 (GMT) |
---|---|---|
committer | Charles Yin <charles.yin@nokia.com> | 2011-03-03 04:44:16 (GMT) |
commit | 9c1549371e86c95e08f7fc2e11242de12fb1e1da (patch) | |
tree | c5f1f5ce063df53beac4bf27907b996185d621c1 /tests/auto/declarative | |
parent | e1d1b65e63223e8705b8df09645f8740ab7fb80d (diff) | |
download | Qt-9c1549371e86c95e08f7fc2e11242de12fb1e1da.zip Qt-9c1549371e86c95e08f7fc2e11242de12fb1e1da.tar.gz Qt-9c1549371e86c95e08f7fc2e11242de12fb1e1da.tar.bz2 |
QDeclarativePropertyMap::keys() cannot be called from qml
Not allow create dynamic properties which are same with existing method (method, signal, slot) names.
Change-Id: I0ae64c8a6a89ef4f7614169088f7c005edad40b0
Task-number:QTBUG-17868
Reviewed-by:Martin Jones
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp index 7d746a7..e3a4723 100644 --- a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp +++ b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp @@ -76,6 +76,40 @@ void tst_QDeclarativePropertyMap::insert() map.insert(QLatin1String("key1"),"Hello World"); QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); + + //inserting property names same with existing method(signal, slot, method) names is not allowed + //QDeclarativePropertyMap has an invokable keys() method + QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols. "); + map.insert(QLatin1String("keys"), 1); + QVERIFY(map.keys().count() == 2); + QVERIFY(!map.contains(QLatin1String("keys"))); + QVERIFY(map.value(QLatin1String("keys")).isNull()); + + //QDeclarativePropertyMap has a deleteLater() slot + QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols. "); + map.insert(QLatin1String("deleteLater"), 1); + QVERIFY(map.keys().count() == 2); + QVERIFY(!map.contains(QLatin1String("deleteLater"))); + QVERIFY(map.value(QLatin1String("deleteLater")).isNull()); + + //QDeclarativePropertyMap has an valueChanged() signal + QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols. "); + map.insert(QLatin1String("valueChanged"), 1); + QVERIFY(map.keys().count() == 2); + QVERIFY(!map.contains(QLatin1String("valueChanged"))); + QVERIFY(map.value(QLatin1String("valueChanged")).isNull()); + + //but 'valueChange' should be ok + map.insert(QLatin1String("valueChange"), 1); + QVERIFY(map.keys().count() == 3); + QVERIFY(map.contains(QLatin1String("valueChange"))); + QCOMPARE(map.value(QLatin1String("valueChange")), QVariant(1)); + + //'valueCHANGED' should be ok, too + map.insert(QLatin1String("valueCHANGED"), 1); + QVERIFY(map.keys().count() == 4); + QVERIFY(map.contains(QLatin1String("valueCHANGED"))); + QCOMPARE(map.value(QLatin1String("valueCHANGED")), QVariant(1)); } void tst_QDeclarativePropertyMap::operatorInsert() |