Update some QML tests and temporarily skip them

These tests should be skipped until the next V8 update is landed into
QtJSBackend. The expected results of these tests currently check wrong
behavior. These bugs have been already fixed in the official V8 thus we
need to update and skip them until the fix is landed into QtJSBackend.

Change-Id: I77d8ee50b45cd6599cbb5735ddef7d1461aeceab
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
Peter Varga 2012-11-23 11:03:47 +01:00 committed by The Qt Project
parent 6163ae74d5
commit 276dcc3f1f
2 changed files with 11 additions and 15 deletions

View File

@ -2226,15 +2226,12 @@ void tst_QJSEngine::jsContinueInSwitch()
void tst_QJSEngine::jsShadowReadOnlyPrototypeProperty()
{
// SpiderMonkey has different behavior than JSC and V8; it disallows
// creating a property on the instance if there's a property with the
// same name in the prototype, and that property is read-only. We
// adopted that behavior in the old (4.5) QtScript back-end, but it
// just seems weird -- and non-compliant. Adopt the JSC behavior instead.
QSKIP("Temporarily skip this test case until the next V8 update is landed into QtJSBackend.");
QJSEngine eng;
QVERIFY(eng.evaluate("o = {}; o.__proto__ = parseInt; o.length").isNumber());
QCOMPARE(eng.evaluate("o.length = 123; o.length").toInt(), 123);
QVERIFY(eng.evaluate("o.hasOwnProperty('length')").toBool());
QVERIFY(eng.evaluate("o.length = 123; o.length").toInt() != 123);
QVERIFY(!eng.evaluate("o.hasOwnProperty('length')").toBool());
}
void tst_QJSEngine::jsReservedWords_data()

View File

@ -1779,6 +1779,8 @@ Test file/lineNumbers for inline functions.
*/
void tst_qqmlecmascript::functionErrors()
{
QSKIP("Temporarily skip this test case until the next V8 update is landed into QtJSBackend.");
QQmlComponent component(&engine, testFileUrl("functionErrors.qml"));
QString url = component.url().toString();
@ -1796,10 +1798,7 @@ void tst_qqmlecmascript::functionErrors()
object = componentTwo.create();
QVERIFY(object != 0);
QString srpname = object->property("srp_name").toString();
warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object ") + srpname
+ QLatin1String(" is not a function");
warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function");
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); // we expect a meaningful warning to be printed.
QMetaObject::invokeMethod(object, "retrieveScarceResource");
delete object;
@ -4057,6 +4056,8 @@ void tst_qqmlecmascript::scarceResources_other()
/* These tests require knowledge of state, since we test values after
performing signal or function invocation. */
QSKIP("Temporarily skip this test case until the next V8 update is landed into QtJSBackend.");
QPixmap origPixmap(100, 100);
origPixmap.fill(Qt::blue);
QString srp_name, expectedWarning;
@ -4115,8 +4116,7 @@ void tst_qqmlecmascript::scarceResources_other()
QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
srp_name = object->property("srp_name").toString();
expectedWarning = varComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ") + srp_name + QLatin1String(" is not a function");
expectedWarning = varComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function");
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
QMetaObject::invokeMethod(object, "retrieveScarceResource");
QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
@ -4188,8 +4188,7 @@ void tst_qqmlecmascript::scarceResources_other()
QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
srp_name = object->property("srp_name").toString();
expectedWarning = variantComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ") + srp_name + QLatin1String(" is not a function");
expectedWarning = variantComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function");
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
QMetaObject::invokeMethod(object, "retrieveScarceResource");
QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.