summaryrefslogtreecommitdiff
path: root/tests/auto/qml
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2010-06-10 10:25:16 +0200
committerKai Koehne <kai.koehne@nokia.com>2010-06-10 10:26:32 +0200
commit190fdf360c127ed6e788d0a57303ecc5f7961923 (patch)
tree6db5cdd2bef40973f5c0e5d1f1a4177a1709af17 /tests/auto/qml
parentef48306ba74fa46521ac05f3dbba4ce923da2e69 (diff)
downloadqt-creator-190fdf360c127ed6e788d0a57303ecc5f7961923.tar.gz
QmlDesigner: Add test case for Rewriter not removing Ids form model
Task-number: BAUHAUS-780
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qmldesigner/coretests/testcore.cpp33
-rw-r--r--tests/auto/qml/qmldesigner/coretests/testcore.h1
2 files changed, 34 insertions, 0 deletions
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(Model::create("Qt/Item"));
+ QVERIFY(model.data());
+
+ QScopedPointer<TestView> view(new TestView);
+ QVERIFY(view.data());
+ model->attachView(view.data());
+
+ QScopedPointer<TestRewriterView> 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();