diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-26 11:34:42 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-26 11:37:24 (GMT) |
commit | 5a22a926f8f10597a431036533550f05fdf52d85 (patch) | |
tree | 0c5702cd4acff056c32f6949fe19b95a0de7c8eb /tests/auto/qscriptengine | |
parent | 878569545a06a904635b273c862a0c41dba298e2 (diff) | |
download | Qt-5a22a926f8f10597a431036533550f05fdf52d85.zip Qt-5a22a926f8f10597a431036533550f05fdf52d85.tar.gz Qt-5a22a926f8f10597a431036533550f05fdf52d85.tar.bz2 |
implement proxying of JSObject::putWithAttributes() on Global Object
Otherwise the property is stored on the wrong object (the proxy).
This fix makes the Qt bindings generated by qtscriptgenerator work
again.
Diffstat (limited to 'tests/auto/qscriptengine')
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index df74144..b0ba922 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1107,6 +1107,31 @@ void tst_QScriptEngine::globalObjectProperties() } } QVERIFY(remainingNames.isEmpty()); + + // create property with no attributes + { + QString name = QString::fromLatin1("foo"); + QVERIFY(!global.property(name).isValid()); + QScriptValue val(123); + global.setProperty(name, val); + QVERIFY(global.property(name).equals(val)); + QVERIFY(global.propertyFlags(name) == 0); + global.setProperty(name, QScriptValue()); + QVERIFY(!global.property(name).isValid()); + } + // create property with attributes + { + QString name = QString::fromLatin1("bar"); + QVERIFY(!global.property(name).isValid()); + QScriptValue val(QString::fromLatin1("ciao")); + QScriptValue::PropertyFlags flags = QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration; + global.setProperty(name, val, flags); + QVERIFY(global.property(name).equals(val)); + QEXPECT_FAIL("", "custom Global Object properties don't retain attributes", Continue); + QCOMPARE(global.propertyFlags(name), flags); + global.setProperty(name, QScriptValue()); + QVERIFY(!global.property(name).isValid()); + } } void tst_QScriptEngine::globalObjectGetterSetterProperty() |