summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-18 09:06:36 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-18 09:06:36 (GMT)
commit4d92ed2203ced87802e3e91e530209619d7d2e71 (patch)
tree53f7389b6c4d3d7786a065e5c5b5d6f3576ed3aa /tests
parent0191608870c11db956ddc1725055bc7baf33cb39 (diff)
downloadQt-4d92ed2203ced87802e3e91e530209619d7d2e71.zip
Qt-4d92ed2203ced87802e3e91e530209619d7d2e71.tar.gz
Qt-4d92ed2203ced87802e3e91e530209619d7d2e71.tar.bz2
add a test for comparing Q{Object,Variant} wrappers from script
In the old back-end, this worked because we extended the ECMA comparison algorithm to treat QObject and QVariant wrappers specially. Instead of comparing the script objects (which would always fail), we compared the wrapped values (which could be the same in both wrappers). In the new JSC-based back-end this currently fails. We would have to add a hack (QtScript-specific ifdef) to JSC in order to support it.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 37f1c8a..87aa896 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2821,10 +2821,25 @@ void tst_QScriptValue::equals()
QScriptValue qobj2 = eng.newQObject(this);
QVERIFY(qobj1.equals(qobj2)); // compares the QObject pointers
+ QScriptValue compareFun = eng.evaluate("(function(a, b) { return a == b; })");
+ QVERIFY(compareFun.isFunction());
+ {
+ QScriptValue ret = compareFun.call(QScriptValue(), QScriptValueList() << qobj1 << qobj2);
+ QVERIFY(ret.isBool());
+ QEXPECT_FAIL("", "In JSC back-end, == on QObject wrappers doesn't work", Continue);
+ QVERIFY(ret.toBool());
+ }
+
{
QScriptValue var1 = eng.newVariant(QVariant(false));
QScriptValue var2 = eng.newVariant(QVariant(false));
QVERIFY(var1.equals(var2));
+ {
+ QScriptValue ret = compareFun.call(QScriptValue(), QScriptValueList() << var1 << var2);
+ QVERIFY(ret.isBool());
+ QEXPECT_FAIL("", "In JSC back-end, == on QVariant wrappers doesn't work", Continue);
+ QVERIFY(ret.toBool());
+ }
}
{
QScriptValue var1 = eng.newVariant(QVariant(false));