diff options
author | Christian Stenger <christian.stenger@digia.com> | 2014-01-15 17:45:38 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@digia.com> | 2014-01-20 13:41:55 +0100 |
commit | 7312733452d01e32c80e82bc84e83a13fe0dbd5c (patch) | |
tree | a004ae4cb2a1793b01f97d6ae5b8819d467b297d | |
parent | d8cc72d7bdafe4048e8f930b885f8f790e91cef6 (diff) | |
download | qt-creator-7312733452d01e32c80e82bc84e83a13fe0dbd5c.tar.gz |
Squish: Extend tst_git_local
Change-Id: I4160e3f8e7f43f9711b3436693aeb3b333208faf
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
-rw-r--r-- | tests/system/objects.map | 3 | ||||
-rw-r--r-- | tests/system/suite_tools/tst_git_local/test.py | 63 |
2 files changed, 66 insertions, 0 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/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") |