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-03-21 14:48:31 +01:00
|
|
|
source("../../shared/qtcreator.py")
|
|
|
|
|
|
|
|
|
|
# test context sensitive help in edit mode
|
|
|
|
|
# place cursor to <lineText> keyword, in <editorArea>, and verify help to contain <helpText>
|
|
|
|
|
def verifyInteractiveQMLHelp(lineText, helpText):
|
|
|
|
|
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
|
|
|
|
# go to the specified word
|
|
|
|
|
placeCursorToLine(editorArea, lineText)
|
|
|
|
|
homeKey = "<Home>"
|
|
|
|
|
if platform.system() == "Darwin":
|
|
|
|
|
homeKey = "<Ctrl+Left>"
|
2018-11-01 11:54:21 +01:00
|
|
|
type(editorArea, homeKey)
|
2017-10-13 11:34:21 +02:00
|
|
|
snooze(1)
|
2012-03-21 14:48:31 +01:00
|
|
|
# call help
|
|
|
|
|
type(editorArea, "<F1>")
|
2017-10-13 11:34:21 +02:00
|
|
|
test.verify(waitFor('helpText in getHelpTitle()', 1000),
|
|
|
|
|
"Verifying if help is opened with documentation for '%s'.\nHelp title: %s"
|
|
|
|
|
% (helpText, getHelpTitle()))
|
2012-03-21 14:48:31 +01:00
|
|
|
|
|
|
|
|
def main():
|
2018-08-22 14:37:34 +02:00
|
|
|
startQC()
|
2013-02-22 14:31:39 +01:00
|
|
|
if not startedWithoutPluginError():
|
|
|
|
|
return
|
2015-06-23 14:39:27 +02:00
|
|
|
qchs = []
|
|
|
|
|
for p in Qt5Path.getPaths(Qt5Path.DOCS):
|
|
|
|
|
qchs.append(os.path.join(p, "qtquick.qch"))
|
|
|
|
|
addHelpDocumentation(qchs)
|
2017-11-28 15:29:37 +01:00
|
|
|
setFixedHelpViewer(HelpViewer.SIDEBYSIDE)
|
2012-03-21 14:48:31 +01:00
|
|
|
# create qt quick application
|
|
|
|
|
createNewQtQuickApplication(tempDir(), "SampleApp")
|
2017-10-13 11:34:21 +02:00
|
|
|
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
|
|
|
|
# add basic MouseArea item to check it afterwards
|
|
|
|
|
codelines = ['MouseArea {', 'anchors.fill: parent', 'onClicked: Qt.quit()']
|
|
|
|
|
if not addTestableCodeAfterLine(editorArea, 'title: qsTr("Hello World")', codelines):
|
|
|
|
|
saveAndExit()
|
|
|
|
|
return
|
|
|
|
|
invokeMenuItem("File", "Save All")
|
2012-03-21 14:48:31 +01:00
|
|
|
# verify Rectangle help
|
2015-06-23 14:39:27 +02:00
|
|
|
verifyInteractiveQMLHelp("Window {", "Window QML Type")
|
2012-03-21 14:48:31 +01:00
|
|
|
# verify MouseArea help
|
2015-06-23 14:39:27 +02:00
|
|
|
verifyInteractiveQMLHelp("MouseArea {", "MouseArea QML Type")
|
2012-03-21 14:48:31 +01:00
|
|
|
# exit
|
|
|
|
|
invokeMenuItem("File","Exit")
|