summaryrefslogtreecommitdiff
path: root/tests/system/suite_CSUP/tst_CSUP03/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/system/suite_CSUP/tst_CSUP03/test.py')
-rw-r--r--tests/system/suite_CSUP/tst_CSUP03/test.py79
1 files changed, 40 insertions, 39 deletions
diff --git a/tests/system/suite_CSUP/tst_CSUP03/test.py b/tests/system/suite_CSUP/tst_CSUP03/test.py
index ac106eb8d4..bd4478000e 100644
--- a/tests/system/suite_CSUP/tst_CSUP03/test.py
+++ b/tests/system/suite_CSUP/tst_CSUP03/test.py
@@ -76,44 +76,45 @@ def main():
"do while" : ["", "int dummy = 0;", "do", "++dummy;", "while (dummy < 10);"]
}
for useClang in [False, True]:
- if not startCreator(useClang):
- continue
- projectName = createNewNonQtProject()
- checkCodeModelSettings(useClang)
- openDocument("%s.Sources.main\\.cpp" % projectName)
- editor = getEditorForFileSuffix("main.cpp")
- if not editor:
- test.fatal("Failed to get an editor - leaving test.")
- invokeMenuItem("File", "Exit")
- return
-
- originalContent = str(editor.plainText)
- for case, codeLines in code.items():
- funcSuffix = case.title().replace(" ", "")
- test.log("Testing: Extract Function for '%s'" % case)
- if not placeCursorToLine(editor, "{"):
+ with TestSection(getCodeModelString(useClang)):
+ if not startCreator(useClang):
continue
- typeLines(editor, codeLines)
- if not placeCursorToLine(editor, codeLines[2]):
+ projectName = createNewNonQtProject()
+ checkCodeModelSettings(useClang)
+ openDocument("%s.Sources.main\\.cpp" % projectName)
+ editor = getEditorForFileSuffix("main.cpp")
+ if not editor:
+ test.fatal("Failed to get an editor - leaving test.")
+ invokeMenuItem("File", "Exit")
+ return
+
+ originalContent = str(editor.plainText)
+ for case, codeLines in code.items():
+ funcSuffix = case.title().replace(" ", "")
+ test.log("Testing: Extract Function for '%s'" % case)
+ if not placeCursorToLine(editor, "{"):
+ continue
+ typeLines(editor, codeLines)
+ if not placeCursorToLine(editor, codeLines[2]):
+ revertMainCpp()
+ continue
+ type(editor, home)
+ markText(editor, "Right", 2)
+ snooze(1) # avoid timing issue with the parser
+ invokeContextMenuItem(editor, 'Refactor', 'Extract Function')
+ funcEdit = waitForObject("{buddy={text='Function name' type='QLabel' unnamed='1' "
+ "visible='1' window=%s} type='Utils::FancyLineEdit' "
+ "unnamed='1' visible='1'}" % inputDialog)
+ replaceEditorContent(funcEdit, "myFunc%s" % funcSuffix)
+ clickButton(waitForObject("{text='OK' type='QPushButton' unnamed='1' visible='1' window=%s}"
+ % inputDialog))
+ waitFor("'void myFunc%s' in str(editor.plainText)" % funcSuffix, 2500)
+ # verify the change
+ modifiedCode = str(editor.plainText)
+ expectedCode = constructExpectedCode(originalContent, codeLines, funcSuffix)
+ test.compare(modifiedCode, expectedCode, "Verifying whether code matches expected.")
+ # reverting to initial state of main.cpp
revertMainCpp()
- continue
- type(editor, home)
- markText(editor, "Right", 2)
- snooze(1) # avoid timing issue with the parser
- invokeContextMenuItem(editor, 'Refactor', 'Extract Function')
- funcEdit = waitForObject("{buddy={text='Function name' type='QLabel' unnamed='1' "
- "visible='1' window=%s} type='Utils::FancyLineEdit' "
- "unnamed='1' visible='1'}" % inputDialog)
- replaceEditorContent(funcEdit, "myFunc%s" % funcSuffix)
- clickButton(waitForObject("{text='OK' type='QPushButton' unnamed='1' visible='1' window=%s}"
- % inputDialog))
- waitFor("'void myFunc%s' in str(editor.plainText)" % funcSuffix, 2500)
- # verify the change
- modifiedCode = str(editor.plainText)
- expectedCode = constructExpectedCode(originalContent, codeLines, funcSuffix)
- test.compare(modifiedCode, expectedCode, "Verifying whether code matches expected.")
- # reverting to initial state of main.cpp
- revertMainCpp()
- snooze(1) # "Close All" might be disabled
- invokeMenuItem('File', 'Close All')
- invokeMenuItem('File', 'Exit')
+ snooze(1) # "Close All" might be disabled
+ invokeMenuItem('File', 'Close All')
+ invokeMenuItem('File', 'Exit')