summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@digia.com>2012-10-09 11:00:25 +0200
committerThomas Hartmann <Thomas.Hartmann@digia.com>2012-10-09 14:39:44 +0200
commit13d4972e67cd2bcdbf7f223407e78f2e74ae835b (patch)
treefffd2f07a074d06d440052c948ba10332e0aea4e /tests
parentea6fa832be6b3c882bf3ce70a8fe74ef89129d71 (diff)
downloadqt-creator-13d4972e67cd2bcdbf7f223407e78f2e74ae835b.tar.gz
QmlDesigner.MetaInfo: meta info fix for versions
Version numbers were not respected in all cases in the meta system. If we (just) have a QtQuick 2.0 import Rectangle 1.0 is not valid. Also adding a test. Change-Id: I2e1dc174aaa180ad1750f0eca04c6879ef6e304d Reviewed-by: Marco Bubke <marco.bubke@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp64
-rw-r--r--tests/auto/qml/qmldesigner/coretests/tst_testcore.h1
2 files changed, 65 insertions, 0 deletions
diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
index 8c905cf1ff..f69bac1afd 100644
--- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
+++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
@@ -4034,6 +4034,70 @@ void tst_TestCore::testMetaInfoEnums()
QApplication::processEvents();
}
+void tst_TestCore::testMetaInfoQtQuick1Vs2()
+{
+ char qmlString[] = "import QtQuick 2.0\n"
+ "Rectangle {\n"
+ "id: root;\n"
+ "width: 200;\n"
+ "height: 200;\n"
+ "color: \"white\";\n"
+ "Text {\n"
+ "id: text1\n"
+ "text: \"Hello World\"\n"
+ "anchors.centerIn: parent\n"
+ "Item {\n"
+ "id: item\n"
+ "}\n"
+ "}\n"
+ "Rectangle {\n"
+ "id: rectangle;\n"
+ "gradient: Gradient {\n"
+ "GradientStop {\n"
+ "position: 0\n"
+ "color: \"white\"\n"
+ "}\n"
+ "GradientStop {\n"
+ "position: 1\n"
+ "color: \"black\"\n"
+ "}\n"
+ "}\n"
+ "}\n"
+ "Text {\n"
+ "text: \"text\"\n"
+ "x: 66\n"
+ "y: 43\n"
+ "width: 80\n"
+ "height: 20\n"
+ "id: text2\n"
+ "}\n"
+ "}\n";
+
+ QPlainTextEdit textEdit;
+ textEdit.setPlainText(qmlString);
+ NotIndentingTextEditModifier textModifier(&textEdit);
+
+ QScopedPointer<Model> model(Model::create("QtQuick.Item"));
+ QVERIFY(model.data());
+
+ QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView());
+ testRewriterView->setTextModifier(&textModifier);
+
+ model->attachView(testRewriterView.data());
+
+ ModelNode rootModelNode = testRewriterView->rootModelNode();
+ QVERIFY(rootModelNode.isValid());
+ QCOMPARE(rootModelNode.type(), QString("QtQuick.Rectangle"));
+
+ QVERIFY(!model->metaInfo("Rectangle", 1, 0).isValid());
+ QVERIFY(model->metaInfo("Rectangle", -1, -1).isValid());
+ QVERIFY(model->metaInfo("Rectangle", 2, 0).isValid());
+
+ QVERIFY(!model->metaInfo("QtQuick.Rectangle", 1, 0).isValid());
+ QVERIFY(model->metaInfo("QtQuick.Rectangle", -1, -1).isValid());
+ QVERIFY(model->metaInfo("QtQuick.Rectangle", 2, 0).isValid());
+}
+
void tst_TestCore::testMetaInfoProperties()
{
QScopedPointer<Model> model(createModel("QtQuick.Text"));
diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h
index 2a2cafad30..159bd5744c 100644
--- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h
+++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h
@@ -61,6 +61,7 @@ private slots:
void testMetaInfoEnums();
void testMetaInfoProperties();
void testMetaInfoDotProperties();
+ void testMetaInfoQtQuick1Vs2();
void testMetaInfoListProperties();
void testQtQuick20Basic();
void testQtQuick20BasicRectangle();