Squish: Update selection of code model

Change-Id: Iee76086dfd886dd8d61db3cfe4600a5eedd36cb7
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
Robert Loehning
2015-12-01 14:05:49 +01:00
parent a992a1064c
commit 66e7b77d88
9 changed files with 33 additions and 65 deletions

View File

@@ -212,6 +212,7 @@
:Working Copy_Utils::BaseValidatingLineEdit {type='Utils::FancyLineEdit' unnamed='1' visible='1' window=':New Text File_ProjectExplorer::JsonWizard'} :Working Copy_Utils::BaseValidatingLineEdit {type='Utils::FancyLineEdit' unnamed='1' visible='1' window=':New Text File_ProjectExplorer::JsonWizard'}
:WritePermissions_Core::Internal::ReadOnlyFilesDialog {name='Core__Internal__ReadOnlyFilesDialog' type='Core::ReadOnlyFilesDialog' visible='1' windowTitle='Files Without Write Permissions'} :WritePermissions_Core::Internal::ReadOnlyFilesDialog {name='Core__Internal__ReadOnlyFilesDialog' type='Core::ReadOnlyFilesDialog' visible='1' windowTitle='Files Without Write Permissions'}
:addToVersionControlComboBox_QComboBox {name='addToVersionControlComboBox' type='QComboBox' visible='1'} :addToVersionControlComboBox_QComboBox {name='addToVersionControlComboBox' type='QComboBox' visible='1'}
:clangSettingsGroupBox_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='clangSettingsGroupBox' type='QGroupBox' visible='1'}
:formFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Form file:_QLabel' name='formFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} :formFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Form file:_QLabel' name='formFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'}
:frame.templateDescription_QTextBrowser {container=':New.frame_QFrame' name='templateDescription' type='QTextBrowser' visible='1'} :frame.templateDescription_QTextBrowser {container=':New.frame_QFrame' name='templateDescription' type='QTextBrowser' visible='1'}
:headerFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Header file:_QLabel' name='headerFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} :headerFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Header file:_QLabel' name='headerFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'}

View File

@@ -51,30 +51,14 @@ def __openCodeModelOptions__():
clickItem(":Options_QListView", "C++", 14, 15, 0, Qt.LeftButton) clickItem(":Options_QListView", "C++", 14, 15, 0, Qt.LeftButton)
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Code Model") clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Code Model")
def iterateAvailableCodeModels(): def selectClangCodeModel(clangLoaded, enable):
codeModelName = "built-in"
if clangLoaded and enable:
codeModelName = "Clang"
test.log("Testing code model: %s" % codeModelName)
__openCodeModelOptions__() __openCodeModelOptions__()
cppChooser = findObject("{type='QComboBox' name='cppChooser' visible='1'}") if clangLoaded:
models = [str(cppChooser.currentText)] # Make sure default is first in list ensureChecked(":clangSettingsGroupBox_QGroupBox", enable)
if cppChooser.count > 1:
furtherModels = dumpItems(cppChooser.model())
furtherModels.remove(models[0])
models.extend(furtherModels)
clickButton(waitForObject(":Options.OK_QPushButton"))
return models
def selectCodeModel(codeModel):
__openCodeModelOptions__()
expectedObjNames = ['cChooser', 'cppChooser', 'objcChooser', 'objcppChooser', 'hChooser']
for exp in expectedObjNames:
test.verify(checkIfObjectExists("{type='QComboBox' name='%s' visible='1'}" % exp),
"Verifying whether combobox '%s' exists." % exp)
combo = findObject("{type='QComboBox' name='%s' visible='1'}" % exp)
try:
selectFromCombo(combo, codeModel)
except:
test.fatal("Could not find code model '%s'. Canceling dialog." % codeModel)
clickButton(waitForObject(":Options.Cancel_QPushButton"))
return
test.verify(verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}"), test.verify(verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}"),
"Verifying whether 'Ignore pre-compiled headers' is checked by default.") "Verifying whether 'Ignore pre-compiled headers' is checked by default.")
clickButton(waitForObject(":Options.OK_QPushButton")) clickButton(waitForObject(":Options.OK_QPushButton"))

