diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-17 13:22:37 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-17 13:22:37 (GMT) |
commit | ae0455673c4d9721d8a26a3a01a1b56c7e5fac8f (patch) | |
tree | 0e55c64668c4cc51c8c31ea99e0f2f5da5a6277d /tests/auto/qscriptvalueiterator | |
parent | 77c4df1325c4bae10c99978a325febada9fd82d0 (diff) | |
parent | e7907b32c323400562607253ec293e814c015f7a (diff) | |
download | Qt-ae0455673c4d9721d8a26a3a01a1b56c7e5fac8f.zip Qt-ae0455673c4d9721d8a26a3a01a1b56c7e5fac8f.tar.gz Qt-ae0455673c4d9721d8a26a3a01a1b56c7e5fac8f.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging:
Fix QScriptValueIterator::hasNext and QScriptValueIterator::hasPrevious
Diffstat (limited to 'tests/auto/qscriptvalueiterator')
-rw-r--r-- | tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp index 666eb21..eb7f94f 100644 --- a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp +++ b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp @@ -72,6 +72,7 @@ private slots: void iterateGetterSetter(); void assignObjectToIterator(); void iterateNonObject(); + void iterateOverObjectFromDeletedEngine(); }; tst_QScriptValueIterator::tst_QScriptValueIterator() @@ -604,5 +605,50 @@ void tst_QScriptValueIterator::iterateNonObject() QVERIFY(!it.hasNext()); } +void tst_QScriptValueIterator::iterateOverObjectFromDeletedEngine() +{ + QScriptEngine *engine = new QScriptEngine; + QScriptValue objet = engine->newObject(); + + // populate object with properties + QHash<QString, int> properties; + properties.insert("foo",1235); + properties.insert("oof",5321); + properties.insert("ofo",3521); + QHash<QString, int>::const_iterator i = properties.constBegin(); + for(; i != properties.constEnd(); ++i) { + objet.setProperty(i.key(), i.value()); + } + + // start iterating + QScriptValueIterator it(objet); + it.next(); + QVERIFY(properties.contains(it.name())); + + delete engine; + + QVERIFY(!objet.isValid()); + QVERIFY(it.name().isEmpty()); + QVERIFY(!it.value().isValid()); + + QVERIFY(!it.hasNext()); + it.next(); + + QVERIFY(it.name().isEmpty()); + QVERIFY(!it.scriptName().isValid()); + QVERIFY(!it.value().isValid()); + it.setValue("1234567"); + it.remove(); + + QVERIFY(!it.hasPrevious()); + it.previous(); + + QVERIFY(it.name().isEmpty()); + QVERIFY(!it.scriptName().isValid()); + QVERIFY(!it.value().isValid()); + it.setValue("1234567"); + it.remove(); +} + QTEST_MAIN(tst_QScriptValueIterator) #include "tst_qscriptvalueiterator.moc" |