QmlDesigner: Fix tests

We do not allow rect as id, since it is also a QML type.

Change-Id: I348071b9b1f6c3e72d3934770196421ce72d36b5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2022-07-12 20:33:07 +02:00
parent 57413c6703
commit 7354d8a462
2 changed files with 6 additions and 6 deletions

View File

@@ -7336,7 +7336,7 @@ void tst_TestCore::testRewriterChangeId()
void tst_TestCore::testRewriterRemoveId()
{
const char* qmlString = "import QtQuick 2.1\nRectangle { id: rect }";
const char* qmlString = "import QtQuick 2.1\nRectangle { id: myRect }";
QPlainTextEdit textEdit;
textEdit.setPlainText(QString::fromUtf8(qmlString));
@@ -7355,7 +7355,7 @@ void tst_TestCore::testRewriterRemoveId()
ModelNode rootModelNode(view->rootModelNode());
QVERIFY(rootModelNode.isValid());
QCOMPARE(rootModelNode.id(), QString("rect"));
QCOMPARE(rootModelNode.id(), QString("myRect"));
//
// remove id in text
@@ -8518,7 +8518,7 @@ void tst_TestCore::loadTestFiles()
QCOMPARE(rootModelNode.directSubModelNodes().count(), 4);
QCOMPARE(rootModelNode.variantProperty("width").value().toInt(), 200);
QCOMPARE(rootModelNode.variantProperty("height").value().toInt(), 200);
QCOMPARE(rootModelNode.id(), QLatin1String("rect"));
QCOMPARE(rootModelNode.id(), QLatin1String("myRect"));
QVERIFY(rootModelNode.hasProperty("data"));
QVERIFY(rootModelNode.property("data").isDefaultProperty());

View File

@@ -26,7 +26,7 @@
import QtQuick 2.0
Rectangle {
id: rect
id: myRect
width: 200
height: 200
Text {
@@ -39,7 +39,7 @@ Rectangle {
State {
name: "State1"
PropertyChanges {
target: rect
target: myRect
color: "blue"
}
PropertyChanges {
@@ -50,7 +50,7 @@ Rectangle {
State {
name: "State2"
PropertyChanges {
target: rect
target: myRect
color: "gray"
}
PropertyChanges {