View File

@@ -70,7 +70,7 @@ def ensureChecked(objectName, shouldBeChecked = True, timeout=20000):
except: except:
# widgets not derived from QCheckbox don't have checkState() # widgets not derived from QCheckbox don't have checkState()
if not waitFor('widget.checked == shouldBeChecked', 1000): if not waitFor('widget.checked == shouldBeChecked', 1000):
clickButton(widget) mouseClick(widget, 10, 6, 0, Qt.LeftButton)
test.verify(waitFor("widget.checked == shouldBeChecked", 1000)) test.verify(waitFor("widget.checked == shouldBeChecked", 1000))
test.log("New state for QCheckBox: %s" % state, test.log("New state for QCheckBox: %s" % state,
str(objectName)) str(objectName))

View File

@@ -38,11 +38,8 @@ def main():
# 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")
models = iterateAvailableCodeModels() for useClang in set([False, clangLoaded]):
for current in models: selectClangCodeModel(clangLoaded, useClang)
if current != models[0]:
selectCodeModel(current)
test.log("Testing code model: %s" % current)
# 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")

View File

@@ -66,7 +66,7 @@ def constructExpectedCode(original, codeLines, funcSuffix):
return "\n".join(tmp) + "\n" return "\n".join(tmp) + "\n"
def main(): def main():
startCreatorTryingClang() clangLoaded = startCreatorTryingClang()
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
projectName = createNewNonQtProject() projectName = createNewNonQtProject()
@@ -84,11 +84,8 @@ def main():
"while with braces" : ["", "int dummy = 0;", "while (dummy < 10) {", "++dummy;"], "while with braces" : ["", "int dummy = 0;", "while (dummy < 10) {", "++dummy;"],
"do while" : ["", "int dummy = 0;", "do", "++dummy;", "while (dummy < 10);"] "do while" : ["", "int dummy = 0;", "do", "++dummy;", "while (dummy < 10);"]
} }
models = iterateAvailableCodeModels() for useClang in set([False, clangLoaded]):
for current in models: selectClangCodeModel(clangLoaded, useClang)
if current != models[0]:
selectCodeModel(current)
test.log("Testing code model: %s" % current)
openDocument("%s.Sources.main\\.cpp" % projectName) openDocument("%s.Sources.main\\.cpp" % projectName)
editor = getEditorForFileSuffix("main.cpp") editor = getEditorForFileSuffix("main.cpp")
if not editor: if not editor:

View File

@@ -40,18 +40,15 @@ def main():
# copy example project to temp directory # copy example project to temp directory
templateDir = prepareTemplate(sourceExample) templateDir = prepareTemplate(sourceExample)
examplePath = os.path.join(templateDir, proFile) examplePath = os.path.join(templateDir, proFile)
startCreatorTryingClang() clangLoaded = startCreatorTryingClang()
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# open example project # open example project
openQmakeProject(examplePath) openQmakeProject(examplePath)
# wait for parsing to complete # wait for parsing to complete
progressBarWait(30000) progressBarWait(30000)
models = iterateAvailableCodeModels() for useClang in set([False, clangLoaded]):
for current in models: selectClangCodeModel(clangLoaded, useClang)
if current != models[0]:
selectCodeModel(current)
test.log("Testing code model: %s" % current)
# open .cpp file in editor # open .cpp file in editor
if not openDocument("propertyanimation.Sources.main\\.cpp"): if not openDocument("propertyanimation.Sources.main\\.cpp"):
test.fatal("Could not open main.cpp") test.fatal("Could not open main.cpp")

View File

