aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-03-23 14:16:43 +1000
committerQt by Nokia <qt-info@nokia.com>2012-08-27 05:17:13 +0200
commit965588737321d10fd1fbca3f89b4c6257b7b5d47 (patch)
tree95d069b6ce910c4f8bf8f71d50bebc4fe35a6b1f /tests
parent4a161cfa0cf9167b575bdf7ff5685b9bf17c6960 (diff)
Restrict v8 property lookup to the execution context
When resolving property names, only properties known to the current context of execution should be available. If a property name has been overriden by a component extension, code executing in the context of the base component should resolve the property name to the property available inside the base component or its bases. Task-number: QTBUG-24891 Change-Id: I9687cc28e108226d5a939627a901c8254344b598 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/BaseComponent2.qml34
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.2.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.7.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.8.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyOverride.qml104
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.cpp3
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp12
-rw-r--r--tests/auto/qml/qqmllanguage/data/MyBaseComponent.qml24
-rw-r--r--tests/auto/qml/qqmllanguage/data/scopedProperties.qml24
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp11
-rw-r--r--tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp77
11 files changed, 279 insertions, 37 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/BaseComponent2.qml b/tests/auto/qml/qqmlecmascript/data/BaseComponent2.qml
new file mode 100644
index 0000000000..4f99a3db68
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/BaseComponent2.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item {
+ id: base
+
+ property int directProperty: 333
+ function getDirectFromBase() { return directProperty }
+
+ property alias baseDirectAlias: base.directProperty
+
+ property Item objectProperty: Item { width: 333 }
+
+ property int optimizedBoundProperty: objectProperty.width
+ function getOptimizedBoundFromBase() { return optimizedBoundProperty }
+
+ property alias baseOptimizedBoundAlias: base.optimizedBoundProperty
+
+ property int unoptimizedBoundProperty: if (true) objectProperty.width
+ function getUnoptimizedBoundFromBase() { return unoptimizedBoundProperty }
+
+ property alias baseUnoptimizedBoundAlias: base.unoptimizedBoundProperty
+
+ property int baseDirectPropertyChangedValue: 0
+ onDirectPropertyChanged: baseDirectPropertyChangedValue = directProperty
+
+ property int baseOptimizedBoundPropertyChangedValue: 0
+ onOptimizedBoundPropertyChanged: baseOptimizedBoundPropertyChangedValue = optimizedBoundProperty
+
+ property int baseUnoptimizedBoundPropertyChangedValue: 0
+ onUnoptimizedBoundPropertyChanged: baseUnoptimizedBoundPropertyChangedValue = unoptimizedBoundProperty
+
+ function setDirectFromBase(n) { directProperty = n }
+ function setBoundFromBase(n) { objectProperty.width = n }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.2.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.2.qml
index c33c8959f0..7cfc9a39e0 100644
--- a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.2.qml
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.2.qml
@@ -8,5 +8,8 @@ Item {
property Text baz: Text { width: 200 }
}
- Component.onCompleted: success = (foo.bar == '200')
+ // With contextual lookup, 'bar' is resolved in the BaseComponent context,
+ // and refers to the 'baz' defined there; in this context, however, 'baz'
+ // resolves to the override defined in 'foo'
+ Component.onCompleted: success = (foo.bar == 100) && (foo.baz.width == 200)
}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.7.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.7.qml
new file mode 100644
index 0000000000..2fc272decd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.7.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test.fallbackBindingsItem 1.0
+
+Item {
+ property bool success: false
+
+ property FallbackBindingsType foo: FallbackBindingsType {}
+ property var test: foo.test
+
+ Component.onCompleted: success = (test == 100)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.8.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.8.qml
new file mode 100644
index 0000000000..14aeed9e60
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.8.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test.fallbackBindingsItem 1.0
+
+Item {
+ property bool success: false
+
+ property FallbackBindingsType foo: FallbackBindingsDerivedType {}
+ property var test: foo.test
+
+ Component.onCompleted: success = (test == 'hello')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyOverride.qml b/tests/auto/qml/qqmlecmascript/data/propertyOverride.qml
new file mode 100644
index 0000000000..bd3fed479b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyOverride.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ BaseComponent2 {
+ id: foo
+
+ // Override the properties of the base component
+ property string directProperty: 'hello'
+ function getDirectFromExtension() { return directProperty }
+
+ property alias extensionDirectAlias: foo.directProperty
+
+ property Text objectProperty: Text { width: 666 }
+
+ property int optimizedBoundProperty: objectProperty.width
+ function getOptimizedBoundFromExtension() { return optimizedBoundProperty }
+
+ property alias extensionOptimizedBoundAlias: foo.optimizedBoundProperty
+
+ property int unoptimizedBoundProperty: if (true) objectProperty.width
+ function getUnoptimizedBoundFromExtension() { return unoptimizedBoundProperty }
+
+ property alias extensionUnoptimizedBoundAlias: foo.unoptimizedBoundProperty
+
+ property string extensionDirectPropertyChangedValue: ''
+ onDirectPropertyChanged: extensionDirectPropertyChangedValue = directProperty
+
+ property int extensionOptimizedBoundPropertyChangedValue: 0
+ onOptimizedBoundPropertyChanged: extensionOptimizedBoundPropertyChangedValue = optimizedBoundProperty
+
+ property int extensionUnoptimizedBoundPropertyChangedValue: 0
+ onUnoptimizedBoundPropertyChanged: extensionUnoptimizedBoundPropertyChangedValue = unoptimizedBoundProperty
+
+ function setDirectFromExtension(n) { directProperty = n }
+ function setBoundFromExtension(n) { objectProperty.width = n }
+ }
+
+ Component.onCompleted: {
+ // In the base component, overriding should not affect resolution
+ if (foo.getDirectFromBase() != 333) return
+ if (foo.getOptimizedBoundFromBase() != 333) return
+ if (foo.getUnoptimizedBoundFromBase() != 333) return
+
+ // In the extension component overriding should occur
+ if (foo.getDirectFromExtension() != 'hello') return
+ if (foo.getOptimizedBoundFromExtension() != 666) return
+ if (foo.getUnoptimizedBoundFromExtension() != 666) return
+
+ // External access should yield extension component scoping
+ if (foo.directProperty != 'hello') return
+ if (foo.optimizedBoundProperty != 666) return
+ if (foo.unoptimizedBoundProperty != 666) return
+
+ // Verify alias properties bind to the correct target
+ if (foo.baseDirectAlias != 333) return
+ if (foo.baseOptimizedBoundAlias != 333) return
+ if (foo.baseUnoptimizedBoundAlias != 333) return
+
+ if (foo.extensionDirectAlias != 'hello') return
+ if (foo.extensionOptimizedBoundAlias != 666) return
+ if (foo.extensionUnoptimizedBoundAlias != 666) return
+
+ foo.baseDirectPropertyChangedValue = 0
+ foo.baseOptimizedBoundPropertyChangedValue = 0
+ foo.baseUnoptimizedBoundPropertyChangedValue = 0
+ foo.extensionDirectPropertyChangedValue = ''
+ foo.extensionOptimizedBoundPropertyChangedValue = 0
+ foo.extensionUnoptimizedBoundPropertyChangedValue = 0
+
+ // Verify that the correct onChanged signal is emitted
+ foo.setDirectFromBase(999)
+ if (foo.getDirectFromBase() != 999) return
+ if (foo.baseDirectPropertyChangedValue != 999) return
+ if (foo.extensionDirectPropertyChangedValue != '') return
+
+ foo.setDirectFromExtension('goodbye')
+ if (foo.getDirectFromExtension() != 'goodbye') return
+ if (foo.extensionDirectPropertyChangedValue != 'goodbye') return
+ if (foo.baseDirectPropertyChangedValue != 999) return
+
+ foo.setBoundFromBase(999)
+ if (foo.getOptimizedBoundFromBase() != 999) return
+ if (foo.getUnoptimizedBoundFromBase() != 999) return
+ if (foo.baseOptimizedBoundPropertyChangedValue != 999) return
+ if (foo.baseUnoptimizedBoundPropertyChangedValue != 999) return
+ if (foo.extensionOptimizedBoundPropertyChangedValue != 0) return
+ if (foo.extensionUnoptimizedBoundPropertyChangedValue != 0) return
+
+ foo.baseOptimizedBoundPropertyChangedValue = 0
+ foo.baseUnoptimizedBoundPropertyChangedValue = 0
+
+ foo.setBoundFromExtension(123)
+ if (foo.getOptimizedBoundFromExtension() != 123) return
+ if (foo.getUnoptimizedBoundFromExtension() != 123) return
+ if (foo.extensionOptimizedBoundPropertyChangedValue != 123) return
+ if (foo.extensionUnoptimizedBoundPropertyChangedValue != 123) return
+ if (foo.baseOptimizedBoundPropertyChangedValue != 0) return
+ if (foo.baseUnoptimizedBoundPropertyChangedValue != 0) return
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp
index a0bdbb6156..72c9757450 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.cpp
+++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp
@@ -300,6 +300,9 @@ void registerTypes()
qmlRegisterSingletonType<FallbackBindingsObject>("Qt.test.fallbackBindingsObject", 1, 0, "Fallback", fallback_bindings_object);
qmlRegisterSingletonType<FallbackBindingsObject>("Qt.test.fallbackBindingsDerived", 1, 0, "Fallback", fallback_bindings_derived);
+ qmlRegisterType<FallbackBindingsObject>("Qt.test.fallbackBindingsItem", 1, 0, "FallbackBindingsType");
+ qmlRegisterType<FallbackBindingsDerived>("Qt.test.fallbackBindingsItem", 1, 0, "FallbackBindingsDerivedType");
+
qmlRegisterType<FallbackBindingsTypeObject>("Qt.test.fallbackBindingsObject", 1, 0, "FallbackBindingsType");
qmlRegisterType<FallbackBindingsTypeDerived>("Qt.test.fallbackBindingsDerived", 1, 0, "FallbackBindingsType");
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 81f682f098..10425db0d1 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -282,6 +282,7 @@ private slots:
void overrideDataAssert();
void fallbackBindings_data();
void fallbackBindings();
+ void propertyOverride();
void concatenatedStringPropertyAccess();
private:
@@ -7255,6 +7256,8 @@ void tst_qqmlecmascript::fallbackBindings_data()
QTest::newRow("SingletonType fallback") << "fallbackBindings.4.qml";
QTest::newRow("Attached without fallback") << "fallbackBindings.5.qml";
QTest::newRow("Attached fallback") << "fallbackBindings.6.qml";
+ QTest::newRow("Subproperty without fallback") << "fallbackBindings.7.qml";
+ QTest::newRow("Subproperty fallback") << "fallbackBindings.8.qml";
}
void tst_qqmlecmascript::fallbackBindings()
@@ -7268,6 +7271,15 @@ void tst_qqmlecmascript::fallbackBindings()
QCOMPARE(object->property("success").toBool(), true);
}
+void tst_qqmlecmascript::propertyOverride()
+{
+ QQmlComponent component(&engine, testFileUrl("propertyOverride.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("success").toBool(), true);
+}
+
void tst_qqmlecmascript::sequenceSort_data()
{
QTest::addColumn<QString>("function");
diff --git a/tests/auto/qml/qqmllanguage/data/MyBaseComponent.qml b/tests/auto/qml/qqmllanguage/data/MyBaseComponent.qml
new file mode 100644
index 0000000000..dda4c486b2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/MyBaseComponent.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+QtObject {
+ id: base
+
+ property bool baseSuccess: false
+
+ property string baseProperty: 'foo'
+ property string boundProperty: baseProperty
+ property alias aliasProperty: base.baseProperty
+
+ function basePropertiesTest(expected) {
+ return (baseProperty == expected &&
+ boundProperty == expected &&
+ aliasProperty == expected);
+ }
+
+ Component.onCompleted: {
+ if (basePropertiesTest('foo')) {
+ baseProperty = 'bar';
+ baseSuccess = basePropertiesTest('bar');
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/scopedProperties.qml b/tests/auto/qml/qqmllanguage/data/scopedProperties.qml
new file mode 100644
index 0000000000..6e3a46d754
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scopedProperties.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+MyBaseComponent {
+ id: extended
+
+ property bool success: false
+
+ property int baseProperty: 666
+ property int boundProperty: baseProperty
+ property alias aliasProperty: extended.baseProperty
+
+ function extendedPropertiesTest(expected) {
+ return (baseProperty == expected &&
+ boundProperty == expected &&
+ aliasProperty == expected);
+ }
+
+ Component.onCompleted: {
+ if (basePropertiesTest('bar') && extendedPropertiesTest(666)) {
+ baseProperty = 999;
+ success = extendedPropertiesTest(999) && baseSuccess;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 50e93ca3c2..2a09ef2848 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -186,6 +186,8 @@ private slots:
void objectDeletionNotify_data();
void objectDeletionNotify();
+ void scopedProperties();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@@ -3111,6 +3113,15 @@ void tst_qqmllanguage::objectDeletionNotify()
delete object;
}
+void tst_qqmllanguage::scopedProperties()
+{
+ QQmlComponent component(&engine, testFile("scopedProperties.qml"));
+
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(o != 0);
+ QVERIFY(o->property("success").toBool());
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"
diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
index de3c0412fb..a0b1b99f21 100644
--- a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
+++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
@@ -102,6 +102,11 @@ Q_SIGNALS:
void signalB();
};
+QQmlPropertyData *cacheProperty(QQmlPropertyCache *cache, const char *name)
+{
+ return cache->property(QLatin1String(name), 0, 0);
+}
+
void tst_qqmlpropertycache::properties()
{
QQmlEngine engine;
@@ -111,16 +116,16 @@ void tst_qqmlpropertycache::properties()
QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(&engine, metaObject));
QQmlPropertyData *data;
- QVERIFY(data = cache->property(QLatin1String("propertyA")));
+ QVERIFY(data = cacheProperty(cache, "propertyA"));
QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyA"));
- QVERIFY(data = cache->property(QLatin1String("propertyB")));
+ QVERIFY(data = cacheProperty(cache, "propertyB"));
QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyB"));
- QVERIFY(data = cache->property(QLatin1String("propertyC")));
+ QVERIFY(data = cacheProperty(cache, "propertyC"));
QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyC"));
- QVERIFY(data = cache->property(QLatin1String("propertyD")));
+ QVERIFY(data = cacheProperty(cache, "propertyD"));
QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyD"));
}
@@ -134,16 +139,16 @@ void tst_qqmlpropertycache::propertiesDerived()
QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(&engine, object.metaObject()));
QQmlPropertyData *data;
- QVERIFY(data = cache->property(QLatin1String("propertyA")));
+ QVERIFY(data = cacheProperty(cache, "propertyA"));
QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyA"));
- QVERIFY(data = cache->property(QLatin1String("propertyB")));
+ QVERIFY(data = cacheProperty(cache, "propertyB"));
QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyB"));
- QVERIFY(data = cache->property(QLatin1String("propertyC")));
+ QVERIFY(data = cacheProperty(cache, "propertyC"));
QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyC"));
- QVERIFY(data = cache->property(QLatin1String("propertyD")));
+ QVERIFY(data = cacheProperty(cache, "propertyD"));
QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyD"));
}
@@ -156,28 +161,28 @@ void tst_qqmlpropertycache::methods()
QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(&engine, metaObject));
QQmlPropertyData *data;
- QVERIFY(data = cache->property(QLatin1String("slotA")));
+ QVERIFY(data = cacheProperty(cache, "slotA"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("slotA()"));
- QVERIFY(data = cache->property(QLatin1String("slotB")));
+ QVERIFY(data = cacheProperty(cache, "slotB"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("slotB()"));
- QVERIFY(data = cache->property(QLatin1String("signalA")));
+ QVERIFY(data = cacheProperty(cache, "signalA"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalA()"));
- QVERIFY(data = cache->property(QLatin1String("signalB")));
+ QVERIFY(data = cacheProperty(cache, "signalB"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalB()"));
- QVERIFY(data = cache->property(QLatin1String("propertyAChanged")));
+ QVERIFY(data = cacheProperty(cache, "propertyAChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyAChanged()"));
- QVERIFY(data = cache->property(QLatin1String("propertyBChanged")));
+ QVERIFY(data = cacheProperty(cache, "propertyBChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyBChanged()"));
- QVERIFY(data = cache->property(QLatin1String("propertyCChanged")));
+ QVERIFY(data = cacheProperty(cache, "propertyCChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyCChanged()"));
- QVERIFY(data = cache->property(QLatin1String("propertyDChanged")));
+ QVERIFY(data = cacheProperty(cache, "propertyDChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyDChanged()"));
}
@@ -191,28 +196,28 @@ void tst_qqmlpropertycache::methodsDerived()
QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(&engine, object.metaObject()));
QQmlPropertyData *data;
- QVERIFY(data = cache->property(QLatin1String("slotA")));
+ QVERIFY(data = cacheProperty(cache, "slotA"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("slotA()"));
- QVERIFY(data = cache->property(QLatin1String("slotB")));
+ QVERIFY(data = cacheProperty(cache, "slotB"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("slotB()"));
- QVERIFY(data = cache->property(QLatin1String("signalA")));
+ QVERIFY(data = cacheProperty(cache, "signalA"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalA()"));
- QVERIFY(data = cache->property(QLatin1String("signalB")));
+ QVERIFY(data = cacheProperty(cache, "signalB"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalB()"));
- QVERIFY(data = cache->property(QLatin1String("propertyAChanged")));
+ QVERIFY(data = cacheProperty(cache, "propertyAChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyAChanged()"));
- QVERIFY(data = cache->property(QLatin1String("propertyBChanged")));
+ QVERIFY(data = cacheProperty(cache, "propertyBChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyBChanged()"));
- QVERIFY(data = cache->property(QLatin1String("propertyCChanged")));
+ QVERIFY(data = cacheProperty(cache, "propertyCChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyCChanged()"));
- QVERIFY(data = cache->property(QLatin1String("propertyDChanged")));
+ QVERIFY(data = cacheProperty(cache, "propertyDChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyDChanged()"));
}
@@ -225,22 +230,22 @@ void tst_qqmlpropertycache::signalHandlers()
QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(&engine, metaObject));
QQmlPropertyData *data;
- QVERIFY(data = cache->property(QLatin1String("onSignalA")));
+ QVERIFY(data = cacheProperty(cache, "onSignalA"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalA()"));
- QVERIFY(data = cache->property(QLatin1String("onSignalB")));
+ QVERIFY(data = cacheProperty(cache, "onSignalB"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalB()"));
- QVERIFY(data = cache->property(QLatin1String("onPropertyAChanged")));
+ QVERIFY(data = cacheProperty(cache, "onPropertyAChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyAChanged()"));
- QVERIFY(data = cache->property(QLatin1String("onPropertyBChanged")));
+ QVERIFY(data = cacheProperty(cache, "onPropertyBChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyBChanged()"));
- QVERIFY(data = cache->property(QLatin1String("onPropertyCChanged")));
+ QVERIFY(data = cacheProperty(cache, "onPropertyCChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyCChanged()"));
- QVERIFY(data = cache->property(QLatin1String("onPropertyDChanged")));
+ QVERIFY(data = cacheProperty(cache, "onPropertyDChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyDChanged()"));
}
@@ -254,22 +259,22 @@ void tst_qqmlpropertycache::signalHandlersDerived()
QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(&engine, object.metaObject()));
QQmlPropertyData *data;
- QVERIFY(data = cache->property(QLatin1String("onSignalA")));
+ QVERIFY(data = cacheProperty(cache, "onSignalA"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalA()"));
- QVERIFY(data = cache->property(QLatin1String("onSignalB")));
+ QVERIFY(data = cacheProperty(cache, "onSignalB"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalB()"));
- QVERIFY(data = cache->property(QLatin1String("onPropertyAChanged")));
+ QVERIFY(data = cacheProperty(cache, "onPropertyAChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyAChanged()"));
- QVERIFY(data = cache->property(QLatin1String("onPropertyBChanged")));
+ QVERIFY(data = cacheProperty(cache, "onPropertyBChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyBChanged()"));
- QVERIFY(data = cache->property(QLatin1String("onPropertyCChanged")));
+ QVERIFY(data = cacheProperty(cache, "onPropertyCChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyCChanged()"));
- QVERIFY(data = cache->property(QLatin1String("onPropertyDChanged")));
+ QVERIFY(data = cacheProperty(cache, "onPropertyDChanged"));
QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyDChanged()"));
}