diff options
Diffstat (limited to 'tests/system/shared')
-rw-r--r-- | tests/system/shared/editor_utils.py | 13 | ||||
-rw-r--r-- | tests/system/shared/project.py | 40 | ||||
-rw-r--r-- | tests/system/shared/qtcreator.py | 1 |
3 files changed, 41 insertions, 13 deletions
diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index cf7ff7a08b..f7573e1947 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -269,7 +269,7 @@ def validateSearchResult(expectedCount): for chRow in range(model.rowCount(index)): chIndex = model.index(chRow, 0, index) resultTreeView.scrollTo(chIndex) - text = str(chIndex.data()) + text = str(chIndex.data()).rstrip('\r') rect = resultTreeView.visualRect(chIndex) doubleClick(resultTreeView, rect.x+5, rect.y+5, 0, Qt.LeftButton) editor = getEditorForFileSuffix(itemText) @@ -295,3 +295,14 @@ def invokeFindUsage(editor, line, typeOperation, n=1): type(editor, typeOperation) invokeContextMenuItem(editor, "Find Usages") return True + +def openDocument(treeElement): + try: + navigator = waitForObject(":Qt Creator_Utils::NavigationTreeView") + fileName = waitForObjectItem(navigator, treeElement).text + doubleClickItem(navigator, treeElement, 5, 5, 0, Qt.LeftButton) + mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow") + waitFor("fileName in str(mainWindow.windowTitle)") + return True + except: + return False diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 341ad5bd45..28b54dcae9 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -68,17 +68,6 @@ def openCmakeProject(projectPath, buildDir): return False return True -def shadowBuildDir(path, project, qtVersion, debugVersion): - qtVersion = qtVersion.replace(" ", "_") - qtVersion = qtVersion.replace(".", "_") - qtVersion = qtVersion.replace("(", "_") - qtVersion = qtVersion.replace(")", "_") - buildDir = path + os.sep + project + "-build-desktop-" + qtVersion - if debugVersion: - return buildDir + "_Debug" - else: - return buildDir + "_Release" - # this function returns a list of available targets - this is not 100% error proof # because the Simulator target is added for some cases even when Simulator has not # been set up inside Qt versions/Toolchains @@ -463,7 +452,11 @@ def __getSupportedPlatforms__(text, getAsStrings=False): # copy example project (sourceExample is path to project) to temporary directory inside repository def prepareTemplate(sourceExample): templateDir = os.path.abspath(tempDir() + "/template") - shutil.copytree(sourceExample, templateDir) + try: + shutil.copytree(sourceExample, templateDir) + except: + test.fatal("Error while copying '%s' to '%s'" % (sourceExample, templateDir)) + return None return templateDir def __sortFilenamesOSDependent__(filenames): @@ -509,3 +502,26 @@ def compareProjectTree(rootObject, dataset): 'Line %s in dataset' % str(i + 1)) return test.passes("No errors found in project tree") + +def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False): + if name == None: + test.fatal("File must have a name - got None.") + return + __createProjectOrFileSelectType__(" C++", template, isProject=False) + window = "{type='Utils::FileWizardDialog' unnamed='1' visible='1'}" + basePath = str(waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1' " + "window=%s}" % window).text) + lineEdit = waitForObject("{name='nameLineEdit' type='Utils::FileNameValidatingLineEdit' " + "visible='1' window=%s}" % window) + replaceEditorContent(lineEdit, name) + clickButton(waitForObject(":Next_QPushButton")) + __createProjectHandleLastPage__() + if (os.path.exists(os.path.join(basePath, name))): + overwriteDialog = "{type='Core::Internal::PromptOverwriteDialog' unnamed='1' visible='1'}" + waitForObject(overwriteDialog) + if forceOverwrite: + buttonToClick = 'OK' + else: + buttonToClick = 'Cancel' + clickButton("{text='%s' type='QPushButton' unnamed='1' visible='1' window=%s}" + % (buttonToClick, overwriteDialog)) diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index 6986ed70a7..e48fe4ad37 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -63,6 +63,7 @@ def waitForCleanShutdown(timeOut=10): shutdownDone=True if not shutdownDone and datetime.utcnow() > endtime: break + snooze(4) def __removeTmpSettingsDir__(): waitForCleanShutdown() |