Remove another fragile assumption from var prop unit test
authorChris Adams <christopher.adams@nokia.com>
Fri, 16 Dec 2011 00:58:20 +0000 (10:58 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 19 Dec 2011 00:13:43 +0000 (01:13 +0100)
Commit 32c6ba2c3802bfda11e455c8aaaee41662c237fb removed hardcoded prop
indices from one test, but missed another test case which also
hardcoded a property index.

Change-Id: Iaac863f8176d09077ce1773b642cb88a01cc3fd1
Reviewed-by: Martin Jones <martin.jones@nokia.com>

tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp

index 9bb763c..10ae0cc 100644 (file)
@@ -4044,10 +4044,11 @@ void tst_qdeclarativeecmascript::propertyVarInheritance2()
     {
         v8::HandleScope hs;
         propertyVarWeakRefCallbackCount = 0;                           // reset callback count.
-        childObjectVarArrayValueHandle = qPersistentNew(((QDeclarativeVMEMetaObject *)(childObject->metaObject()))->vmeProperty(58));
+        childObjectVarArrayValueHandle = qPersistentNew(((QDeclarativeVMEMetaObject *)(childObject->metaObject()))->vmeProperty(childObject->metaObject()->indexOfProperty("vp")));
         childObjectVarArrayValueHandle.MakeWeak(&propertyVarWeakRefCallbackCount, propertyVarWeakRefCallback);
         gc(engine);
         QVERIFY(propertyVarWeakRefCallbackCount == 0);                 // should not have been collected yet.
+        QCOMPARE(childObject->property("vp").value<QObject*>(), rootObject);
         QCOMPARE(childObject->property("textCanary").toInt(), 10);
     }
     QMetaObject::invokeMethod(object, "deassignCircular");