diff options
author | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2010-07-28 11:57:53 (GMT) |
---|---|---|
committer | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2010-07-28 11:57:53 (GMT) |
commit | 457539959363245082add602c186239be0f71af1 (patch) | |
tree | ff02beaf9a105b030f4e0f13ffede66c9b14623c /tests/auto/qscriptvalue | |
parent | 2636e58e748d066096472bc9822f89ba9d4b47a3 (diff) | |
download | Qt-457539959363245082add602c186239be0f71af1.zip Qt-457539959363245082add602c186239be0f71af1.tar.gz Qt-457539959363245082add602c186239be0f71af1.tar.bz2 |
Increase test coverage for QScriptValue.
New test value for tst_QScriptValue::getSetData testcase. Setting data
is allowed only for an object.
Reviewed-by: Kent Hansen
Diffstat (limited to 'tests/auto/qscriptvalue')
-rw-r--r-- | tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 8aa4e711..1d8706c 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2234,19 +2234,36 @@ void tst_QScriptValue::getSetScope() void tst_QScriptValue::getSetData() { QScriptEngine eng; - QScriptValue object = eng.newObject(); - QVERIFY(!object.data().isValid()); - QScriptValue v1(true); - object.setData(v1); - QVERIFY(object.data().strictlyEquals(v1)); - QScriptValue v2(123); - object.setData(v2); - QVERIFY(object.data().strictlyEquals(v2)); - QScriptValue v3 = eng.newObject(); - object.setData(v3); - QVERIFY(object.data().strictlyEquals(v3)); - object.setData(QScriptValue()); - QVERIFY(!object.data().isValid()); + { + QScriptValue object = eng.newObject(); + QVERIFY(!object.data().isValid()); + QScriptValue v1(true); + object.setData(v1); + QVERIFY(object.data().strictlyEquals(v1)); + QScriptValue v2(123); + object.setData(v2); + QVERIFY(object.data().strictlyEquals(v2)); + QScriptValue v3 = eng.newObject(); + object.setData(v3); + QVERIFY(object.data().strictlyEquals(v3)); + object.setData(QScriptValue()); + QVERIFY(!object.data().isValid()); + } + { + QScriptValue value = eng.undefinedValue(); + QVERIFY(!value.data().isValid()); + QScriptValue v1(true); + value.setData(v1); + QVERIFY(!value.data().isValid()); + QScriptValue v2(123); + value.setData(v2); + QVERIFY(!value.data().isValid()); + QScriptValue v3 = eng.newObject(); + value.setData(v3); + QVERIFY(!value.data().isValid()); + value.setData(QScriptValue()); + QVERIFY(!value.data().isValid()); + } } class TestScriptClass : public QScriptClass |