aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/CMakeLists.txt8
-rw-r--r--tests/auto/qml/codemodel/CMakeLists.txt4
-rw-r--r--tests/auto/qml/codemodel/check/CMakeLists.txt8
-rw-r--r--tests/auto/qml/codemodel/dependencies/CMakeLists.txt9
-rw-r--r--tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp4
-rw-r--r--tests/auto/qml/codemodel/ecmascript7/CMakeLists.txt9
-rw-r--r--tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp8
-rw-r--r--tests/auto/qml/codemodel/importscheck/CMakeLists.txt9
-rw-r--r--tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp4
-rw-r--r--tests/auto/qml/persistenttrie/CMakeLists.txt8
-rw-r--r--tests/auto/qml/qml.pro6
-rw-r--r--tests/auto/qml/qmldesigner/CMakeLists.txt1
-rw-r--r--tests/auto/qml/qmldesigner/coretests/CMakeLists.txt20
-rw-r--r--tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp40
-rw-r--r--tests/auto/qml/qmldesigner/coretests/tst_testcore.h1
-rw-r--r--tests/auto/qml/qmleditor/CMakeLists.txt1
-rw-r--r--tests/auto/qml/qmleditor/qmlcodeformatter/CMakeLists.txt8
-rw-r--r--tests/auto/qml/qmljssimplereader/CMakeLists.txt8
-rw-r--r--tests/auto/qml/qmlprojectmanager/CMakeLists.txt1
-rw-r--r--tests/auto/qml/qmlprojectmanager/fileformat/CMakeLists.txt15
-rw-r--r--tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp2
-rw-r--r--tests/auto/qml/qrcparser/CMakeLists.txt8
-rw-r--r--tests/auto/qml/qrcparser/qrcparser.pro2
-rw-r--r--tests/auto/qml/qrcparser/qrcparser.qbs5
-rw-r--r--tests/auto/qml/qrcparser/tst_qrcparser.cpp4
-rw-r--r--tests/auto/qml/reformatter/CMakeLists.txt8
-rw-r--r--tests/auto/qml/reformatter/comments.qml8
-rw-r--r--tests/auto/qml/reformatter/enum.qml14
-rw-r--r--tests/auto/qml/reformatter/jssyntax.js10
-rw-r--r--tests/auto/qml/reformatter/objectliteral.js2
-rw-r--r--tests/auto/qml/reformatter/qmlsingleton.qml3
-rw-r--r--tests/auto/qml/reformatter/qmlsyntax.qml4
32 files changed, 221 insertions, 21 deletions
diff --git a/tests/auto/qml/CMakeLists.txt b/tests/auto/qml/CMakeLists.txt
new file mode 100644
index 0000000000..61e6c1e0b5
--- /dev/null
+++ b/tests/auto/qml/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_subdirectory(codemodel)
+add_subdirectory(persistenttrie)
+add_subdirectory(qmldesigner)
+add_subdirectory(qmleditor)
+add_subdirectory(qmljssimplereader)
+add_subdirectory(qmlprojectmanager)
+add_subdirectory(qrcparser)
+add_subdirectory(reformatter)
diff --git a/tests/auto/qml/codemodel/CMakeLists.txt b/tests/auto/qml/codemodel/CMakeLists.txt
new file mode 100644
index 0000000000..94eae7af58
--- /dev/null
+++ b/tests/auto/qml/codemodel/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_subdirectory(check )
+add_subdirectory(dependencies )
+add_subdirectory(ecmascript7 )
+add_subdirectory(importscheck )
diff --git a/tests/auto/qml/codemodel/check/CMakeLists.txt b/tests/auto/qml/codemodel/check/CMakeLists.txt
new file mode 100644
index 0000000000..fdcd1334bd
--- /dev/null
+++ b/tests/auto/qml/codemodel/check/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_qtc_test(tst_qml_check
+ DEPENDS qmljs
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_check.cpp
+)
diff --git a/tests/auto/qml/codemodel/dependencies/CMakeLists.txt b/tests/auto/qml/codemodel/dependencies/CMakeLists.txt
new file mode 100644
index 0000000000..544e771873
--- /dev/null
+++ b/tests/auto/qml/codemodel/dependencies/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_qtc_test(tst_qml_dependencies
+ DEPENDS qmljs QmlJSTools ExtensionSystem Utils
+ INCLUDES "${CMAKE_SOURCE_DIR}/src/plugins"
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_dependencies.cpp
+)
diff --git a/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp b/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp
index 842cec7e4e..79ce9cec1b 100644
--- a/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp
+++ b/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp
@@ -112,7 +112,7 @@ private:
void tst_Dependencies::initTestCase()
{
- m_path = QLatin1Literal(TESTSRCDIR "/samples");
+ m_path = QLatin1String(TESTSRCDIR "/samples");
m_basePaths.append(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath));
@@ -148,7 +148,7 @@ void tst_Dependencies::test()
QStringList paths(m_basePaths);
paths << m_path;
for (auto p: paths)
- lPaths.maybeInsert(Utils::FileName::fromString(p), Dialect::Qml);
+ lPaths.maybeInsert(Utils::FilePath::fromString(p), Dialect::Qml);
ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), lPaths,
ModelManagerInterface::instance(), false);
diff --git a/tests/auto/qml/codemodel/ecmascript7/CMakeLists.txt b/tests/auto/qml/codemodel/ecmascript7/CMakeLists.txt
new file mode 100644
index 0000000000..62a0ba588d
--- /dev/null
+++ b/tests/auto/qml/codemodel/ecmascript7/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_qtc_test(tst_qml_ecmascript7
+ DEPENDS qmljs QmlJSTools ExtensionSystem Utils
+ INCLUDES "${CMAKE_SOURCE_DIR}/src/plugins"
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_ecmascript7.cpp
+)
diff --git a/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp b/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp
index fd6a54b59b..735daa04f7 100644
--- a/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp
+++ b/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp
@@ -124,7 +124,7 @@ private slots:
void test();
private:
- QList<QFileInfo> m_files;
+ QFileInfoList m_files;
QStringList m_basePaths;
};
@@ -134,13 +134,13 @@ void tst_Ecmascript::initTestCase()
QDirIterator it(sampledir, QDirIterator::Subdirectories);
- QStringList skipList = readSkipList(sampledir, QLatin1Literal("skip.txt"));
+ QStringList skipList = readSkipList(sampledir, QLatin1String("skip.txt"));
while (it.hasNext()) {
QString path = it.next();
if (skipList.contains(path))
continue;
QFileInfo f(path);
- if (f.isFile() && f.suffix() == QLatin1Literal("js"))
+ if (f.isFile() && f.suffix() == QLatin1String("js"))
m_files << f;
}
@@ -174,7 +174,7 @@ void tst_Ecmascript::test()
PathsAndLanguages lPaths;
QStringList paths(m_basePaths);
for (auto p: paths)
- lPaths.maybeInsert(Utils::FileName::fromString(p), Dialect::Qml);
+ lPaths.maybeInsert(Utils::FilePath::fromString(p), Dialect::Qml);
ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), lPaths,
ModelManagerInterface::instance(), false);
diff --git a/tests/auto/qml/codemodel/importscheck/CMakeLists.txt b/tests/auto/qml/codemodel/importscheck/CMakeLists.txt
new file mode 100644
index 0000000000..5f994a58ee
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_qtc_test(tst_qml_importscheck
+ DEPENDS qmljs QmlJSTools Utils CPlusPlus
+ INCLUDES "${CMAKE_SOURCE_DIR}/src/plugins"
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_importscheck.cpp
+)
diff --git a/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp b/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp
index dcedd6df69..0c11438e12 100644
--- a/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp
+++ b/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp
@@ -67,7 +67,7 @@ void scanDir(const QString &dir)
{
QFutureInterface<void> result;
PathsAndLanguages paths;
- paths.maybeInsert(Utils::FileName::fromString(dir), Dialect::Qml);
+ paths.maybeInsert(Utils::FilePath::fromString(dir), Dialect::Qml);
ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), paths,
ModelManagerInterface::instance(), false);
ViewerContext vCtx = ViewerContext(QStringList(), QStringList(dir));
@@ -178,7 +178,7 @@ void tst_ImportCheck::test()
QFutureInterface<void> result;
PathsAndLanguages lPaths;
foreach (const QString &path, paths)
- lPaths.maybeInsert(Utils::FileName::fromString(path), Dialect::Qml);
+ lPaths.maybeInsert(Utils::FilePath::fromString(path), Dialect::Qml);
ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), lPaths,
ModelManagerInterface::instance(), false);
ViewerContext vCtx(QStringList(), paths);
diff --git a/tests/auto/qml/persistenttrie/CMakeLists.txt b/tests/auto/qml/persistenttrie/CMakeLists.txt
new file mode 100644
index 0000000000..2ab22d0919
--- /dev/null
+++ b/tests/auto/qml/persistenttrie/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_qtc_test(tst_qml_testtrie
+ DEPENDS qmljs
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_testtrie.cpp
+)
diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro
index 2f9a2f1b2c..c0da615d8b 100644
--- a/tests/auto/qml/qml.pro
+++ b/tests/auto/qml/qml.pro
@@ -9,13 +9,13 @@ SUBDIRS += \
qrcparser \
persistenttrie
-DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER)
-isEmpty(DO_NOT_BUILD_QMLDESIGNER):qtHaveModule(quick-private) {
+QTC_DO_NOT_BUILD_QMLDESIGNER = $$(QTC_DO_NOT_BUILD_QMLDESIGNER)
+isEmpty(QTC_DO_NOT_BUILD_QMLDESIGNER):qtHaveModule(quick-private) {
SUBDIRS += qmldesigner
} else {
!qtHaveModule(quick-private) {
warning("QmlDesigner plugin has been disabled since the Qt Quick module is not available.")
} else {
- warning("QmlDesigner plugin has been disabled since DO_NOT_BUILD_QMLDESIGNER is set.")
+ warning("QmlDesigner plugin has been disabled since QTC_DO_NOT_BUILD_QMLDESIGNER is set.")
}
}
diff --git a/tests/auto/qml/qmldesigner/CMakeLists.txt b/tests/auto/qml/qmldesigner/CMakeLists.txt
new file mode 100644
index 0000000000..9d4ab11adc
--- /dev/null
+++ b/tests/auto/qml/qmldesigner/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(coretests)
diff --git a/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt b/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt
new file mode 100644
index 0000000000..3e83f280af
--- /dev/null
+++ b/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt
@@ -0,0 +1,20 @@
+# TODO: fix compiler errors
+return()
+
+add_qtc_test(tst_qml_testcore
+ DEPENDS qmljs Utils QmlEditorWidgets CPlusPlus Core QmlJSEditor
+ INCLUDES
+ "${CMAKE_SOURCE_DIR}/src/plugins/qmldesigner/designercore/include"
+ "${CMAKE_SOURCE_DIR}/src/plugins/qmldesigner/designercore"
+ "${CMAKE_SOURCE_DIR}/share/qtcreator/qml/qmlpuppet/interfaces"
+ "${CMAKE_SOURCE_DIR}/share/qtcreator/qml/qmlpuppet/types"
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES
+ ../data/testfiles.qrc
+ ../testview.cpp ../testview.h
+ testrewriterview.cpp testrewriterview.h
+ tst_testcore.cpp tst_testcore.h
+)
diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
index 1a4eda3bcc..31ea4e5914 100644
--- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
+++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
@@ -185,7 +185,7 @@ void tst_TestCore::initTestCase()
QFutureInterface<void> result;
QmlJS::PathsAndLanguages lPaths;
- lPaths.maybeInsert(Utils::FileName::fromString(basePaths.first()), QmlJS::Dialect::Qml);
+ lPaths.maybeInsert(Utils::FilePath::fromString(basePaths.first()), QmlJS::Dialect::Qml);
QmlJS::ModelManagerInterface::importScan(result, QmlJS::ModelManagerInterface::workingCopy(),
lPaths, QmlJS::ModelManagerInterface::instance(), false);
@@ -1017,6 +1017,44 @@ void tst_TestCore::testRewriterUnicodeChars()
QCOMPARE(textEdit.toPlainText(), unicodeChar);
}
+void tst_TestCore::testRewriterTransactionAddingAfterReparenting()
+{
+ const QLatin1String qmlString("\n"
+ "import QtQuick 2.0\n"
+ "\n"
+ "Item {\n"
+ "}\n");
+
+ QPlainTextEdit textEdit;
+ textEdit.setPlainText(qmlString);
+ NotIndentingTextEditModifier modifier(&textEdit);
+
+ QScopedPointer<Model> model(Model::create("QtQuick.Rectangle"));
+
+ QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView(0, RewriterView::Amend));
+ testRewriterView->setTextModifier(&modifier);
+ model->attachView(testRewriterView.data());
+
+ QVERIFY(testRewriterView->errors().isEmpty());
+
+ ModelNode rootModelNode = testRewriterView->rootModelNode();
+ QVERIFY(rootModelNode.isValid());
+
+ {
+ /* Regression test
+ * If a node is not a direct child node of the root item we did get an exception when adding properties
+ * after the reparent */
+
+ RewriterTransaction transaction = testRewriterView->beginRewriterTransaction("TEST");
+ ModelNode rectangle = testRewriterView->createModelNode("QtQuick.Rectangle", 2, 0);
+ rootModelNode.nodeListProperty("data").reparentHere(rectangle);
+ ModelNode rectangle2 = testRewriterView->createModelNode("QtQuick.Rectangle", 2, 0);
+ rectangle.nodeListProperty("data").reparentHere(rectangle2);
+
+ rectangle2.variantProperty("width").setValue(100);
+ }
+}
+
void tst_TestCore::testRewriterForGradientMagic()
{
const QLatin1String qmlString("\n"
diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h
index 3f1eec576b..92f3b17161 100644
--- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h
+++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h
@@ -140,6 +140,7 @@ private slots:
void testRewriterImports();
void testRewriterChangeImports();
void testRewriterUnicodeChars();
+ void testRewriterTransactionAddingAfterReparenting();
//
// unit tests QmlModelNodeFacade/QmlModelState
diff --git a/tests/auto/qml/qmleditor/CMakeLists.txt b/tests/auto/qml/qmleditor/CMakeLists.txt
new file mode 100644
index 0000000000..93a723626e
--- /dev/null
+++ b/tests/auto/qml/qmleditor/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(qmlcodeformatter)
diff --git a/tests/auto/qml/qmleditor/qmlcodeformatter/CMakeLists.txt b/tests/auto/qml/qmleditor/qmlcodeformatter/CMakeLists.txt
new file mode 100644
index 0000000000..d8daee0578
--- /dev/null
+++ b/tests/auto/qml/qmleditor/qmlcodeformatter/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_qtc_test(tst_qml_qmlcodeformatter
+ DEPENDS qmljs QmlJSTools TextEditor
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_qmlcodeformatter.cpp
+)
diff --git a/tests/auto/qml/qmljssimplereader/CMakeLists.txt b/tests/auto/qml/qmljssimplereader/CMakeLists.txt
new file mode 100644
index 0000000000..4742047d7b
--- /dev/null
+++ b/tests/auto/qml/qmljssimplereader/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_qtc_test(tst_qml_qmljssimplereader
+ DEPENDS qmljs
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_qmljssimplereader.cpp
+)
diff --git a/tests/auto/qml/qmlprojectmanager/CMakeLists.txt b/tests/auto/qml/qmlprojectmanager/CMakeLists.txt
new file mode 100644
index 0000000000..f7c00d44bd
--- /dev/null
+++ b/tests/auto/qml/qmlprojectmanager/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(fileformat)
diff --git a/tests/auto/qml/qmlprojectmanager/fileformat/CMakeLists.txt b/tests/auto/qml/qmlprojectmanager/fileformat/CMakeLists.txt
new file mode 100644
index 0000000000..5d7f7c79bf
--- /dev/null
+++ b/tests/auto/qml/qmlprojectmanager/fileformat/CMakeLists.txt
@@ -0,0 +1,15 @@
+get_target_property(QmlProjectManagerSources QmlProjectManager SOURCES)
+foreach(source IN LISTS QmlProjectManagerSources)
+ if (source MATCHES "fileformat")
+ list(APPEND fileformat_sources "${CMAKE_SOURCE_DIR}/src/plugins/qmlprojectmanager/${source}")
+ endif()
+endforeach()
+
+add_qtc_test(tst_qml_fileformat
+ DEPENDS qmljs Utils
+ INCLUDES "${CMAKE_SOURCE_DIR}/src/plugins/qmlprojectmanager/fileformat"
+ DEFINES
+ QT_CREATOR
+ SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_fileformat.cpp ${fileformat_sources}
+)
diff --git a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp
index bca2e8d7a8..fe61dd0ea5 100644
--- a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp
+++ b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp
@@ -54,7 +54,7 @@ QString testDataDir = QLatin1String(SRCDIR "/data");
static QmlProjectItem *loadQmlProject(QString name, QString *error)
{
return QmlProjectFileFormat::parseProjectFile(
- Utils::FileName::fromString(testDataDir).appendPath(name).appendString(".qmlproject"), error);
+ Utils::FilePath::fromString(testDataDir).pathAppended(name + ".qmlproject"), error);
}
void tst_FileFormat::testFileFilter()
diff --git a/tests/auto/qml/qrcparser/CMakeLists.txt b/tests/auto/qml/qrcparser/CMakeLists.txt
new file mode 100644
index 0000000000..bcecb807e4
--- /dev/null
+++ b/tests/auto/qml/qrcparser/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_qtc_test(tst_qml_qrcparser
+ DEPENDS qmljs Utils
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_qrcparser.cpp
+)
diff --git a/tests/auto/qml/qrcparser/qrcparser.pro b/tests/auto/qml/qrcparser/qrcparser.pro
index 571c0a11a3..cb991a4e8f 100644
--- a/tests/auto/qml/qrcparser/qrcparser.pro
+++ b/tests/auto/qml/qrcparser/qrcparser.pro
@@ -1,5 +1,5 @@
#include(../shared/shared.pri)
-QTC_PLUGIN_DEPENDS += qmljstools
+QTC_LIB_DEPENDS += utils
include(../../qttest.pri)
#DEFINES+=CPLUSPLUS_BUILD_STATIC_LIB
include($$IDE_SOURCE_TREE/src/rpath.pri)
diff --git a/tests/auto/qml/qrcparser/qrcparser.qbs b/tests/auto/qml/qrcparser/qrcparser.qbs
index f08e32a063..432dca6d8b 100644
--- a/tests/auto/qml/qrcparser/qrcparser.qbs
+++ b/tests/auto/qml/qrcparser/qrcparser.qbs
@@ -1,9 +1,8 @@
import qbs
QtcAutotest {
- name: "QML qrc parser autotest"
- Depends { name: "QmlJS" }
- Depends { name: "QmlJSTools" }
+ name: "qrc parser autotest"
+ Depends { name: "Utils" }
files: "tst_qrcparser.cpp"
cpp.defines: base.concat(['TESTSRCDIR="' + path + '"'])
}
diff --git a/tests/auto/qml/qrcparser/tst_qrcparser.cpp b/tests/auto/qml/qrcparser/tst_qrcparser.cpp
index d8c3f03c36..10f3dfd10c 100644
--- a/tests/auto/qml/qrcparser/tst_qrcparser.cpp
+++ b/tests/auto/qml/qrcparser/tst_qrcparser.cpp
@@ -27,9 +27,9 @@
#include <QDebug>
#include <QLocale>
-#include <qmljs/qmljsqrcparser.h>
+#include <utils/qrcparser.h>
-using namespace QmlJS;
+using namespace Utils;
class tst_QrcParser: public QObject
{
diff --git a/tests/auto/qml/reformatter/CMakeLists.txt b/tests/auto/qml/reformatter/CMakeLists.txt
new file mode 100644
index 0000000000..a9119ccd93
--- /dev/null
+++ b/tests/auto/qml/reformatter/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_qtc_test(tst_qml_reformatter
+ DEPENDS qmljs
+ DEFINES
+ QT_CREATOR
+ QTCREATORDIR="${CMAKE_SOURCE_DIR}"
+ TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES tst_reformatter.cpp
+)
diff --git a/tests/auto/qml/reformatter/comments.qml b/tests/auto/qml/reformatter/comments.qml
index 4ced7eb0e8..d2caa1b555 100644
--- a/tests/auto/qml/reformatter/comments.qml
+++ b/tests/auto/qml/reformatter/comments.qml
@@ -21,5 +21,13 @@ Item {
{
console.log("test")
}
+
+ var a = 1
+ if (a > 0) {
+ console.log("positive")
+ } // Final condition
+ else {
+ console.log("negative or zero")
+ }
}
}
diff --git a/tests/auto/qml/reformatter/enum.qml b/tests/auto/qml/reformatter/enum.qml
new file mode 100644
index 0000000000..769386494d
--- /dev/null
+++ b/tests/auto/qml/reformatter/enum.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ enum Test {
+ A,
+ B
+ }
+
+ enum TestWithValues {
+ A = 11.1,
+ B,
+ C = 3
+ }
+}
diff --git a/tests/auto/qml/reformatter/jssyntax.js b/tests/auto/qml/reformatter/jssyntax.js
index 5ef1a2adcd..d651cd7822 100644
--- a/tests/auto/qml/reformatter/jssyntax.js
+++ b/tests/auto/qml/reformatter/jssyntax.js
@@ -1,6 +1,10 @@
var x
var y = 12
+var a_var = 1
+let a_let = 2
+const a_const = 3
+
function foo(a, b) {
x = 15
x += 4
@@ -28,6 +32,12 @@ while (true) {
for (var x in a) {
print(a[x])
}
+ for (let x in a) {
+ print(a[x])
+ }
+ for (const x in a) {
+ print(a[x])
+ }
do {
a = x
diff --git a/tests/auto/qml/reformatter/objectliteral.js b/tests/auto/qml/reformatter/objectliteral.js
index 37f6863374..d260712166 100644
--- a/tests/auto/qml/reformatter/objectliteral.js
+++ b/tests/auto/qml/reformatter/objectliteral.js
@@ -10,3 +10,5 @@ var x = {
},
"z": 12
}
+
+var empty_object = {}
diff --git a/tests/auto/qml/reformatter/qmlsingleton.qml b/tests/auto/qml/reformatter/qmlsingleton.qml
index d64f554097..05a08e7de4 100644
--- a/tests/auto/qml/reformatter/qmlsingleton.qml
+++ b/tests/auto/qml/reformatter/qmlsingleton.qml
@@ -2,5 +2,4 @@ pragma Singleton
import QtQuick 2.0
-Item {
-}
+Item {}
diff --git a/tests/auto/qml/reformatter/qmlsyntax.qml b/tests/auto/qml/reformatter/qmlsyntax.qml
index ded863106a..3e55503049 100644
--- a/tests/auto/qml/reformatter/qmlsyntax.qml
+++ b/tests/auto/qml/reformatter/qmlsyntax.qml
@@ -9,6 +9,8 @@ Text {
property int foo
property alias bar: x
property list<QtObject> pro
+ property Part.Particles particles
+ property list<Part.Particles> particlesList
default property int def
property var baz: Rectangle {
width: 20
@@ -45,4 +47,6 @@ Text {
function foo(a, b) {
x = a + 12 * b
}
+
+ value: Rectangle {}
}