summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-05-11 11:47:46 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-05-11 11:47:46 (GMT)
commit38809e24a48f6c4b148cd730a8d5d52a7525e5bd (patch)
treecdb99c093f737d5544051d779218f90b6298082a /tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
parent48257d751a76699e548e59b76fc79303ef328375 (diff)
parent92c5c75a9840853fad4f30235f9bf86dc7133fc4 (diff)
downloadQt-38809e24a48f6c4b148cd730a8d5d52a7525e5bd.zip
Qt-38809e24a48f6c4b148cd730a8d5d52a7525e5bd.tar.gz
Qt-38809e24a48f6c4b148cd730a8d5d52a7525e5bd.tar.bz2
Merge branch '4.5'
Diffstat (limited to 'tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp')
-rw-r--r--tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
index 1413b0d..257ec0b 100644
--- a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
+++ b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
@@ -68,6 +68,7 @@ private slots:
void iterateString();
void iterateGetterSetter();
void iterateArgumentsObject();
+ void assignObjectToIterator();
void undefinedBehavior();
};
@@ -562,5 +563,37 @@ void tst_QScriptValueIterator::undefinedBehavior()
QVERIFY(it.value().isNumber());
}
+void tst_QScriptValueIterator::assignObjectToIterator()
+{
+ QScriptEngine eng;
+ QScriptValue obj1 = eng.newObject();
+ obj1.setProperty("foo", 123);
+ QScriptValue obj2 = eng.newObject();
+ obj2.setProperty("bar", 456);
+
+ QScriptValueIterator it(obj1);
+ QVERIFY(it.hasNext());
+ it.next();
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+
+ it = obj1;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+}
+
QTEST_MAIN(tst_QScriptValueIterator)
#include "tst_qscriptvalueiterator.moc"