Commit 25decf20 authored by Christian Stenger's avatar Christian Stenger Committed by Robert Löhning
Browse files

Squish: Fixing Mac



* removed unused object
* refactored invokeMenuItem()
* always lookup cppwindow to avoid failing type()
* use objects stored inside objects.map to avoid LookupError
* reverted raising timeout to 60s
* added workaround for missing focus on Mac right after
  startApplication()
* removed the need to have a shell-script called 'qtcreator'
  (make sure to add 'Qt Creator.app' as AUT now)

Change-Id: I21511d810deedf31dfb19b896edd21b79e73b755
Reviewed-by: default avatarBill King <bill.king@nokia.com>
Reviewed-by: default avatarRobert Löhning <robert.loehning@nokia.com>
parent 6e72f24f
......@@ -13,8 +13,8 @@
:CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard {type='CMakeProjectManager::Internal::CMakeOpenProjectWizard' unnamed='1' visible='1' windowTitle='CMake Wizard'}
:DebugModeWidget.Debugger Log_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.Output' type='QDockWidget' visible='1' windowTitle='Debugger Log'}
:Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:New.frame_QFrame {name='frame' type='QFrame' visible='1' window=':New_Core::Internal::NewDialog'}
:New.templateCategoryView_QTreeView {name='templateCategoryView' type='QTreeView' visible='1' window=':New_Core::Internal::NewDialog'}
:New.templatesView_QListView {name='templatesView' type='QListView' visible='1' window=':New_Core::Internal::NewDialog'}
:New_Core::Internal::NewDialog {name='Core__Internal__NewDialog' type='Core::Internal::NewDialog' visible='1' windowTitle='New'}
:Next_QPushButton {text~='(Next.*|Continue)' type='QPushButton' visible='1'}
:Options.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
......@@ -50,6 +50,7 @@
:Symbol Server_Utils::CheckableMessageBox {type='Utils::CheckableMessageBox' unnamed='1' visible='1' windowTitle='Symbol Server'}
:addToVersionControlComboBox_QComboBox {name='addToVersionControlComboBox' type='QComboBox' visible='1'}
:formFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Form file:_QLabel' name='formFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'}
:frame.templateDescription_QTextBrowser {container=':New.frame_QFrame' name='templateDescription' type='QTextBrowser' visible='1'}
:headerFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Header file:_QLabel' name='headerFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'}
:projects.projects.pro_QModelIndex {column='0' container=':projects_QModelIndex' text='projects.pro' type='QModelIndex'}
:projects_QModelIndex {column='0' container=':Qt Creator_Utils::NavigationTreeView' text='projects' type='QModelIndex'}
......
......@@ -24,6 +24,17 @@ source("../../shared/hook_utils.py")
source("../../shared/debugger.py")
source("../../shared/workarounds.py")
if platform.system() == "Darwin":
__origStartApplication__ = startApplication
def startApplication(*args):
args = list(args)
if str(args[0]).startswith('qtcreator'):
args[0] = args[0].replace('qtcreator', '"Qt Creator"', 1)
__origStartApplication__(*args)
test.log("Using workaround for MacOS (losing focus & different AUT name)")
setWindowState(findObject(":Qt Creator_Core::Internal::MainWindow"), WindowState.Maximize)
def waitForCleanShutdown(timeOut=10):
appCtxt = currentApplicationContext()
shutdownDone = (str(appCtxt)=="")
......
......@@ -169,12 +169,15 @@ def cleanUpUserFiles(pathsToProFiles=None):
return doneWithoutErrors
def invokeMenuItem(menu, item, subItem = None):
menuObject = waitForObjectItem("{type='QMenuBar' visible='true'}", menu)
menuObject = waitForObjectItem(":Qt Creator.QtCreator.MenuBar_QMenuBar", menu)
activateItem(menuObject)
itemObject = waitForObjectItem(objectMap.realName(menuObject), item)
waitFor("menuObject.visible", 1000)
activateItem(itemObject)
if subItem != None:
activateItem(waitForObjectItem("{type='QMenu' visible='1' title='%s'}" % item, subItem))
sub = itemObject.menu()
waitFor("sub.visible", 1000)
activateItem(waitForObjectItem(sub, subItem))
def logApplicationOutput():
# make sure application output is shown
......
......@@ -55,7 +55,7 @@ def main():
invokeMenuItem("Debug", "Start Debugging", "Start Debugging")
JIRA.performWorkaroundIfStillOpen(6853, JIRA.Bug.CREATOR, config)
handleDebuggerWarnings(config)
waitFor("runControlFinished==True", 60000)
waitFor("runControlFinished==True", 20000)
if not runControlFinished:
test.warning("Waiting for runControlFinished timed out")
try:
......
......@@ -62,10 +62,11 @@ def main():
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "Dummy::Dummy")
# Take us to the second instance
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "<Return>")
cppWindowRealName = waitForObject(objectMap.realName(cppwindow))
__typeAndWaitForAction__(cppWindowRealName, "<Shift+F2>")
cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
__typeAndWaitForAction__(cppwindow, "<Shift+F2>")
test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), " Dummy(int a);")
__typeAndWaitForAction__(cppWindowRealName, "<Shift+F2>")
cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
__typeAndWaitForAction__(cppwindow, "<Shift+F2>")
test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "Dummy::Dummy(int)")
invokeMenuItem("File", "Exit")
......@@ -94,4 +95,6 @@ def __typeAndWaitForAction__(editor, keyCombination):
textChanged = False
cursorPos = editor.textCursor().position()
type(editor, keyCombination)
waitFor("textChanged or editor.textCursor().position() != cursorPos")
waitFor("textChanged or editor.textCursor().position() != cursorPos", 2000)
if not (textChanged or editor.textCursor().position()!=cursorPos):
test.warning("Waiting timed out...")
......@@ -10,13 +10,13 @@ def main():
prepareTemplate(sourceExample)
startApplication("qtcreator" + SettingsPath)
overrideInstallLazySignalHandler()
installLazySignalHandler("{type='QTextBrowser' name='templateDescription' visible='1'}",
installLazySignalHandler(":frame.templateDescription_QTextBrowser",
"textChanged()","__handleTextChanged__")
targets = getCorrectlyConfiguredTargets()
test.log("Collecting potential project types...")
availableProjectTypes = []
invokeMenuItem("File", "New File or Project...")
categoriesView = waitForObject("{type='QTreeView' name='templateCategoryView' visible='1'}", 20000)
categoriesView = waitForObject(":New.templateCategoryView_QTreeView", 20000)
catModel = categoriesView.model()
projects = catModel.index(0, 0)
test.compare("Projects", str(projects.data()))
......@@ -46,14 +46,14 @@ def main():
category = current.keys()[0]
template = current.values()[0]
invokeMenuItem("File", "New File or Project...")
categoriesView = waitForObject("{type='QTreeView' name='templateCategoryView' visible='1'}", 20000)
categoriesView = waitForObject(":New.templateCategoryView_QTreeView", 20000)
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}", 20000)
test.log("Verifying '%s' -> '%s'" % (category.replace("\\.", "."), template.replace("\\.", ".")))
textChanged = False
clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton)
waitFor("textChanged", 2000)
text = waitForObject("{type='QTextBrowser' name='templateDescription' visible='1'}").plainText
text = waitForObject(":frame.templateDescription_QTextBrowser").plainText
displayedPlatforms, requiredVersion = __getSupportedPlatforms__(str(text), True)
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
# don't check because project could exist
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment