diff options
author | Eike Ziller <eike.ziller@digia.com> | 2014-01-20 14:21:46 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2014-01-20 14:21:46 +0100 |
commit | cdd19fe6ad689aef9f884014e8d7ba29334d952a (patch) | |
tree | fe0c3dde795ca7096a8150ed03a2578dfcb1124d /tests | |
parent | a309b3cfe6173a923988f645aad0488d65589f0f (diff) | |
parent | 7312733452d01e32c80e82bc84e83a13fe0dbd5c (diff) | |
download | qt-creator-cdd19fe6ad689aef9f884014e8d7ba29334d952a.tar.gz |
Merge remote-tracking branch 'origin/3.0'
Conflicts:
src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
Change-Id: If62ec06ea069a7eba6735101e5334b0c1f66861f
Diffstat (limited to 'tests')
-rw-r--r-- | tests/system/objects.map | 3 | ||||
-rw-r--r-- | tests/system/shared/project.py | 24 | ||||
-rw-r--r-- | tests/system/shared/project_explorer.py | 11 | ||||
-rw-r--r-- | tests/system/suite_SCOM/tst_SCOM04/test.py | 3 | ||||
-rw-r--r-- | tests/system/suite_debugger/tst_debug_empty_main/test.py | 7 | ||||
-rw-r--r-- | tests/system/suite_general/tst_default_settings/test.py | 4 | ||||
-rw-r--r-- | tests/system/suite_general/tst_rename_file/test.py | 6 | ||||
-rw-r--r-- | tests/system/suite_tools/tst_git_clone/test.py | 9 | ||||
-rw-r--r-- | tests/system/suite_tools/tst_git_local/test.py | 63 |
9 files changed, 102 insertions, 28 deletions
diff --git a/tests/system/objects.map b/tests/system/objects.map index 325f693190..d7c3c9a7c7 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -150,6 +150,9 @@ :Qt Creator_Core::Internal::ProgressBar {type='Core::Internal::ProgressBar' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_DiffEditor::DiffViewEditorWidget {type='DiffEditor::DiffViewEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_DiffEditor::DiffViewEditorWidget2 {occurrence='2' type='DiffEditor::DiffViewEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_DiffEditor::Internal::DiffShowEditorWidget {type='DiffEditor::Internal::DiffShowEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_FilenameQComboBox {type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Find::Internal::SearchResultTreeView {type='Find::Internal::SearchResultTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Git::Internal::GitEditor {type='Git::Internal::GitEditor' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index b814680f8d..9a541ffe2e 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -30,12 +30,6 @@ import __builtin__ import re -processExited = False - -def __handleProcessExited__(*args): - global processExited - processExited = True - def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWelcome=False): cleanUpUserFiles(projectPath) if fromWelcome: @@ -383,7 +377,7 @@ def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None): test.warning("Target '%s' is not set up correctly." % Targets.getStringForTarget(current)) return checkedTargets -def waitForProcessStarted(): +def waitForProcessRunning(running=True): outputButton = waitForObject(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") if not waitFor("outputButton.checked", 10000): ensureChecked(outputButton) @@ -391,7 +385,7 @@ def waitForProcessStarted(): reRunButton = findObject(":Qt Creator.ReRun_QToolButton") waitFor("object.exists(':Qt Creator.Stop_QToolButton')", 20000) stopButton = findObject(":Qt Creator.Stop_QToolButton") - return waitFor("not reRunButton.enabled and stopButton.enabled", 10000) + return waitFor("(reRunButton.enabled != running) and (stopButton.enabled == running)", 10000) # run and close an application # withHookInto - if set to True the function tries to attach to the sub-process instead of simply pressing Stop inside Creator @@ -404,10 +398,6 @@ def waitForProcessStarted(): # by yourself (or use the function parameter) # ATTENTION! Make sure this function won't fail and the sub-process will end when the function returns def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None, sType=None, userDefinedType=None): - global processExited - processExited = False - overrideInstallLazySignalHandler() - installLazySignalHandler("{type='QProcess'}", "finished(int,QProcess::ExitStatus)", "__handleProcessExited__") runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton") clickButton(runButton) if sType != SubprocessType.QT_QUICK_UI: @@ -418,7 +408,7 @@ def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None test.fatal("Build inside run wasn't successful - leaving test") invokeMenuItem("File", "Exit") return False - if not waitForProcessStarted(): + if not waitForProcessRunning(): test.fatal("Couldn't start application - leaving test") invokeMenuItem("File", "Exit") return False @@ -466,7 +456,6 @@ def __closeSubprocessByPushingStop__(sType): test.fatal("Subprocess does not seem to have been started.") def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefType): - global processExited ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}") if port == None: @@ -495,7 +484,7 @@ def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefT switchViewTo(ViewConstants.EDIT) runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton") clickButton(runButton) - if not waitForProcessStarted(): + if not waitForProcessRunning(): test.fatal("Something seems to be really wrong.", "Application output:" % str(output.plainText)) return False @@ -522,11 +511,10 @@ def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefT "Using fallback of pushing STOP inside Creator.") resetApplicationContextToCreator() __closeSubprocessByPushingStop__(sType) - waitFor("processExited==True and 'exited with code' in str(output.plainText)", 10000) - if not processExited: + resetApplicationContextToCreator() + if not waitForProcessRunning(False) and waitFor("'exited with code' in str(output.plainText)", 10000): test.warning("Sub-process seems not to have closed properly.") try: - resetApplicationContextToCreator() __closeSubprocessByPushingStop__(sType) except: pass diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index 528167c045..07f0fe6af8 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -299,6 +299,13 @@ def invokeContextMenuOnProject(projectName, menuItem): return openItemContextMenu(waitForObject(":Qt Creator_Utils::NavigationTreeView"), str(projItem.text).replace("_", "\\_").replace(".", "\\."), 5, 5, 0) - activateItem(waitForObjectItem("{name='Project.Menu.Project' type='QMenu' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}", menuItem)) + # Hack for Squish 5.0.1 handling menus of Qt5.2 on Mac (avoids crash) - remove asap + if platform.system() == 'Darwin': + for obj in object.topLevelObjects(): + if (className(obj) == "QMenu" and obj.visible): + activateItem(waitForObjectItem(obj, menuItem)) + break + else: + activateItem(waitForObjectItem("{name='Project.Menu.Project' type='QMenu' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}", menuItem)) return projItem diff --git a/tests/system/suite_SCOM/tst_SCOM04/test.py b/tests/system/suite_SCOM/tst_SCOM04/test.py index 9f8d6fd957..2d502edad9 100644 --- a/tests/system/suite_SCOM/tst_SCOM04/test.py +++ b/tests/system/suite_SCOM/tst_SCOM04/test.py @@ -34,7 +34,8 @@ source("../../shared/suites_qtta.py") def main(): # expected error texts - for different compilers expectedErrorAlternatives = ["'SyntaxError' was not declared in this scope", - "'SyntaxError' : undeclared identifier"] + "'SyntaxError' : undeclared identifier", + "use of undeclared identifier 'SyntaxError'"] startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return diff --git a/tests/system/suite_debugger/tst_debug_empty_main/test.py b/tests/system/suite_debugger/tst_debug_empty_main/test.py index 7e7e13713a..ab5eceea28 100644 --- a/tests/system/suite_debugger/tst_debug_empty_main/test.py +++ b/tests/system/suite_debugger/tst_debug_empty_main/test.py @@ -88,8 +88,11 @@ def __handleAppOutputWaitForDebuggerFinish__(): ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") appOutput = waitForObject("{type='Core::OutputWindow' visible='1' " "windowTitle='Application Output Window'}") - test.verify(waitFor("str(appOutput.plainText).endswith('Debugging has finished')", 20000), - "Verifying whether debugging has finished.") + if not test.verify(waitFor("str(appOutput.plainText).endswith('Debugging has finished')", 20000), + "Verifying whether debugging has finished."): + test.log("Aborting debugging to let test continue.") + invokeMenuItem("Debug", "Abort Debugging") + waitFor("str(appOutput.plainText).endswith('Debugging has finished')", 5000) def performDebugging(workingDir, projectName, checkedTargets): # for checking if it's a plain C application (as project names are set to match project type) diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index 0f0080ff07..cc30717354 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -216,6 +216,10 @@ def __getExpectedDebuggers__(): result.extend(__getCDB__()) debuggers = ["gdb", "lldb"] result.extend(filter(None, map(which, debuggers))) + if platform.system() == 'Darwin': + xcodeLLDB = "/Applications/Xcode.app/Contents/Developer/usr/bin/lldb" + if os.path.exists(xcodeLLDB): + result.append(xcodeLLDB) return result def __getCDB__(): diff --git a/tests/system/suite_general/tst_rename_file/test.py b/tests/system/suite_general/tst_rename_file/test.py index b113fe8f55..a8cc687d0f 100644 --- a/tests/system/suite_general/tst_rename_file/test.py +++ b/tests/system/suite_general/tst_rename_file/test.py @@ -87,9 +87,6 @@ def renameFile(projectDir, proFile, branch, oldname, newname): type(waitForObject(":Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit"), "<Return>") test.verify(waitFor("os.path.exists(newFilePath)", 1000), "Verify that file with new name exists: %s" % newFilePath) - if not (oldname.lower() == newname.lower() and platform.system() in ('Windows', 'Microsoft')): - test.verify(not os.path.exists(oldFilePath), - "Verify that file with old name does not exist: %s" % oldFilePath) test.compare(readFile(newFilePath), oldFileText, "Comparing content of file before and after renaming") test.verify(waitFor("newname in safeReadFile(proFile)", 2000), @@ -97,6 +94,9 @@ def renameFile(projectDir, proFile, branch, oldname, newname): if not oldname in newname: test.verify(not oldname in readFile(proFile), "Verify that old filename '%s' was removed from pro-file." % oldname) + if not (oldname.lower() == newname.lower() and platform.system() in ('Windows', 'Microsoft')): + test.verify(not oldname in os.listdir(projectDir), + "Verify that file with old name does not exist: %s" % oldFilePath) def safeReadFile(filename): text = "" diff --git a/tests/system/suite_tools/tst_git_clone/test.py b/tests/system/suite_tools/tst_git_clone/test.py index a7f5a5dde8..c9a91b5d87 100644 --- a/tests/system/suite_tools/tst_git_clone/test.py +++ b/tests/system/suite_tools/tst_git_clone/test.py @@ -36,7 +36,7 @@ def verifyCloneLog(targetDir, canceled): # Expect fails because of QTCREATORBUG-10531 cloneLog = waitForObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit") finish = findObject(":Git Repository Clone.Finish_QPushButton") - waitFor("finish.enabled", 30000) + waitFor("canceled or finish.enabled", 30000) test.xverify(("Executing in " + targetDir + ":" in str(cloneLog.plainText)), "Searching for target directory in clone log") test.xverify((" ".join(["clone", cloneUrl, cloneDir]) in str(cloneLog.plainText)), @@ -58,7 +58,9 @@ def verifyCloneLog(targetDir, canceled): test.xverify((result in str(cloneLog.plainText)), "Searching for result (%s) in clone log:\n%s" % (result, str(cloneLog.plainText).replace(unicode("\x1b"), ""))) - test.compare(waitForObject(":Git Repository Clone.Result._QLabel").text, summary) + resultLabel = findObject(":Git Repository Clone.Result._QLabel") + test.verify(waitFor('str(resultLabel.text) == summary', 3000), + "Verifying expected result (%s)" % summary) def verifyFiles(targetDir): for file in [".gitignore", "CMakeLists.txt", "jom.pro", @@ -84,9 +86,12 @@ def main(): test.compare(cloneDirEdit.text, "p-qt-labs-jom") replaceEditorContent(cloneDirEdit, cloneDir) clickButton(waitForObject(":Next_QPushButton")) + cloneLog = findObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit") test.compare(waitForObject(":Git Repository Clone.Result._QLabel").text, "Cloning started...") if button == "Cancel immediately": + # wait for cloning to have started + waitFor('len(str(cloneLog.plainText)) > 20 + len(cloneDir)') clickButton(":Git Repository Clone.Cancel_QPushButton") verifyCloneLog(targetDir, True) clickButton(":Git Repository Clone.Cancel_QPushButton") diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py index dadf54d6f0..9a01fd630a 100644 --- a/tests/system/suite_tools/tst_git_local/test.py +++ b/tests/system/suite_tools/tst_git_local/test.py @@ -51,6 +51,66 @@ def verifyItemsInGit(commitMessages): verifyItemOrder(commitMessages, plainText) return plainText +def verifyClickCommit(): + gitEditor = waitForObject(":Qt Creator_Git::Internal::GitEditor") + fileName = waitForObject(":Qt Creator_FilenameQComboBox") + test.verify(waitFor('str(fileName.currentText).startswith("Git Log")', 1000), + "Verifying Qt Creator still displays git log inside editor.") + content = str(gitEditor.plainText) + noOfCommits = content.count("commit") + commit = None + # find second commit + try: + line = filter(lambda line: line.startswith("commit"), content.splitlines())[-2] + commit = line.split(" ", 1)[1] + except: + test.fail("Could not find the second commit - leaving test") + return + placeCursorToLine(gitEditor, line) + for i in range(5): + type(gitEditor, "<Left>") + # get the current cursor rectangle which should be positioned on the commit ID + rect = gitEditor.cursorRect() + # click on the commit ID + mouseClick(gitEditor, rect.x, rect.y + rect.height / 2, 0, Qt.LeftButton) + expected = 'Git Show "%s"' % commit + test.verify(waitFor('str(fileName.currentText) == expected', 5000), + "Verifying editor switches to Git Show.") + diffShow = waitForObject(":Qt Creator_DiffEditor::Internal::DiffShowEditorWidget") + waitFor('len(str(diffShow.plainText)) != 0', 5000) + show = str(diffShow.plainText) + expected = [{"commit %s" % commit:False}, + {"Author: (\w|\s)+ <(\w|[-.])+@(\w|[-.])+>": True}, + {"Date:\s+\w{3} \w{3} \d{1,2} \d{2}:\d{2}:\d{2} \d{4}.*":True}, + {"Branches: master":False}] + for line, exp in zip(show.splitlines(), expected): + expLine = exp.keys()[0] + isRegex = exp.values()[0] + if isRegex: + test.verify(re.match(expLine, line), "Verifying commit header line '%s'" % line) + else: + test.compare(line, expLine, "Verifying commit header line.") + changed = waitForObject(":Qt Creator_DiffEditor::DiffViewEditorWidget") + original = waitForObject(":Qt Creator_DiffEditor::DiffViewEditorWidget2") + waitFor('str(changed.plainText) != "Waiting for data..." ' + 'and str(original.plainText) != "Waiting for data..."', 5000) + # content of diff editors is merge of modified files + diffOriginal = str(original.plainText) + diffChanged = str(changed.plainText) + # diffChanged must completely contain the pointless_header.h + pointlessHeader = readFile(os.path.join(srcPath, projectName, "pointless_header.h")) + test.verify(pointlessHeader in diffChanged, + "Verifying whether diff editor contains pointless_header.h file.") + test.verify(pointlessHeader not in diffOriginal, + "Verifying whether original does not contain pointless_header.h file.") + test.verify("HEADERS += mainwindow.h \\\n pointless_header.h\n" in diffChanged, + "Verifying whether diff editor has pointless_header.h listed in pro file.") + test.verify("HEADERS += mainwindow.h\n\n" in diffOriginal + and "pointless_header.h" not in diffOriginal, + "Verifying whether original has no additional header in pro file.") + test.verify(original.readOnly and changed.readOnly and diffShow.readOnly, + "Verifying all diff editor widgets are readonly.") + def main(): startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): @@ -97,6 +157,9 @@ def main(): invokeMenuItem("Tools", "Git", "Local Repository", "Log") verifyItemsInGit(commitMessages) + # verifyClickCommit() must be called after the local git has been created and the files + # have been pushed to the repository + verifyClickCommit() invokeMenuItem("File", "Close All Projects and Editors") invokeMenuItem("File", "Exit") |