From 190fdf360c127ed6e788d0a57303ecc5f7961923 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 10 Jun 2010 10:25:16 +0200 Subject: [PATCH] QmlDesigner: Add test case for Rewriter not removing Ids form model Task-number: BAUHAUS-780 --- tests/auto/qml/qmldesigner/coretests/testcore.cpp | 33 +++++++++++++++++++++++ tests/auto/qml/qmldesigner/coretests/testcore.h | 1 + 2 files changed, 34 insertions(+) diff --git a/tests/auto/qml/qmldesigner/coretests/testcore.cpp b/tests/auto/qml/qmldesigner/coretests/testcore.cpp index 89429e2a92..1b40436aff 100644 --- a/tests/auto/qml/qmldesigner/coretests/testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/testcore.cpp @@ -5426,6 +5426,39 @@ void TestCore::testRewriterChangeId() node.setId("myId"); } +void TestCore::testRewriterRemoveId() +{ + const char* qmlString = "import Qt 4.7\nRectangle { id: rect }"; + + QPlainTextEdit textEdit; + textEdit.setPlainText(qmlString); + NotIndentingTextEditModifier textModifier(&textEdit); + + QScopedPointer model(Model::create("Qt/Item")); + QVERIFY(model.data()); + + QScopedPointer view(new TestView); + QVERIFY(view.data()); + model->attachView(view.data()); + + QScopedPointer testRewriterView(new TestRewriterView()); + testRewriterView->setTextModifier(&textModifier); + model->attachView(testRewriterView.data()); + + ModelNode rootModelNode(view->rootModelNode()); + QVERIFY(rootModelNode.isValid()); + QCOMPARE(rootModelNode.id(), QString("rect")); + + QSKIP("Fix me!!!! Task BAUHAUS-780", SkipAll); + // + // remove id in text + // + const char* qmlString2 = "import Qt 4.7\nRectangle { }"; + textEdit.setPlainText(qmlString2); + + QCOMPARE(rootModelNode.id(), QString()); +} + void TestCore::testRewriterChangeValueProperty() { const char* qmlString = "import Qt 4.7\nRectangle { x: 10; y: 10 }"; diff --git a/tests/auto/qml/qmldesigner/coretests/testcore.h b/tests/auto/qml/qmldesigner/coretests/testcore.h index f3cbc8ebe8..685a1e6a72 100644 --- a/tests/auto/qml/qmldesigner/coretests/testcore.h +++ b/tests/auto/qml/qmldesigner/coretests/testcore.h @@ -87,6 +87,7 @@ private slots: void testRewriterView(); void testRewriterErrors(); void testRewriterChangeId(); + void testRewriterRemoveId(); void testRewriterChangeValueProperty(); void testRewriterRemoveValueProperty(); void testRewriterSignalProperty(); -- 2.11.0