summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-06-30 13:58:58 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-06-30 14:01:24 (GMT)
commit6c3412bf598c2bcf8863c08e16d7a80b119ff116 (patch)
treef8e3bd64cc47ff6ecf82c50cf6e3cab3e5e4fa5e
parent771a6a8fd6a31905859a40b729eac872efb20285 (diff)
downloadQt-6c3412bf598c2bcf8863c08e16d7a80b119ff116.zip
Qt-6c3412bf598c2bcf8863c08e16d7a80b119ff116.tar.gz
Qt-6c3412bf598c2bcf8863c08e16d7a80b119ff116.tar.bz2
add basic tests for QVariant/QObject qtscript integration
Some of the more advanced tests will fail for non-obvious reasons if these basic assumptions don't hold.
-rw-r--r--tests/auto/qscriptqobject/tst_qscriptqobject.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp
index d8db7b7..14d3283 100644
--- a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp
+++ b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp
@@ -736,6 +736,8 @@ void tst_QScriptExtQObject::getSetStaticProperty()
// test that we do value conversion if necessary when setting properties
{
QScriptValue br = m_engine->evaluate("myObject.brushProperty");
+ QVERIFY(br.isVariant());
+ QVERIFY(!br.strictlyEquals(m_engine->evaluate("myObject.brushProperty")));
QCOMPARE(qscriptvalue_cast<QBrush>(br), m_myObject->brushProperty());
QCOMPARE(qscriptvalue_cast<QColor>(br), m_myObject->brushProperty().color());
@@ -838,6 +840,14 @@ void tst_QScriptExtQObject::getSetStaticProperty()
mobj.setProperty("intProperty", m_engine->newFunction(getSetProperty),
QScriptValue::PropertyGetter | QScriptValue::PropertySetter);
}
+
+ // method properties are persistent
+ {
+ QScriptValue slot = m_engine->evaluate("myObject.mySlot");
+ QVERIFY(slot.isFunction());
+ QScriptValue sameSlot = m_engine->evaluate("myObject.mySlot");
+ QVERIFY(sameSlot.strictlyEquals(slot));
+ }
}
void tst_QScriptExtQObject::getSetDynamicProperty()