From 4d92ed2203ced87802e3e91e530209619d7d2e71 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 18 Aug 2009 11:06:36 +0200 Subject: 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. --- tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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)); -- cgit v0.12