diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-07-28 12:06:43 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-07-28 12:08:43 (GMT) |
commit | c11ddcf4c5f47db78a07123a0d534748c0672b0a (patch) | |
tree | 90ecfeb49f4232671da581e8d02e14ffc5f00608 /tests/auto/qscriptvalue | |
parent | 09a9014ded34d58177a782b44d385edf86b61f37 (diff) | |
download | Qt-c11ddcf4c5f47db78a07123a0d534748c0672b0a.zip Qt-c11ddcf4c5f47db78a07123a0d534748c0672b0a.tar.gz Qt-c11ddcf4c5f47db78a07123a0d534748c0672b0a.tar.bz2 |
make more tests pass for QScriptValue::setProperty()
JSC doesn't provide a way of un-defining a getter/setter. If
deleting e.g. only the setter, we remember the getter, delete
the property, then re-establish the getter.
Diffstat (limited to 'tests/auto/qscriptvalue')
-rw-r--r-- | tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index c0200a3..7b7eab3 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -1849,18 +1849,19 @@ void tst_QScriptValue::getSetProperty() // kill the getter object4.setProperty("foo", QScriptValue(), QScriptValue::PropertyGetter); - QCOMPARE(object4.property("foo").isValid(), false); + QVERIFY(!(object4.propertyFlags("foo") & QScriptValue::PropertyGetter)); + QVERIFY(object4.propertyFlags("foo") & QScriptValue::PropertySetter); + QCOMPARE(object4.property("foo").isUndefined(), true); // 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); + QVERIFY(!(object4.propertyFlags("foo") & QScriptValue::PropertySetter)); // now foo is just a regular property object4.setProperty("foo", str); - QEXPECT_FAIL("", "Getter isn't called", Continue); QCOMPARE(object4.property("x").strictlyEquals(num), true); QCOMPARE(object4.property("foo").strictlyEquals(str), true); } @@ -1871,8 +1872,7 @@ void tst_QScriptValue::getSetProperty() object4.setProperty("foo", eng.newFunction(setter), QScriptValue::PropertySetter); object4.setProperty("foo", str); QCOMPARE(object4.property("x").strictlyEquals(str), true); - QEXPECT_FAIL("", "Property should be invalid now", Continue); - QCOMPARE(object4.property("foo").isValid(), false); + QCOMPARE(object4.property("foo").isUndefined(), true); // getter() returns this.x object4.setProperty("foo", eng.newFunction(getter), QScriptValue::PropertyGetter); @@ -1885,7 +1885,6 @@ void tst_QScriptValue::getSetProperty() 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 @@ -1908,13 +1907,10 @@ void tst_QScriptValue::getSetProperty() object4.setProperty("x", num); QCOMPARE(object4.property("foo").strictlyEquals(num), true); - // killing the getter will also kill the setter, since they are the same function + // killing the getter will preserve the setter, even though they are the same function object4.setProperty("foo", QScriptValue(), QScriptValue::PropertyGetter); - QCOMPARE(object4.property("foo").isValid(), false); - // now foo is just a regular property - object4.setProperty("foo", str); - QCOMPARE(object4.property("x").strictlyEquals(num), true); - QCOMPARE(object4.property("foo").strictlyEquals(str), true); + QVERIFY(object4.propertyFlags("foo") & QScriptValue::PropertySetter); + QCOMPARE(object4.property("foo").isUndefined(), true); // getter/setter that throws an error { |