diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-06-26 10:41:17 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-06-26 10:42:49 (GMT) |
commit | e1a0c7c01d494f7db194e3b5245368ba1d95c6c8 (patch) | |
tree | b670c3798de12ef88adcdf6fe1d2e212eaec3b18 /tests | |
parent | a5188742e4666f5181f85745677abfbf9e658076 (diff) | |
download | Qt-e1a0c7c01d494f7db194e3b5245368ba1d95c6c8.zip Qt-e1a0c7c01d494f7db194e3b5245368ba1d95c6c8.tar.gz Qt-e1a0c7c01d494f7db194e3b5245368ba1d95c6c8.tar.bz2 |
qtscript meta-object binding: enum properties are not deletable
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qscriptqobject/tst_qscriptqobject.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp index fa519de..d8db7b7 100644 --- a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp +++ b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp @@ -1954,7 +1954,7 @@ void tst_QScriptExtQObject::classEnums() QCOMPARE(MyQObject::Ability(m_engine->evaluate("MyQObject.AllAbility").toInt32()), MyQObject::AllAbility); - QScriptValue::PropertyFlags expectedEnumFlags = QScriptValue::ReadOnly; + QScriptValue::PropertyFlags expectedEnumFlags = QScriptValue::ReadOnly | QScriptValue::Undeletable; QCOMPARE(myClass.propertyFlags("FooPolicy"), expectedEnumFlags); QCOMPARE(myClass.propertyFlags("BarPolicy"), expectedEnumFlags); QCOMPARE(myClass.propertyFlags("BazPolicy"), expectedEnumFlags); @@ -2005,6 +2005,15 @@ void tst_QScriptExtQObject::classEnums() QCOMPARE(m_myObject->qtFunctionActuals().size(), 0); QCOMPARE(ret.isNumber(), true); } + + // enum properties are not deletable or writable + QVERIFY(!m_engine->evaluate("delete MyQObject.BazPolicy").toBool()); + myClass.setProperty("BazPolicy", QScriptValue()); + QCOMPARE(static_cast<MyQObject::Policy>(myClass.property("BazPolicy").toInt32()), + MyQObject::BazPolicy); + myClass.setProperty("BazPolicy", MyQObject::FooPolicy); + QCOMPARE(static_cast<MyQObject::Policy>(myClass.property("BazPolicy").toInt32()), + MyQObject::BazPolicy); } QT_BEGIN_NAMESPACE |