aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2019-04-03 14:38:31 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2019-05-02 12:22:39 +0000
commit76206c63b0646137d1abd2d32cdb93b38a027573 (patch)
treee4ddafe8b9e4b1a1b85e586d3d03436d387e21ff
parent27823032537130726842b8858e532e4a878202b8 (diff)
QmlDesigner.Tests: Add regression test
Adding regression test for revisioned properties Task-number: QTCREATORBUG-22057 Change-Id: I79d1bf1167944fc005179b064703e217a6494e33 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp58
-rw-r--r--tests/auto/qml/qmldesigner/coretests/tst_testcore.h1
2 files changed, 59 insertions, 0 deletions
diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
index 4334e90aa6..1a4eda3bcc 100644
--- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
+++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
@@ -4534,6 +4534,64 @@ void tst_TestCore::testImplicitComponents()
QCOMPARE(delegate.nodeSourceType(), ModelNode::NodeWithComponentSource);
}
+void tst_TestCore::testRevisionedProperties()
+{
+#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
+ const char* qmlString
+ = "import QtQuick 2.12\n"
+ "import QtQuick.Controls 2.0\n"
+ "import QtQuick.Layouts 1.0\n"
+ "\n"
+ "Item {\n"
+ "width: 640\n"
+ "height: 480\n"
+ "Rectangle {\n"
+ "gradient: Gradient {\n"
+ "orientation: Qt.Vertical\n"
+ "}\n"
+ "}\n"
+ "TextEdit {\n"
+ "leftPadding: 10\n"
+ "rightPadding: 10\n"
+ "topPadding: 10\n"
+ "bottomPadding: 10\n"
+ "}\n"
+ "}\n";
+
+ QPlainTextEdit textEdit;
+ textEdit.setPlainText(QLatin1String(qmlString));
+ NotIndentingTextEditModifier modifier(&textEdit);
+
+ QScopedPointer<Model> model(Model::create("QtQuick.Item"));
+ QVERIFY(model.data());
+ QScopedPointer<TestView> view(new TestView(model.data()));
+ QVERIFY(view.data());
+ model->attachView(view.data());
+
+ TestRewriterView *testRewriterView = new TestRewriterView(model.data());
+ testRewriterView->setCheckSemanticErrors(true);
+ testRewriterView->setTextModifier(&modifier);
+ model->attachView(testRewriterView);
+
+ QVERIFY(testRewriterView->errors().isEmpty());
+
+ ModelNode rootModelNode(view->rootModelNode());
+
+ QVERIFY(rootModelNode.isValid());
+
+ NodeMetaInfo metaInfo12 = model->metaInfo("QtQuick.Gradient", 2, 12);
+ NodeMetaInfo metaInfo11 = model->metaInfo("QtQuick.Gradient", -1, -1);
+ NodeMetaInfo metaInfoU = model->metaInfo("QtQuick.Gradient", -1, -1);
+
+ QVERIFY(metaInfo12.isValid());
+ QVERIFY(metaInfoU.isValid());
+
+ QVERIFY(metaInfo12.hasProperty("orientation"));
+ QVERIFY(metaInfoU.hasProperty("orientation"));
+
+#endif
+}
+
void tst_TestCore::testStatesRewriter()
{
QPlainTextEdit textEdit;
diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h
index cde63a12d1..3f1eec576b 100644
--- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h
+++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h
@@ -62,6 +62,7 @@ private slots:
void testQtQuick20BasicRectangle();
void testQtQuickControls2();
void testImplicitComponents();
+ void testRevisionedProperties();
//
// unit tests Model, ModelNode, NodeProperty, AbstractView