forked from qt-creator/qt-creator
QmlDesigner: Use QtQuick 2.1 imports
QtQuick 1.1 is not supported anymore. Change-Id: Ibfeba6f2e0617892ea823d1043344502e4617b7a Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -510,7 +510,7 @@ void tst_TestCore::testModelCreateRect()
|
|||||||
void tst_TestCore::testRewriterDynamicProperties()
|
void tst_TestCore::testRewriterDynamicProperties()
|
||||||
{
|
{
|
||||||
const QLatin1String qmlString("\n"
|
const QLatin1String qmlString("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
" property int i\n"
|
" property int i\n"
|
||||||
@@ -646,7 +646,7 @@ void tst_TestCore::testRewriterDynamicProperties()
|
|||||||
void tst_TestCore::testRewriterGroupedProperties()
|
void tst_TestCore::testRewriterGroupedProperties()
|
||||||
{
|
{
|
||||||
const QLatin1String qmlString("\n"
|
const QLatin1String qmlString("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Text {\n"
|
"Text {\n"
|
||||||
" font {\n"
|
" font {\n"
|
||||||
@@ -683,7 +683,7 @@ void tst_TestCore::testRewriterGroupedProperties()
|
|||||||
|
|
||||||
rootModelNode.removeProperty("font.pointSize");
|
rootModelNode.removeProperty("font.pointSize");
|
||||||
const QLatin1String expected("\n"
|
const QLatin1String expected("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Text {\n"
|
"Text {\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
@@ -694,49 +694,49 @@ void tst_TestCore::testRewriterGroupedProperties()
|
|||||||
void tst_TestCore::testRewriterPreserveOrder()
|
void tst_TestCore::testRewriterPreserveOrder()
|
||||||
{
|
{
|
||||||
const QLatin1String qmlString1("\n"
|
const QLatin1String qmlString1("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
"width: 640\n"
|
"width: 640\n"
|
||||||
"height: 480\n"
|
"height: 480\n"
|
||||||
"\n"
|
"\n"
|
||||||
"states: [\n"
|
"states: [\n"
|
||||||
"State {\n"
|
"State {\n"
|
||||||
"name: \"State1\"\n"
|
"name: \"State1\"\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
"id: rectangle1\n"
|
"id: rectangle1\n"
|
||||||
"x: 18\n"
|
"x: 18\n"
|
||||||
"y: 19\n"
|
"y: 19\n"
|
||||||
"width: 100\n"
|
"width: 100\n"
|
||||||
"height: 100\n"
|
"height: 100\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
const QLatin1String qmlString2("\n"
|
const QLatin1String qmlString2("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
"width: 640\n"
|
"width: 640\n"
|
||||||
"height: 480\n"
|
"height: 480\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
"id: rectangle1\n"
|
"id: rectangle1\n"
|
||||||
"x: 18\n"
|
"x: 18\n"
|
||||||
"y: 19\n"
|
"y: 19\n"
|
||||||
"width: 100\n"
|
"width: 100\n"
|
||||||
"height: 100\n"
|
"height: 100\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"states: [\n"
|
"states: [\n"
|
||||||
"State {\n"
|
"State {\n"
|
||||||
"name: \"State1\"\n"
|
"name: \"State1\"\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"\n"
|
"\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
QPlainTextEdit textEdit;
|
QPlainTextEdit textEdit;
|
||||||
textEdit.setPlainText(qmlString2);
|
textEdit.setPlainText(qmlString2);
|
||||||
NotIndentingTextEditModifier modifier(&textEdit);
|
NotIndentingTextEditModifier modifier(&textEdit);
|
||||||
@@ -810,7 +810,7 @@ void tst_TestCore::testRewriterPreserveOrder()
|
|||||||
void tst_TestCore::testRewriterActionCompression()
|
void tst_TestCore::testRewriterActionCompression()
|
||||||
{
|
{
|
||||||
const QLatin1String qmlString("\n"
|
const QLatin1String qmlString("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
" id: root\n"
|
" id: root\n"
|
||||||
@@ -856,7 +856,7 @@ void tst_TestCore::testRewriterActionCompression()
|
|||||||
transaction.commit();
|
transaction.commit();
|
||||||
|
|
||||||
const QLatin1String expected("\n"
|
const QLatin1String expected("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
" id: root\n"
|
" id: root\n"
|
||||||
@@ -923,7 +923,7 @@ void tst_TestCore::testRewriterImports()
|
|||||||
void tst_TestCore::testRewriterChangeImports()
|
void tst_TestCore::testRewriterChangeImports()
|
||||||
{
|
{
|
||||||
const QLatin1String qmlString("\n"
|
const QLatin1String qmlString("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {}\n");
|
"Rectangle {}\n");
|
||||||
|
|
||||||
@@ -950,16 +950,16 @@ void tst_TestCore::testRewriterChangeImports()
|
|||||||
model->changeImports(importList, QList<Import>());
|
model->changeImports(importList, QList<Import>());
|
||||||
|
|
||||||
const QLatin1String qmlWithImport("\n"
|
const QLatin1String qmlWithImport("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"import QtWebKit 1.0\n"
|
"import QtWebKit 1.0\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {}\n");
|
"Rectangle {}\n");
|
||||||
QCOMPARE(textEdit.toPlainText(), qmlWithImport);
|
QCOMPARE(textEdit.toPlainText(), qmlWithImport);
|
||||||
|
|
||||||
model->changeImports(QList<Import>(), importList);
|
model->changeImports(QList<Import>(), importList);
|
||||||
|
|
||||||
QCOMPARE(model->imports().size(), 1);
|
QCOMPARE(model->imports().size(), 1);
|
||||||
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.1"));
|
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "2.1"));
|
||||||
|
|
||||||
QCOMPARE(textEdit.toPlainText(), qmlString);
|
QCOMPARE(textEdit.toPlainText(), qmlString);
|
||||||
|
|
||||||
@@ -973,14 +973,14 @@ void tst_TestCore::testRewriterChangeImports()
|
|||||||
model->changeImports(QList<Import>() << webkitImportAlias, QList<Import>() << webkitImport);
|
model->changeImports(QList<Import>() << webkitImportAlias, QList<Import>() << webkitImport);
|
||||||
|
|
||||||
const QLatin1String qmlWithAliasImport("\n"
|
const QLatin1String qmlWithAliasImport("\n"
|
||||||
"import QtQuick 1.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"import QtWebKit 1.0 as Web\n"
|
"import QtWebKit 1.0 as Web\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {}\n");
|
"Rectangle {}\n");
|
||||||
QCOMPARE(textEdit.toPlainText(), qmlWithAliasImport);
|
QCOMPARE(textEdit.toPlainText(), qmlWithAliasImport);
|
||||||
|
|
||||||
model->changeImports(QList<Import>(), QList<Import>() << webkitImportAlias);
|
model->changeImports(QList<Import>(), QList<Import>() << webkitImportAlias);
|
||||||
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.1"));
|
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "2.1"));
|
||||||
|
|
||||||
QCOMPARE(textEdit.toPlainText(), qmlString);
|
QCOMPARE(textEdit.toPlainText(), qmlString);
|
||||||
|
|
||||||
@@ -989,17 +989,17 @@ void tst_TestCore::testRewriterChangeImports()
|
|||||||
//
|
//
|
||||||
textEdit.setPlainText(qmlWithImport);
|
textEdit.setPlainText(qmlWithImport);
|
||||||
QCOMPARE(model->imports().size(), 2);
|
QCOMPARE(model->imports().size(), 2);
|
||||||
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.1"));
|
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "2.1"));
|
||||||
QCOMPARE(model->imports().last(), Import::createLibraryImport("QtWebKit", "1.0"));
|
QCOMPARE(model->imports().last(), Import::createLibraryImport("QtWebKit", "1.0"));
|
||||||
|
|
||||||
textEdit.setPlainText(qmlWithAliasImport);
|
textEdit.setPlainText(qmlWithAliasImport);
|
||||||
QCOMPARE(model->imports().size(), 2);
|
QCOMPARE(model->imports().size(), 2);
|
||||||
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.1"));
|
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "2.1"));
|
||||||
QCOMPARE(model->imports().last(), Import::createLibraryImport("QtWebKit", "1.0", "Web"));
|
QCOMPARE(model->imports().last(), Import::createLibraryImport("QtWebKit", "1.0", "Web"));
|
||||||
|
|
||||||
textEdit.setPlainText(qmlString);
|
textEdit.setPlainText(qmlString);
|
||||||
QCOMPARE(model->imports().size(), 1);
|
QCOMPARE(model->imports().size(), 1);
|
||||||
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.1"));
|
QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "2.1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_TestCore::testRewriterUnicodeChars()
|
void tst_TestCore::testRewriterUnicodeChars()
|
||||||
@@ -4120,41 +4120,41 @@ void tst_TestCore::testAnchorsAndRewritingCenter()
|
|||||||
|
|
||||||
void tst_TestCore::loadQml()
|
void tst_TestCore::loadQml()
|
||||||
{
|
{
|
||||||
char qmlString[] = "import QtQuick 2.1\n"
|
char qmlString[] = "import QtQuick 2.15\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
"id: root;\n"
|
"id: root;\n"
|
||||||
"width: 200;\n"
|
"width: 200;\n"
|
||||||
"height: 200;\n"
|
"height: 200;\n"
|
||||||
"color: \"white\";\n"
|
"color: \"white\";\n"
|
||||||
"Text {\n"
|
"Text {\n"
|
||||||
"id: text1\n"
|
"id: text1\n"
|
||||||
"text: \"Hello World\"\n"
|
"text: \"Hello World\"\n"
|
||||||
"anchors.centerIn: parent\n"
|
"anchors.centerIn: parent\n"
|
||||||
"Item {\n"
|
"Item {\n"
|
||||||
"id: item01\n"
|
"id: item01\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
"id: rectangle;\n"
|
"id: rectangle;\n"
|
||||||
"gradient: Gradient {\n"
|
"gradient: Gradient {\n"
|
||||||
"GradientStop {\n"
|
"GradientStop {\n"
|
||||||
"position: 0\n"
|
"position: 0\n"
|
||||||
"color: \"white\"\n"
|
"color: \"white\"\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"GradientStop {\n"
|
"GradientStop {\n"
|
||||||
"position: 1\n"
|
"position: 1\n"
|
||||||
"color: \"black\"\n"
|
"color: \"black\"\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"Text {\n"
|
"Text {\n"
|
||||||
"text: \"text\"\n"
|
"text: \"text\"\n"
|
||||||
"x: 66\n"
|
"x: 66\n"
|
||||||
"y: 43\n"
|
"y: 43\n"
|
||||||
"width: 80\n"
|
"width: 80\n"
|
||||||
"height: 20\n"
|
"height: 20\n"
|
||||||
"id: text2\n"
|
"id: text2\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
QPlainTextEdit textEdit;
|
QPlainTextEdit textEdit;
|
||||||
@@ -7731,25 +7731,23 @@ void tst_TestCore::testRewriterNodeReparenting()
|
|||||||
// reparent into the hierarchy
|
// reparent into the hierarchy
|
||||||
rootNode.nodeListProperty("data").reparentHere(node1);
|
rootNode.nodeListProperty("data").reparentHere(node1);
|
||||||
|
|
||||||
expected = "\n"
|
expected = "\n"
|
||||||
"import QtQuick 2.1\n"
|
"import QtQuick 2.1\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Rectangle {\n"
|
"Rectangle {\n"
|
||||||
" Item {\n"
|
" Item {\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"MouseArea {\n"
|
"MouseArea {\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Rectangle {\n"
|
" Rectangle {\n"
|
||||||
" Item {\n"
|
" Item {\n"
|
||||||
" Item {\n"
|
" Item {\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
QCOMPARE(textEdit.toPlainText(), expected);
|
|
||||||
|
|
||||||
QCOMPARE(stripWhiteSpaces(textEdit.toPlainText()), stripWhiteSpaces(expected));
|
QCOMPARE(stripWhiteSpaces(textEdit.toPlainText()), stripWhiteSpaces(expected));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user