diff --git a/tests/auto/qml/qmleditor/lookup/data/localIdLookup.qml b/tests/auto/qml/qmleditor/lookup/data/localIdLookup.qml index 3e30313aab525ac1055f472b046570c0c7966ac1..fd04eee4abb6e40392c23d63077bee3a5c02c205 100644 --- a/tests/auto/qml/qmleditor/lookup/data/localIdLookup.qml +++ b/tests/auto/qml/qmleditor/lookup/data/localIdLookup.qml @@ -1,45 +1,45 @@ import Qt 4.6 -// Try to look up root, parentItem, foo, child and childChild +// Try to look up x, y, z, opacity and visible // in all symbol contexts. It should always get the right item. Item { - id: root + id: x Script { - function root() {} - function parentItem() {} - function foo() {} - function child() {} - function childChild() {} + function x() {} + function y() {} + function z() {} + function opacity() {} + function visible() {} } - property var root: "wrong"; - property var parentItem: "wrong"; - property var foo: "wrong"; - property var child: "wrong"; - property var childChild: "wrong"; + property var x: "wrong"; + property var y: "wrong"; + property var z: "wrong"; + property var opacity: "wrong"; + property var visible: "wrong"; Item { - id: parentItem - property var root: "wrong"; - property var parentItem: "wrong"; - property var foo: "wrong"; - property var child: "wrong"; - property var childChild: "wrong"; + id: y + property var x: "wrong"; + property var y: "wrong"; + property var z: "wrong"; + property var opacity: "wrong"; + property var visible: "wrong"; Item { - id: foo - property var root: "wrong"; - property var parentItem: "wrong"; - property var foo: "wrong"; - property var child: "wrong"; - property var childChild: "wrong"; + id: z + property var x: "wrong"; + property var y: "wrong"; + property var z: "wrong"; + property var opacity: "wrong"; + property var visible: "wrong"; Item { - id: child - property var root: "wrong"; - property var parentItem: "wrong"; - property var foo: "wrong"; - property var child: "wrong"; - property var childChild: "wrong"; + id: opacity + property var x: "wrong"; + property var y: "wrong"; + property var z: "wrong"; + property var opacity: "wrong"; + property var visible: "wrong"; Item { - id: childChild + id: visible } } } diff --git a/tests/auto/qml/qmleditor/lookup/data/localRootLookup.qml b/tests/auto/qml/qmleditor/lookup/data/localRootLookup.qml index c7bf847cbdde63daf2d1820766039b8a878a8057..bc512720ee09f40c4ef09ee24a7e103353cf461d 100644 --- a/tests/auto/qml/qmleditor/lookup/data/localRootLookup.qml +++ b/tests/auto/qml/qmleditor/lookup/data/localRootLookup.qml @@ -3,7 +3,7 @@ import Qt 4.6 // Try to look up prop in child. // It should get the root's prop. -Item { +Rectangle { id: theRoot property var prop Item { diff --git a/tests/auto/qml/qmleditor/lookup/data/localScriptMethodLookup.qml b/tests/auto/qml/qmleditor/lookup/data/localScriptMethodLookup.qml index 0d2004df7d27bb2decb25c829d924238c8e10754..a4e535a9ae4a8d76b67cdc52bd25c3d173fc69ae 100644 --- a/tests/auto/qml/qmleditor/lookup/data/localScriptMethodLookup.qml +++ b/tests/auto/qml/qmleditor/lookup/data/localScriptMethodLookup.qml @@ -1,32 +1,32 @@ import Qt 4.6 -// Try to look up rootFunc, parentFunc, childFunc +// Try to look up x, y, z // in all symbol contexts. It should always get the function. Item { id: theRoot Script { - function rootFunc() {} + function x() {} } - property var rootFunc: "wrong"; - property var parentFunc: "wrong"; - property var childFunc: "wrong"; + property var x: "wrong"; + property var y: "wrong"; + property var z: "wrong"; Item { id: theParent Script { - function parentFunc() {} + function y() {} } - property var rootFunc: "wrong"; - property var parentFunc: "wrong"; - property var childFunc: "wrong"; + property var x: "wrong"; + property var y: "wrong"; + property var z: "wrong"; Item { id: theChild Script { - function childFunc() {} + function z() {} } - property var rootFunc: "wrong"; - property var parentFunc: "wrong"; - property var childFunc: "wrong"; + property var x: "wrong"; + property var y: "wrong"; + property var z: "wrong"; } } } \ No newline at end of file diff --git a/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp b/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp index 9e869cd38f62e275c2e2eec0449595ebd7047871..516294bb0d753a0c902329ee2f94c5304fe5f027 100644 --- a/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp +++ b/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp @@ -178,11 +178,11 @@ void tst_Lookup::localIdLookup() QVERIFY(doc->isParsedCorrectly()); QStringList symbolNames; - symbolNames.append("root"); - symbolNames.append("parentItem"); - symbolNames.append("foo"); - symbolNames.append("child"); - symbolNames.append("childChild"); + symbolNames.append("x"); + symbolNames.append("y"); + symbolNames.append("z"); + symbolNames.append("opacity"); + symbolNames.append("visible"); // check symbol existence foreach (const QString &symbolName, symbolNames) { @@ -215,9 +215,9 @@ void tst_Lookup::localScriptMethodLookup() symbolNames.append("theChild"); QStringList functionNames; - functionNames.append("rootFunc"); - functionNames.append("parentFunc"); - functionNames.append("childFunc"); + functionNames.append("x"); + functionNames.append("y"); + functionNames.append("z"); // check symbol existence foreach (const QString &symbolName, symbolNames) { @@ -232,7 +232,8 @@ void tst_Lookup::localScriptMethodLookup() foreach (const QString &functionName, functionNames) { QmlSymbol *symbol = context.resolve(functionName); - QVERIFY(symbol && !symbol->isProperty()); + QVERIFY(symbol); + QVERIFY(!symbol->isProperty()); // verify that it's a function } } @@ -262,10 +263,16 @@ void tst_Lookup::localScopeLookup() scopes.push_back(doc->ids()[contextSymbolName]); QmlLookupContext context(scopes, doc, snapshot(doc), typeSystem()); - QmlSymbol *symbol = context.resolve("prop"); + QmlSymbol *symbol; + symbol = context.resolve("prop"); QVERIFY(symbol); QVERIFY(symbol->isPropertyDefinitionSymbol()); QVERIFY(doc->ids()[contextSymbolName]->members().contains(symbol)); + + symbol = context.resolve("x"); + QVERIFY(symbol); + QVERIFY(symbol->isProperty()); + QVERIFY(doc->ids()[contextSymbolName]->members().contains(symbol)); } } @@ -292,10 +299,17 @@ void tst_Lookup::localRootLookup() // try lookup QmlLookupContext context(scopes, doc, snapshot(doc), typeSystem()); - QmlSymbol *symbol = context.resolve("prop"); + + QmlSymbol *symbol; + symbol = context.resolve("prop"); QVERIFY(symbol); QVERIFY(symbol->isPropertyDefinitionSymbol()); QVERIFY(doc->ids()[symbolNames[0]]->members().contains(symbol)); + + symbol = context.resolve("color"); + QVERIFY(symbol); + QVERIFY(symbol->isProperty()); + QVERIFY(doc->ids()[symbolNames[0]]->members().contains(symbol)); } QTEST_APPLESS_MAIN(tst_Lookup)