2016-01-15 14:55:33 +01:00
|
|
|
# Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 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")
|
|
|
|
|
|
2023-07-20 07:22:24 +02:00
|
|
|
if platform.system() == 'Darwin':
|
|
|
|
|
keysToType = '<Command+Alt+a>'
|
|
|
|
|
expectedKeys = 'Cmd+Opt+A'
|
|
|
|
|
else:
|
|
|
|
|
keysToType = '<Ctrl+Alt+a>'
|
|
|
|
|
expectedKeys = 'Ctrl+Alt+A'
|
|
|
|
|
|
|
|
|
|
|
2012-03-21 14:48:31 +01:00
|
|
|
# test Qt Creator version information from file and dialog
|
|
|
|
|
def getQtCreatorVersionFromDialog():
|
2017-05-12 12:56:24 +02:00
|
|
|
chk = re.search("(?<=Qt Creator)\s\d+.\d+.\d+[-\w]*",
|
2021-08-12 20:19:47 +02:00
|
|
|
str(waitForObject("{text~='.*Qt Creator.*' type='QLabel' unnamed='1' visible='1' "
|
2012-09-07 14:49:16 +02:00
|
|
|
"window=':About Qt Creator_Core::Internal::VersionDialog'}").text))
|
2012-03-21 14:48:31 +01:00
|
|
|
try:
|
|
|
|
|
ver = chk.group(0).strip()
|
|
|
|
|
return ver
|
|
|
|
|
except:
|
|
|
|
|
test.fail("Failed to get the exact version from Dialog")
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def getQtCreatorVersionFromFile():
|
2023-01-23 22:55:41 +01:00
|
|
|
qtCreatorPriFileName = "../../../../cmake/QtCreatorIDEBranding.cmake"
|
2012-03-21 14:48:31 +01:00
|
|
|
# open file <qtCreatorPriFileName> and read version
|
2013-05-02 16:38:42 +02:00
|
|
|
fileText = readFile(qtCreatorPriFileName)
|
2023-01-23 22:55:41 +01:00
|
|
|
chk = re.search('(?<=set\(IDE_VERSION_DISPLAY ")\d+.\d+.\d+\S*(?="\))', fileText)
|
2012-03-21 14:48:31 +01:00
|
|
|
try:
|
|
|
|
|
ver = chk.group(0).strip()
|
|
|
|
|
return ver
|
|
|
|
|
except:
|
|
|
|
|
test.fail("Failed to get the exact version from File")
|
|
|
|
|
return ""
|
|
|
|
|
|
2013-07-24 19:42:20 +02:00
|
|
|
def checkQtCreatorHelpVersion(expectedVersion):
|
2016-05-13 17:37:41 +02:00
|
|
|
def rightStart(x):
|
|
|
|
|
return x.startswith('Qt Creator Manual')
|
|
|
|
|
|
2013-07-24 19:42:20 +02:00
|
|
|
switchViewTo(ViewConstants.HELP)
|
|
|
|
|
try:
|
2014-03-11 09:18:41 +01:00
|
|
|
helpContentWidget = waitForObject(':Qt Creator_QHelpContentWidget', 5000)
|
2016-05-18 10:36:57 +02:00
|
|
|
waitFor("any(map(rightStart, dumpItems(helpContentWidget.model())))", 10000)
|
2014-03-11 09:18:41 +01:00
|
|
|
items = dumpItems(helpContentWidget.model())
|
2023-05-05 13:13:51 +02:00
|
|
|
test.compare(list(filter(rightStart, items))[0],
|
2014-03-11 09:18:41 +01:00
|
|
|
'Qt Creator Manual %s' % expectedVersion,
|
|
|
|
|
'Verifying whether manual uses expected version.')
|
|
|
|
|
except:
|
2016-05-12 12:13:09 +02:00
|
|
|
t, v = sys.exc_info()[:2]
|
2023-05-03 23:49:59 +02:00
|
|
|
test.log("Exception caught", "%s: %s" % (t.__name__, str(v)))
|
2016-04-06 17:29:55 +02:00
|
|
|
test.fail("Missing Qt Creator Manual.")
|
2013-07-24 19:42:20 +02:00
|
|
|
|
2021-06-25 16:21:41 +02:00
|
|
|
|
|
|
|
|
def _shortcutMatches_(shortcutEdit, expectedText):
|
|
|
|
|
return str(findObject(shortcutEdit).text) == expectedText
|
|
|
|
|
|
|
|
|
|
|
2014-03-19 13:45:51 +01:00
|
|
|
def setKeyboardShortcutForAboutQtC():
|
2022-06-22 15:59:18 +02:00
|
|
|
invokeMenuItem("Edit", "Preferences...")
|
2019-07-24 15:12:16 +02:00
|
|
|
mouseClick(waitForObjectItem(":Options_QListView", "Environment"))
|
2014-03-19 13:45:51 +01:00
|
|
|
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Keyboard")
|
2023-06-09 21:55:16 +02:00
|
|
|
filter = waitForObject("{container={name='Command Mappings' type='QGroupBox' visible='1'} "
|
|
|
|
|
"type='Utils::FancyLineEdit' unnamed='1' visible='1' "
|
2017-12-11 17:27:01 +01:00
|
|
|
"placeholderText='Filter'}")
|
2014-03-19 13:45:51 +01:00
|
|
|
replaceEditorContent(filter, "about")
|
|
|
|
|
treewidget = waitForObject("{type='QTreeWidget' unnamed='1' visible='1'}")
|
|
|
|
|
modelIndex = waitForObject("{column='0' text='AboutQtCreator' type='QModelIndex' "
|
|
|
|
|
"container={column='0' text='QtCreator' type='QModelIndex' "
|
|
|
|
|
"container=%s}}" % objectMap.realName(treewidget))
|
2020-06-22 19:52:59 +02:00
|
|
|
treewidget.scrollTo(modelIndex)
|
2019-07-24 15:12:16 +02:00
|
|
|
mouseClick(modelIndex)
|
2016-04-22 13:48:47 +02:00
|
|
|
shortcutGB = "{title='Shortcut' type='QGroupBox' unnamed='1' visible='1'}"
|
|
|
|
|
record = waitForObject("{container=%s type='Core::Internal::ShortcutButton' unnamed='1' "
|
|
|
|
|
"visible='1' text~='(Stop Recording|Record)'}" % shortcutGB)
|
|
|
|
|
shortcut = ("{container=%s type='Utils::FancyLineEdit' unnamed='1' visible='1' "
|
2017-12-11 17:27:01 +01:00
|
|
|
"placeholderText='Enter key sequence as text'}" % shortcutGB)
|
2016-04-22 13:48:47 +02:00
|
|
|
clickButton(record)
|
2023-07-20 07:22:24 +02:00
|
|
|
nativeType(keysToType)
|
|
|
|
|
waitFor("_shortcutMatches_(shortcut, expectedKeys)", 5000)
|
2016-04-22 13:48:47 +02:00
|
|
|
clickButton(record)
|
2017-08-02 09:31:44 +02:00
|
|
|
|
2023-07-20 07:22:24 +02:00
|
|
|
gotExpectedShortcut = _shortcutMatches_(shortcut, expectedKeys)
|
2021-06-25 16:21:41 +02:00
|
|
|
if not gotExpectedShortcut and platform.system() == 'Darwin':
|
2017-08-02 09:31:44 +02:00
|
|
|
test.warning("Squish Issue: shortcut was set to %s - entering it manually now"
|
|
|
|
|
% waitForObject(shortcut).text)
|
2023-07-20 07:22:24 +02:00
|
|
|
replaceEditorContent(shortcut, expectedKeys)
|
2017-08-02 09:31:44 +02:00
|
|
|
else:
|
2021-06-25 16:21:41 +02:00
|
|
|
test.verify(gotExpectedShortcut, "Expected key sequence is displayed.")
|
2014-03-19 13:45:51 +01:00
|
|
|
clickButton(waitForObject(":Options.OK_QPushButton"))
|
|
|
|
|
|
2012-03-21 14:48:31 +01:00
|
|
|
def main():
|
|
|
|
|
expectedVersion = getQtCreatorVersionFromFile()
|
|
|
|
|
if not expectedVersion:
|
|
|
|
|
test.fatal("Can't find version from file.")
|
|
|
|
|
return
|
2018-08-22 14:37:34 +02:00
|
|
|
startQC()
|
2013-02-22 14:31:39 +01:00
|
|
|
if not startedWithoutPluginError():
|
|
|
|
|
return
|
2014-03-19 13:45:51 +01:00
|
|
|
setKeyboardShortcutForAboutQtC()
|
|
|
|
|
if platform.system() == 'Darwin':
|
|
|
|
|
try:
|
|
|
|
|
waitForObject(":Qt Creator.QtCreator.MenuBar_QMenuBar", 2000)
|
|
|
|
|
except:
|
|
|
|
|
nativeMouseClick(waitForObject(":Qt Creator_Core::Internal::MainWindow", 1000), 20, 20, 0, Qt.LeftButton)
|
2023-07-20 07:22:24 +02:00
|
|
|
nativeType(keysToType)
|
2012-03-21 14:48:31 +01:00
|
|
|
# verify qt creator version
|
2014-03-21 15:02:21 +01:00
|
|
|
try:
|
|
|
|
|
waitForObject(":About Qt Creator_Core::Internal::VersionDialog", 5000)
|
|
|
|
|
except:
|
|
|
|
|
test.warning("Using workaround of invoking menu entry "
|
|
|
|
|
"(known issue when running on Win inside Jenkins)")
|
|
|
|
|
if platform.system() == "Darwin":
|
|
|
|
|
invokeMenuItem("Help", "About Qt Creator")
|
|
|
|
|
else:
|
|
|
|
|
invokeMenuItem("Help", "About Qt Creator...")
|
|
|
|
|
waitForObject(":About Qt Creator_Core::Internal::VersionDialog", 5000)
|
2012-03-21 14:48:31 +01:00
|
|
|
actualVersion = getQtCreatorVersionFromDialog()
|
2017-04-25 16:34:28 +02:00
|
|
|
test.compare(actualVersion, expectedVersion,
|
|
|
|
|
"Verifying version. Current version is '%s', expected version is '%s'"
|
|
|
|
|
% (actualVersion, expectedVersion))
|
2012-03-21 14:48:31 +01:00
|
|
|
# close and verify about dialog closed
|
2012-09-07 14:49:16 +02:00
|
|
|
clickButton(waitForObject("{text='Close' type='QPushButton' unnamed='1' visible='1' "
|
|
|
|
|
"window=':About Qt Creator_Core::Internal::VersionDialog'}"))
|
2012-03-21 14:48:31 +01:00
|
|
|
test.verify(checkIfObjectExists(":About Qt Creator_Core::Internal::VersionDialog", False),
|
|
|
|
|
"Verifying if About dialog closed.")
|
2013-07-24 19:42:20 +02:00
|
|
|
checkQtCreatorHelpVersion(expectedVersion)
|
2012-03-21 14:48:31 +01:00
|
|
|
# exit qt creator
|
|
|
|
|
invokeMenuItem("File", "Exit")
|
|
|
|
|
# verify if qt creator closed properly
|
|
|
|
|
test.verify(checkIfObjectExists(":Qt Creator_Core::Internal::MainWindow", False),
|
|
|
|
|
"Verifying if Qt Creator closed.")
|