Commit 2de4a98c authored by Erik Verbruggen's avatar Erik Verbruggen

Fixed id syncing when and id gets removed from the QML source.

Task-number: BAUHAUS-780
Reviewed-by: kkoehne
parent b0995968
......@@ -636,6 +636,8 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
context->enterScope(astNode);
QSet<QString> modelPropertyNames = QSet<QString>::fromList(modelNode.propertyNames());
if (!modelNode.id().isEmpty())
modelPropertyNames.insert(QLatin1String("id"));
QList<UiObjectMember *> defaultPropertyItems;
for (UiObjectMemberList *iter = astInitializer->members; iter; iter = iter->next) {
......@@ -744,7 +746,10 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
AbstractProperty modelProperty = modelNode.property(modelPropertyName);
// property deleted.
differenceHandler.propertyAbsentFromQml(modelProperty);
if (modelPropertyName == QLatin1String("id"))
differenceHandler.idsDiffer(modelNode, QString());
else
differenceHandler.propertyAbsentFromQml(modelProperty);
}
context->leaveScope();
......
......@@ -5441,7 +5441,7 @@ void TestCore::testRewriterRemoveId()
QVERIFY(view.data());
model->attachView(view.data());
QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView());
QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView(0, TestRewriterView::Amend));
testRewriterView->setTextModifier(&textModifier);
model->attachView(testRewriterView.data());
......@@ -5449,7 +5449,6 @@ void TestCore::testRewriterRemoveId()
QVERIFY(rootModelNode.isValid());
QCOMPARE(rootModelNode.id(), QString("rect"));
QSKIP("Fix me!!!! Task BAUHAUS-780", SkipAll);
//
// remove id in text
//
......
......@@ -83,7 +83,9 @@ VariantProperty TestModelToTextMerger::findAddedVariantProperty(const VariantPro
return VariantProperty();
}
TestRewriterView::TestRewriterView(QObject *parent) : RewriterView(RewriterView::Validate, parent)
TestRewriterView::TestRewriterView(QObject *parent,
DifferenceHandling differenceHandling)
: RewriterView(differenceHandling, parent)
{
}
......
......@@ -53,7 +53,8 @@ class TestRewriterView : public RewriterView
Q_OBJECT
public:
TestRewriterView(QObject *parent = 0);
TestRewriterView(QObject *parent = 0,
DifferenceHandling differenceHandling = RewriterView::Validate);
Internal::TestModelToTextMerger *modelToTextMerger() const;
Internal::TextToModelMerger *textToModelMerger() const;
......
Markdown is supported
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