forked from qt-creator/qt-creator
Squish: Update selection of code model
Change-Id: Iee76086dfd886dd8d61db3cfe4600a5eedd36cb7 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -212,6 +212,7 @@
|
||||
: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'}
|
||||
: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'}
|
||||
: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'}
|
||||
|
@@ -51,30 +51,14 @@ def __openCodeModelOptions__():
|
||||
clickItem(":Options_QListView", "C++", 14, 15, 0, Qt.LeftButton)
|
||||
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__()
|
||||
cppChooser = findObject("{type='QComboBox' name='cppChooser' visible='1'}")
|
||||
models = [str(cppChooser.currentText)] # Make sure default is first in list
|
||||
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
|
||||
if clangLoaded:
|
||||
ensureChecked(":clangSettingsGroupBox_QGroupBox", enable)
|
||||
test.verify(verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}"),
|
||||
"Verifying whether 'Ignore pre-compiled headers' is checked by default.")
|
||||
clickButton(waitForObject(":Options.OK_QPushButton"))
|
||||
|
@@ -70,7 +70,7 @@ def ensureChecked(objectName, shouldBeChecked = True, timeout=20000):
|
||||
except:
|
||||
# widgets not derived from QCheckbox don't have checkState()
|
||||
if not waitFor('widget.checked == shouldBeChecked', 1000):
|
||||
clickButton(widget)
|
||||
mouseClick(widget, 10, 6, 0, Qt.LeftButton)
|
||||
test.verify(waitFor("widget.checked == shouldBeChecked", 1000))
|
||||
test.log("New state for QCheckBox: %s" % state,
|
||||
str(objectName))
|
||||
|
@@ -38,11 +38,8 @@ def main():
|
||||
# create qt quick application
|
||||
# Step 1: Open test .pro project.
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
models = iterateAvailableCodeModels()
|
||||
for current in models:
|
||||
if current != models[0]:
|
||||
selectCodeModel(current)
|
||||
test.log("Testing code model: %s" % current)
|
||||
for useClang in set([False, clangLoaded]):
|
||||
selectClangCodeModel(clangLoaded, useClang)
|
||||
# Step 2: Open .cpp file in Edit mode.
|
||||
if not openDocument("SampleApp.Sources.main\\.cpp"):
|
||||
test.fatal("Could not open main.cpp")
|
||||
|
@@ -66,7 +66,7 @@ def constructExpectedCode(original, codeLines, funcSuffix):
|
||||
return "\n".join(tmp) + "\n"
|
||||
|
||||
def main():
|
||||
startCreatorTryingClang()
|
||||
clangLoaded = startCreatorTryingClang()
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
projectName = createNewNonQtProject()
|
||||
@@ -84,11 +84,8 @@ def main():
|
||||
"while with braces" : ["", "int dummy = 0;", "while (dummy < 10) {", "++dummy;"],
|
||||
"do while" : ["", "int dummy = 0;", "do", "++dummy;", "while (dummy < 10);"]
|
||||
}
|
||||
models = iterateAvailableCodeModels()
|
||||
for current in models:
|
||||
if current != models[0]:
|
||||
selectCodeModel(current)
|
||||
test.log("Testing code model: %s" % current)
|
||||
for useClang in set([False, clangLoaded]):
|
||||
selectClangCodeModel(clangLoaded, useClang)
|
||||
openDocument("%s.Sources.main\\.cpp" % projectName)
|
||||
editor = getEditorForFileSuffix("main.cpp")
|
||||
if not editor:
|
||||
|
@@ -40,18 +40,15 @@ def main():
|
||||
# copy example project to temp directory
|
||||
templateDir = prepareTemplate(sourceExample)
|
||||
examplePath = os.path.join(templateDir, proFile)
|
||||
startCreatorTryingClang()
|
||||
clangLoaded = startCreatorTryingClang()
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
# open example project
|
||||
openQmakeProject(examplePath)
|
||||
# wait for parsing to complete
|
||||
progressBarWait(30000)
|
||||
models = iterateAvailableCodeModels()
|
||||
for current in models:
|
||||
if current != models[0]:
|
||||
selectCodeModel(current)
|
||||
test.log("Testing code model: %s" % current)
|
||||
for useClang in set([False, clangLoaded]):
|
||||
selectClangCodeModel(clangLoaded, useClang)
|
||||
# open .cpp file in editor
|
||||
if not openDocument("propertyanimation.Sources.main\\.cpp"):
|
||||
test.fatal("Could not open main.cpp")
|
||||
|
@@ -40,18 +40,15 @@ def main():
|
||||
# copy example project to temp directory
|
||||
templateDir = prepareTemplate(sourceExample)
|
||||
examplePath = os.path.join(templateDir, proFile)
|
||||
startCreatorTryingClang()
|
||||
clangLoaded = startCreatorTryingClang()
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
# open example project
|
||||
openQmakeProject(examplePath)
|
||||
# wait for parsing to complete
|
||||
progressBarWait(30000)
|
||||
models = iterateAvailableCodeModels()
|
||||
for current in models:
|
||||
if current != models[0]:
|
||||
selectCodeModel(current)
|
||||
test.log("Testing code model: %s" % current)
|
||||
for useClang in set([False, clangLoaded]):
|
||||
selectClangCodeModel(clangLoaded, useClang)
|
||||
# open .cpp file in editor
|
||||
if not openDocument("propertyanimation.Sources.main\\.cpp"):
|
||||
test.fatal("Could not open main.cpp")
|
||||
|
@@ -165,23 +165,21 @@ def main():
|
||||
templateDir = prepareTemplate(examplePath)
|
||||
examplePath = os.path.join(templateDir, "cplusplus-tools.pro")
|
||||
openQmakeProject(examplePath, Targets.DESKTOP_531_DEFAULT)
|
||||
models = iterateAvailableCodeModels()
|
||||
test.compare(len(models), 1 + clangLoaded, "Verifying number of available code models")
|
||||
test.compare("Qt Creator Built-in", models[0],
|
||||
"Verifying whether default is Qt Creator's builtin code model")
|
||||
test.compare("Clang" in models, clangLoaded,
|
||||
"Verifying whether clang code model can be chosen.")
|
||||
for current in models:
|
||||
if current != models[0]:
|
||||
selectCodeModel(current)
|
||||
test.log("Testing code model: %s" % current)
|
||||
__openCodeModelOptions__()
|
||||
clangSettingsGroupBox = findObject(":clangSettingsGroupBox_QGroupBox")
|
||||
test.compare(clangSettingsGroupBox.enabled, clangLoaded, "Verifying number of available code models")
|
||||
test.verify(not clangSettingsGroupBox.checked,
|
||||
"Verifying whether default is Qt Creator's builtin code model")
|
||||
clickButton(waitForObject(":Options.Cancel_QPushButton"))
|
||||
for useClang in set([False, clangLoaded]):
|
||||
selectClangCodeModel(clangLoaded, useClang)
|
||||
if not openDocument("cplusplus-tools.Sources.main\\.cpp"):
|
||||
earlyExit("Failed to open main.cpp.")
|
||||
return
|
||||
editor = getEditorForFileSuffix("main.cpp")
|
||||
if editor:
|
||||
checkIncludeCompletion(editor)
|
||||
checkSymbolCompletion(editor, current == "Clang")
|
||||
checkSymbolCompletion(editor, useClang)
|
||||
invokeMenuItem('File', 'Revert "main.cpp" to Saved')
|
||||
clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
|
||||
snooze(1) # 'Close "main.cpp"' might still be disabled
|
||||
|
@@ -31,15 +31,12 @@
|
||||
source("../../shared/qtcreator.py")
|
||||
|
||||
def main():
|
||||
startCreatorTryingClang()
|
||||
clangLoaded = startCreatorTryingClang()
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
createProject_Qt_Console(tempDir(), "SquishProject")
|
||||
models = iterateAvailableCodeModels()
|
||||
for current in models:
|
||||
if current != models[0]:
|
||||
selectCodeModel(current)
|
||||
test.log("Testing code model: %s" % current)
|
||||
for useClang in set([False, clangLoaded]):
|
||||
selectClangCodeModel(clangLoaded, useClang)
|
||||
selectFromLocator("main.cpp")
|
||||
cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
||||
|
||||
@@ -56,7 +53,7 @@ def main():
|
||||
waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500)
|
||||
found = str(lineUnderCursor(cppwindow)).strip()
|
||||
exp = testData.field(record, "expected")
|
||||
if current == "Clang" and exp[-2:] == "->":
|
||||
if useClang and exp[-2:] == "->":
|
||||
test.xcompare(found, exp) # QTCREATORBUG-11581
|
||||
else:
|
||||
test.compare(found, exp)
|
||||
|
Reference in New Issue
Block a user