@@ -40,18 +40,15 @@ def main():
# copy example project to temp directory # copy example project to temp directory
templateDir = prepareTemplate(sourceExample) templateDir = prepareTemplate(sourceExample)
examplePath = os.path.join(templateDir, proFile) examplePath = os.path.join(templateDir, proFile)
startCreatorTryingClang() clangLoaded = startCreatorTryingClang()
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# open example project # open example project
openQmakeProject(examplePath) openQmakeProject(examplePath)
# wait for parsing to complete # wait for parsing to complete
progressBarWait(30000) progressBarWait(30000)
models = iterateAvailableCodeModels() for useClang in set([False, clangLoaded]):
for current in models: selectClangCodeModel(clangLoaded, useClang)
if current != models[0]:
selectCodeModel(current)
test.log("Testing code model: %s" % current)
# open .cpp file in editor # open .cpp file in editor
if not openDocument("propertyanimation.Sources.main\\.cpp"): if not openDocument("propertyanimation.Sources.main\\.cpp"):
test.fatal("Could not open main.cpp") test.fatal("Could not open main.cpp")

View File

@@ -165,23 +165,21 @@ def main():
templateDir = prepareTemplate(examplePath) templateDir = prepareTemplate(examplePath)
examplePath = os.path.join(templateDir, "cplusplus-tools.pro") examplePath = os.path.join(templateDir, "cplusplus-tools.pro")
openQmakeProject(examplePath, Targets.DESKTOP_531_DEFAULT) openQmakeProject(examplePath, Targets.DESKTOP_531_DEFAULT)
models = iterateAvailableCodeModels() __openCodeModelOptions__()
test.compare(len(models), 1 + clangLoaded, "Verifying number of available code models") clangSettingsGroupBox = findObject(":clangSettingsGroupBox_QGroupBox")
test.compare("Qt Creator Built-in", models[0], test.compare(clangSettingsGroupBox.enabled, clangLoaded, "Verifying number of available code models")
"Verifying whether default is Qt Creator's builtin code model") test.verify(not clangSettingsGroupBox.checked,
test.compare("Clang" in models, clangLoaded, "Verifying whether default is Qt Creator's builtin code model")
"Verifying whether clang code model can be chosen.") clickButton(waitForObject(":Options.Cancel_QPushButton"))
for current in models: for useClang in set([False, clangLoaded]):
if current != models[0]: selectClangCodeModel(clangLoaded, useClang)
selectCodeModel(current)
test.log("Testing code model: %s" % current)
if not openDocument("cplusplus-tools.Sources.main\\.cpp"): if not openDocument("cplusplus-tools.Sources.main\\.cpp"):
earlyExit("Failed to open main.cpp.") earlyExit("Failed to open main.cpp.")
return return
editor = getEditorForFileSuffix("main.cpp") editor = getEditorForFileSuffix("main.cpp")
if editor: if editor:
checkIncludeCompletion(editor) checkIncludeCompletion(editor)
checkSymbolCompletion(editor, current == "Clang") checkSymbolCompletion(editor, useClang)
invokeMenuItem('File', 'Revert "main.cpp" to Saved') invokeMenuItem('File', 'Revert "main.cpp" to Saved')
clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton")) clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
snooze(1) # 'Close "main.cpp"' might still be disabled snooze(1) # 'Close "main.cpp"' might still be disabled

View File

@@ -31,15 +31,12 @@
source("../../shared/qtcreator.py") source("../../shared/qtcreator.py")
def main(): def main():
startCreatorTryingClang() clangLoaded = startCreatorTryingClang()
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
createProject_Qt_Console(tempDir(), "SquishProject") createProject_Qt_Console(tempDir(), "SquishProject")
models = iterateAvailableCodeModels() for useClang in set([False, clangLoaded]):
for current in models: selectClangCodeModel(clangLoaded, useClang)
if current != models[0]:
selectCodeModel(current)
test.log("Testing code model: %s" % current)
selectFromLocator("main.cpp") selectFromLocator("main.cpp")
cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
@@ -56,7 +53,7 @@ def main():
waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500) waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500)
found = str(lineUnderCursor(cppwindow)).strip() found = str(lineUnderCursor(cppwindow)).strip()
exp = testData.field(record, "expected") exp = testData.field(record, "expected")
if current == "Clang" and exp[-2:] == "->": if useClang and exp[-2:] == "->":
test.xcompare(found, exp) # QTCREATORBUG-11581 test.xcompare(found, exp) # QTCREATORBUG-11581
else: else:
test.compare(found, exp) test.compare(found, exp)