From 76206c63b0646137d1abd2d32cdb93b38a027573 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 3 Apr 2019 14:38:31 +0200 Subject: QmlDesigner.Tests: Add regression test Adding regression test for revisioned properties Task-number: QTCREATORBUG-22057 Change-Id: I79d1bf1167944fc005179b064703e217a6494e33 Reviewed-by: Tim Jenssen --- .../qml/qmldesigner/coretests/tst_testcore.cpp | 58 ++++++++++++++++++++++ .../auto/qml/qmldesigner/coretests/tst_testcore.h | 1 + 2 files changed, 59 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index 4334e90aa64..1a4eda3bcc9 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::create("QtQuick.Item")); + QVERIFY(model.data()); + QScopedPointer 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 cde63a12d1c..3f1eec576b4 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 -- cgit v1.2.3