Commit 7114ee91 authored by Robert Loehning's avatar Robert Loehning

Squish: Run tst_CSUP01 on clang code model, too

Change-Id: Ic2424cc9d962feff06baadc23a5fdf121bf2a11d
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent a2342fa4
...@@ -64,12 +64,15 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True): ...@@ -64,12 +64,15 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True):
return False return False
# change autocomplete options to manual # change autocomplete options to manual
def changeAutocompleteToManual(): def changeAutocompleteToManual(toManual=True):
invokeMenuItem("Tools", "Options...") invokeMenuItem("Tools", "Options...")
mouseClick(waitForObjectItem(":Options_QListView", "Text Editor"), 5, 5, 0, Qt.LeftButton) mouseClick(waitForObjectItem(":Options_QListView", "Text Editor"), 5, 5, 0, Qt.LeftButton)
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Completion") clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Completion")
ensureChecked(waitForObject(":Behavior.Autocomplete common prefix_QCheckBox"), False) ensureChecked(waitForObject(":Behavior.Autocomplete common prefix_QCheckBox"), not toManual)
selectFromCombo(":Behavior.completionTrigger_QComboBox", "Manually") activateCompletion = "Always"
if toManual:
activateCompletion = "Manually"
selectFromCombo(":Behavior.completionTrigger_QComboBox", activateCompletion)
verifyEnabled(":Options.OK_QPushButton") verifyEnabled(":Options.OK_QPushButton")
clickButton(waitForObject(":Options.OK_QPushButton")) clickButton(waitForObject(":Options.OK_QPushButton"))
......
...@@ -48,57 +48,66 @@ def triggerCompletion(editorWidget): ...@@ -48,57 +48,66 @@ def triggerCompletion(editorWidget):
# entry of test # entry of test
def main(): def main():
startApplication("qtcreator" + SettingsPath) clangLoaded = startCreatorTryingClang()
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# create qt quick application # create qt quick application
# Step 1: Open test .pro project. # Step 1: Open test .pro project.
createNewQtQuickApplication(tempDir(), "SampleApp") createNewQtQuickApplication(tempDir(), "SampleApp")
for useClang in set([False, clangLoaded]):
selectClangCodeModel(clangLoaded, useClang)
changeAutocompleteToManual(False)
# Step 2: Open .cpp file in Edit mode. # Step 2: Open .cpp file in Edit mode.
if not openDocument("SampleApp.Sources.main\\.cpp"): if not openDocument("SampleApp.Sources.main\\.cpp"):
test.fatal("Could not open main.cpp") test.fatal("Could not open main.cpp")
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
"Step 2: Verifying if: .cpp file is opened in Edit mode.") "Step 2: Verifying if: .cpp file is opened in Edit mode.")
# Step 3: Insert text "re" to new line in Editor mode and press Ctrl+Space. # Step 3: Insert text "re" to new line in Editor mode and press Ctrl+Space.
editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
if not placeCursorToLine(editorWidget, "QGuiApplication app(argc, argv);"): if not placeCursorToLine(editorWidget, "QGuiApplication app(argc, argv);"):
earlyExit("Did not find first line in function block.") earlyExit("Did not find first line in function block.")
return return
type(editorWidget, "<Return>") type(editorWidget, "<Return>")
type(editorWidget, "re") type(editorWidget, "re")
triggerCompletion(editorWidget) triggerCompletion(editorWidget)
waitForObjectItem(":popupFrame_Proposal_QListView", "register") waitForObjectItem(":popupFrame_Proposal_QListView", "realloc")
doubleClickItem(":popupFrame_Proposal_QListView", "register", 5, 5, 0, Qt.LeftButton) doubleClickItem(":popupFrame_Proposal_QListView", "realloc", 5, 5, 0, Qt.LeftButton)
test.compare(str(lineUnderCursor(editorWidget)).strip(), "register", test.compare(str(lineUnderCursor(editorWidget)).strip(), "realloc()",
"Step 3: Verifying if: The list of suggestions is opened. It is " "Step 3: Verifying if: The list of suggestions is opened. It is "
"possible to select one of the suggestions.") "possible to select one of the suggestions.")
# Step 4: Insert text "voi" to new line and press Tab. # Step 4: Insert text "voi" to new line and press Tab.
resetLine(editorWidget) resetLine(editorWidget)
type(editorWidget, "voi") type(editorWidget, "voi")
waitForObjectItem(":popupFrame_Proposal_QListView", "void") waitForObjectItem(":popupFrame_Proposal_QListView", "void")
type(waitForObject(":popupFrame_Proposal_QListView"), "<Tab>") type(waitForObject(":popupFrame_Proposal_QListView"), "<Tab>")
test.compare(str(lineUnderCursor(editorWidget)).strip(), "void", test.compare(str(lineUnderCursor(editorWidget)).strip(), "void",
"Step 4: Verifying if: Word 'void' is completed because only one option is available.") "Step 4: Verifying if: Word 'void' is completed because only one option is available.")
# Step 5: From "Tools -> Options -> Text Editor -> Completion" select Activate completion Manually, # Step 5: From "Tools -> Options -> Text Editor -> Completion" select Activate completion Manually,
# uncheck Autocomplete common prefix and press Apply and then Ok . Return to Edit mode. # uncheck Autocomplete common prefix and press Apply and then Ok . Return to Edit mode.
test.log("Step 5: Change Code Completion settings") test.log("Step 5: Change Code Completion settings")
changeAutocompleteToManual() changeAutocompleteToManual()
# Step 6: Insert text "ret" and press Ctrl+Space. # Step 6: Insert text "ret" and press Ctrl+Space.
editorWidget = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") editorWidget = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
resetLine(editorWidget) resetLine(editorWidget)
type(editorWidget, "ret") type(editorWidget, "retu")
triggerCompletion(editorWidget) triggerCompletion(editorWidget)
try: try:
waitForObjectItem(":popupFrame_Proposal_QListView", "return") proposal = "return"
except: if useClang:
test.fail("Could not find proposal popup.") # clang adds a whitespace because the function needs to return a value
type(editorWidget, "<Right>") proposal += " "
type(editorWidget, "<Backspace>") waitForObjectItem(":popupFrame_Proposal_QListView", proposal)
test.compare(str(lineUnderCursor(editorWidget)).strip(), "ret", except:
"Step 6: Verifying if: Suggestion is displayed but text is not " test.fail("Could not find proposal popup.")
"completed automatically even there is only one suggestion.") type(editorWidget, "<Right>")
type(editorWidget, "<Backspace>")
test.compare(str(lineUnderCursor(editorWidget)).strip(), "retu",
"Step 6: Verifying if: Suggestion is displayed but text is not "
"completed automatically even there is only one suggestion.")
invokeMenuItem('File', 'Revert "main.cpp" to Saved')
clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
# exit qt creator # exit qt creator
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment