2016-01-15 14:55:33 +01:00
|
|
|
# Copyright (C) 2016 The Qt Company Ltd.
|
2022-08-19 15:59:36 +02:00
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2013-05-15 13:17:33 +02:00
|
|
|
|
2012-05-10 10:53:06 +02:00
|
|
|
source("../shared/qmls.py")
|
2014-04-23 12:24:03 +02:00
|
|
|
source("../../shared/suites_qtta.py")
|
2012-04-03 14:49:47 +02:00
|
|
|
|
|
|
|
|
def main():
|
2017-10-13 10:08:08 +02:00
|
|
|
editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp")
|
2012-05-10 10:53:06 +02:00
|
|
|
if not editorArea:
|
2012-04-03 14:49:47 +02:00
|
|
|
return
|
2017-10-13 10:08:08 +02:00
|
|
|
# add basic TextEdit item to check it afterwards
|
|
|
|
|
codelines = ['TextEdit {', 'text: "Enter something"', 'anchors.top: parent.top',
|
|
|
|
|
'anchors.horizontalCenter: parent.horizontalCenter', 'anchors.topMargin: 20']
|
|
|
|
|
if not addTestableCodeAfterLine(editorArea, 'title: qsTr("Hello World")', codelines):
|
|
|
|
|
saveAndExit()
|
|
|
|
|
return
|
2012-04-03 14:49:47 +02:00
|
|
|
# write code with error (C should be lower case)
|
|
|
|
|
testingCodeLine = 'Color : "blue"'
|
|
|
|
|
type(editorArea, "<Return>")
|
|
|
|
|
type(editorArea, testingCodeLine)
|
2020-05-28 14:14:58 +02:00
|
|
|
|
2022-03-18 10:08:28 +01:00
|
|
|
invokeMenuItem("View", "Output", "Issues")
|
2020-05-28 14:14:58 +02:00
|
|
|
issuesView = waitForObject(":Qt Creator.Issues_QListView")
|
|
|
|
|
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
|
|
|
|
|
|
2012-04-03 14:49:47 +02:00
|
|
|
# invoke QML parsing
|
|
|
|
|
invokeMenuItem("Tools", "QML/JS", "Run Checks")
|
|
|
|
|
# verify that error properly reported
|
2014-05-19 17:48:14 +02:00
|
|
|
test.verify(checkSyntaxError(issuesView, ['Invalid property name "Color". (M16)'], True),
|
2012-04-03 14:49:47 +02:00
|
|
|
"Verifying if error is properly reported")
|
|
|
|
|
# repair error - go to written line
|
|
|
|
|
placeCursorToLine(editorArea, testingCodeLine)
|
2018-08-02 13:45:34 +02:00
|
|
|
for _ in range(14):
|
2012-05-25 11:52:01 +02:00
|
|
|
type(editorArea, "<Left>")
|
2013-01-18 16:28:27 +01:00
|
|
|
markText(editorArea, "Right")
|
2012-04-03 14:49:47 +02:00
|
|
|
type(editorArea, "c")
|
|
|
|
|
# invoke QML parsing
|
|
|
|
|
invokeMenuItem("Tools", "QML/JS", "Run Checks")
|
|
|
|
|
# verify that there is no error/errors cleared
|
|
|
|
|
issuesView = waitForObject(":Qt Creator.Issues_QListView")
|
|
|
|
|
issuesModel = issuesView.model()
|
|
|
|
|
# wait for issues
|
|
|
|
|
test.verify(waitFor("issuesModel.rowCount() == 0", 3000),
|
|
|
|
|
"Verifying if error was properly cleared after code fix")
|
2022-12-15 10:54:08 +01:00
|
|
|
saveAndExit()
|
2012-04-03 14:49:47 +02:00
|
|
|
|