summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-07-15 14:48:03 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-07-16 09:54:57 (GMT)
commitadb1182d4cb600f48b5858dd78b4b6a6c43a89cd (patch)
treee28b463adc196baf0f507ea5239bdff5d10f76bf /tests/auto
parent7496ce1de03c9e11e710dbd4dae2056a21f5addd (diff)
downloadQt-adb1182d4cb600f48b5858dd78b4b6a6c43a89cd.zip
Qt-adb1182d4cb600f48b5858dd78b4b6a6c43a89cd.tar.gz
Qt-adb1182d4cb600f48b5858dd78b4b6a6c43a89cd.tar.bz2
Convert the strings or number value to jscvalue when they are used with an engine
Also change the stringValue not to be a pointer. This fixes a memory leak.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 0417252..0986fd3 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -1730,7 +1730,6 @@ void tst_QScriptValue::getSetProperty()
QCOMPARE(strstr.engine(), (QScriptEngine *)0);
object.setProperty("foo", strstr);
QCOMPARE(object.property("foo").toString(), strstr.toString());
- QEXPECT_FAIL("", "String engine binding not implemented", Continue);
QCOMPARE(strstr.engine(), &eng); // the value has been bound to the engine
QScriptValue numnum = QScriptValue(123.0);
@@ -1838,7 +1837,7 @@ void tst_QScriptValue::getSetProperty()
QScriptValue::PropertyGetter | QScriptValue::UserRange);
object4.setProperty("x", num);
QCOMPARE(object4.property("foo").strictlyEquals(num), true);
-
+
// setter() sets this.x
object4.setProperty("foo", eng.newFunction(setter),
QScriptValue::PropertySetter | QScriptValue::UserRange);
@@ -1848,16 +1847,16 @@ void tst_QScriptValue::getSetProperty()
object4.setProperty("foo", str);
QCOMPARE(object4.property("x").strictlyEquals(str), true);
QCOMPARE(object4.property("foo").strictlyEquals(str), true);
-
+
// kill the getter
object4.setProperty("foo", QScriptValue(), QScriptValue::PropertyGetter);
QCOMPARE(object4.property("foo").isValid(), false);
-
+
// setter should still work
object4.setProperty("foo", num);
QEXPECT_FAIL("", "Setter isn't called", Continue);
QCOMPARE(object4.property("x").strictlyEquals(num), true);
-
+
// kill the setter too
object4.setProperty("foo", QScriptValue(), QScriptValue::PropertySetter);
// now foo is just a regular property
@@ -1875,21 +1874,21 @@ void tst_QScriptValue::getSetProperty()
QCOMPARE(object4.property("x").strictlyEquals(str), true);
QEXPECT_FAIL("", "Property should be invalid now", Continue);
QCOMPARE(object4.property("foo").isValid(), false);
-
+
// getter() returns this.x
object4.setProperty("foo", eng.newFunction(getter), QScriptValue::PropertyGetter);
object4.setProperty("x", num);
QCOMPARE(object4.property("foo").strictlyEquals(num), true);
-
+
// kill the setter
object4.setProperty("foo", QScriptValue(), QScriptValue::PropertySetter);
QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setProperty() failed: property 'foo' has a getter but no setter");
object4.setProperty("foo", str);
-
+
// getter should still work
QEXPECT_FAIL("", "Getter should still work", Continue);
QCOMPARE(object4.property("foo").strictlyEquals(num), true);
-
+
// kill the getter too
object4.setProperty("foo", QScriptValue(), QScriptValue::PropertyGetter);
// now foo is just a regular property