Commit 410ca987 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

Test.qmlDesigner: fixing test testTypicalRewriterOperations



The rewriter is stricter now and does not allow arbitray properties.
We have to respect the meta info.

Change-Id: I3ef852f6661c0113e11e17cd2f3ed5b3a5a71f72
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 12f10983
...@@ -1123,40 +1123,40 @@ void tst_TestCore::testTypicalRewriterOperations() ...@@ -1123,40 +1123,40 @@ void tst_TestCore::testTypicalRewriterOperations()
ModelNode rootModelNode = view->rootModelNode(); ModelNode rootModelNode = view->rootModelNode();
QCOMPARE(rootModelNode.allDirectSubModelNodes().count(), 0); QCOMPARE(rootModelNode.allDirectSubModelNodes().count(), 0);
QVERIFY(rootModelNode.property("test").isValid()); QVERIFY(rootModelNode.property("x").isValid());
QVERIFY(!rootModelNode.property("test").isVariantProperty()); QVERIFY(!rootModelNode.property("x").isVariantProperty());
QVERIFY(!rootModelNode.property("test").isBindingProperty()); QVERIFY(!rootModelNode.property("x").isBindingProperty());
QVERIFY(rootModelNode.variantProperty("test").isValid()); QVERIFY(rootModelNode.variantProperty("x").isValid());
QVERIFY(!rootModelNode.hasProperty("test")); QVERIFY(!rootModelNode.hasProperty("x"));
rootModelNode.variantProperty("test") = 70; rootModelNode.variantProperty("x") = 70;
QVERIFY(rootModelNode.hasProperty("test")); QVERIFY(rootModelNode.hasProperty("x"));
QVERIFY(rootModelNode.property("test").isVariantProperty()); QVERIFY(rootModelNode.property("x").isVariantProperty());
QCOMPARE(rootModelNode.variantProperty("test").value(), QVariant(70)); QCOMPARE(rootModelNode.variantProperty("x").value(), QVariant(70));
rootModelNode.bindingProperty("test") = "parent.x"; rootModelNode.bindingProperty("x") = "parent.x";
QVERIFY(!rootModelNode.property("test").isVariantProperty()); QVERIFY(!rootModelNode.property("x").isVariantProperty());
QVERIFY(rootModelNode.property("test").isBindingProperty()); QVERIFY(rootModelNode.property("x").isBindingProperty());
QCOMPARE(rootModelNode.bindingProperty("test").expression(), QString("parent.x")); QCOMPARE(rootModelNode.bindingProperty("x").expression(), QString("parent.x"));
ModelNode childNode(addNodeListChild(rootModelNode, "QtQuick.Rectangle", 4 ,6, "data")); ModelNode childNode(addNodeListChild(rootModelNode, "QtQuick.Rectangle", 1 ,0, "data"));
rootModelNode.nodeListProperty("test").reparentHere(childNode); rootModelNode.nodeListProperty("data").reparentHere(childNode);
QCOMPARE(childNode.parentProperty(), rootModelNode.nodeAbstractProperty("test")); QCOMPARE(childNode.parentProperty(), rootModelNode.nodeAbstractProperty("data"));
QVERIFY(rootModelNode.property("test").isNodeAbstractProperty()); QVERIFY(rootModelNode.property("data").isNodeAbstractProperty());
QVERIFY(rootModelNode.property("test").isNodeListProperty()); QVERIFY(rootModelNode.property("data").isNodeListProperty());
QVERIFY(!rootModelNode.property("test").isBindingProperty()); QVERIFY(!rootModelNode.property("data").isBindingProperty());
QVERIFY(childNode.parentProperty().isNodeListProperty()); QVERIFY(childNode.parentProperty().isNodeListProperty());
QCOMPARE(childNode, childNode.parentProperty().toNodeListProperty().toModelNodeList().first()); QCOMPARE(childNode, childNode.parentProperty().toNodeListProperty().toModelNodeList().first());
QCOMPARE(rootModelNode, childNode.parentProperty().parentModelNode()); QCOMPARE(rootModelNode, childNode.parentProperty().parentModelNode());
QCOMPARE(childNode.parentProperty().name(), QString("test")); QCOMPARE(childNode.parentProperty().name(), QString("data"));
QVERIFY(!rootModelNode.property("test").isVariantProperty()); QVERIFY(!rootModelNode.property("x").isVariantProperty());
rootModelNode.variantProperty("test") = 90; rootModelNode.variantProperty("x") = 90;
QVERIFY(rootModelNode.property("test").isVariantProperty()); QVERIFY(rootModelNode.property("x").isVariantProperty());
QCOMPARE(rootModelNode.variantProperty("test").value(), QVariant(90)); QCOMPARE(rootModelNode.variantProperty("x").value(), QVariant(90));
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment