diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp index 3c97aef..d4c4caf 100644 --- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp +++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp @@ -584,6 +584,7 @@ private slots: void nestedArrayAsSlotArgument(); void nestedObjectAsSlotArgument_data(); void nestedObjectAsSlotArgument(); + void propertyAccessThroughActivationObject(); private: QScriptEngine *m_engine; @@ -3654,5 +3655,22 @@ void tst_QScriptExtQObject::nestedObjectAsSlotArgument() } } +// QTBUG-21760 +void tst_QScriptExtQObject::propertyAccessThroughActivationObject() +{ + QScriptContext *ctx = m_engine->pushContext(); + ctx->setActivationObject(m_engine->newQObject(m_myObject)); + + QVERIFY(m_engine->evaluate("intProperty").isNumber()); + QVERIFY(m_engine->evaluate("mySlot()").isUndefined()); + QVERIFY(m_engine->evaluate("mySlotWithStringArg('test')").isUndefined()); + + QVERIFY(m_engine->evaluate("dynamicProperty").isError()); + m_myObject->setProperty("dynamicProperty", 123); + QCOMPARE(m_engine->evaluate("dynamicProperty").toInt32(), 123); + + m_engine->popContext(); +} + QTEST_MAIN(tst_QScriptExtQObject) #include "tst_qscriptextqobject.moc" |