diff options
author | Robert Loehning <robert.loehning@digia.com> | 2014-09-24 16:31:18 +0200 |
---|---|---|
committer | Robert Loehning <robert.loehning@digia.com> | 2014-09-25 16:01:54 +0200 |
commit | 4957137ef67ae0352b9a2e1b27f0f8d3089f2c07 (patch) | |
tree | a63d04f10b48a7c22eb0bb7adf4c0aaee7a34c5f | |
parent | 4d8002a973715be85a668087cfd768b17cd2bbe3 (diff) |
Squish: Run tst_CSUP03 with Clang code model, too
Change-Id: I5b240b2fbd7999b2228871ddf8faa72509c49465
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
-rw-r--r-- | tests/system/suite_CSUP/tst_CSUP03/test.py | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/tests/system/suite_CSUP/tst_CSUP03/test.py b/tests/system/suite_CSUP/tst_CSUP03/test.py index f05647b3c3..136a55b59b 100644 --- a/tests/system/suite_CSUP/tst_CSUP03/test.py +++ b/tests/system/suite_CSUP/tst_CSUP03/test.py @@ -64,7 +64,7 @@ def constructExpectedCode(original, codeLines, funcSuffix): return "\n".join(tmp) + "\n" def main(): - startApplication("qtcreator" + SettingsPath) + startCreatorTryingClang() if not startedWithoutPluginError(): return projectName = createNewNonQtProject() @@ -82,38 +82,45 @@ def main(): "while with braces" : ["", "int dummy = 0;", "while (dummy < 10) {", "++dummy;"], "do while" : ["", "int dummy = 0;", "do", "++dummy;", "while (dummy < 10);"] } - editor = getEditorForFileSuffix("main.cpp") - if not editor: - test.fatal("Failed to get an editor - leaving test.") - invokeMenuItem("File", "Exit") - return + models = iterateAvailableCodeModels() + for current in models: + if current != models[0]: + selectCodeModel(current) + test.log("Testing code model: %s" % current) + openDocument("untitled.Sources.main\\.cpp") + 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]): + 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='Enter function name' type='QLabel' unnamed='1' " + "visible='1' window=%s} type='QLineEdit' 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='Enter function name' type='QLabel' unnamed='1' " - "visible='1' window=%s} type='QLineEdit' 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() + invokeMenuItem('File', 'Close All') invokeMenuItem('File', 'Exit') |