Squish: Fix tst_default_settings

QC now supports C compilers as well, adjust the test to reflect this.

Change-Id: I20f2264b31c1f21384b463beccbc27ab1073083c
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
Christian Stenger
2016-10-17 12:57:43 +02:00
parent 8736565c14
commit 9b09bf62bd
2 changed files with 44 additions and 23 deletions

View File

@@ -38,6 +38,8 @@
:Breakpoints_Debugger::Internal::BreakTreeView {container=':Debugger.Docks.BreakDockWidget.Debugger.Docks.Break_QFrame' type='Utils::BaseTreeView' unnamed='1' visible='1'} :Breakpoints_Debugger::Internal::BreakTreeView {container=':Debugger.Docks.BreakDockWidget.Debugger.Docks.Break_QFrame' type='Utils::BaseTreeView' unnamed='1' visible='1'}
:Build and Run.Save all files before build_QCheckBox {name='saveAllFilesCheckBox' type='QCheckBox' visible='1'} :Build and Run.Save all files before build_QCheckBox {name='saveAllFilesCheckBox' type='QCheckBox' visible='1'}
:BuildAndRun_QTreeView {container=':qt_tabwidget_stackedwidget_QWidget' type='QTreeView' unnamed='1' visible='1'} :BuildAndRun_QTreeView {container=':qt_tabwidget_stackedwidget_QWidget' type='QTreeView' unnamed='1' visible='1'}
:CCompiler:_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':CCompiler:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:CCompiler:_QLabel {container=':qt_tabwidget_stackedwidget_QWidget' text='C:' type='QLabel' unnamed='1' visible='1'}
:Cannot Open Project.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Cannot Open Project_QMessageBox'} :Cannot Open Project.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Cannot Open Project_QMessageBox'}
:Cannot Open Project.Show Details..._QPushButton {text='Show Details...' type='QPushButton' unnamed='1' visible='1' window=':Cannot Open Project_QMessageBox'} :Cannot Open Project.Show Details..._QPushButton {text='Show Details...' type='QPushButton' unnamed='1' visible='1' window=':Cannot Open Project_QMessageBox'}
:Cannot Open Project_QMessageBox {text?='Failed to open project in *' type='QMessageBox' unnamed='1' visible='1'} :Cannot Open Project_QMessageBox {text?='Failed to open project in *' type='QMessageBox' unnamed='1' visible='1'}
@@ -49,9 +51,9 @@
:CodePaster__Internal__PasteSelectDialog.listWidget_QListWidget {name='listWidget' type='QListWidget' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'} :CodePaster__Internal__PasteSelectDialog.listWidget_QListWidget {name='listWidget' type='QListWidget' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'}
:CodePaster__Internal__PasteSelectDialog.protocolBox_QComboBox {name='protocolBox' type='QComboBox' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'} :CodePaster__Internal__PasteSelectDialog.protocolBox_QComboBox {name='protocolBox' type='QComboBox' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'}
:CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog {name='CodePaster__Internal__PasteSelectDialog' type='CodePaster::PasteSelectDialog' visible='1'} :CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog {name='CodePaster__Internal__PasteSelectDialog' type='CodePaster::PasteSelectDialog' visible='1'}
:Compiler:_QComboBox {aboveWidget=':Path.Utils_BaseValidatingLineEdit' container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':Compiler:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:Compiler:_QLabel {container=':qt_tabwidget_stackedwidget_QWidget' text='Compiler:' type='QLabel' unnamed='1' visible='1'}
:Core__Internal__GeneralSettings.User Interface_QGroupBox {container=':qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget' name='interfaceBox' title='User Interface' type='QGroupBox' visible='1'} :Core__Internal__GeneralSettings.User Interface_QGroupBox {container=':qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget' name='interfaceBox' title='User Interface' type='QGroupBox' visible='1'}
:CppCompiler:_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':CppCompiler:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:CppCompiler:_QLabel {container=':qt_tabwidget_stackedwidget_QWidget' text='C++:' type='QLabel' unnamed='1' visible='1'}
:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='groupBox' title='Behavior' type='QGroupBox' visible='1'} :CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='groupBox' title='Behavior' type='QGroupBox' visible='1'}
:DebugModeWidget.Debugger Log_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.OutputDockWidget' type='QDockWidget' visible='1'} :DebugModeWidget.Debugger Log_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.OutputDockWidget' type='QDockWidget' visible='1'}
:DebugModeWidget.Debugger.Docks.BreakDockWidget_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.BreakDockWidget' type='QDockWidget' visible='1'} :DebugModeWidget.Debugger.Docks.BreakDockWidget_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.BreakDockWidget' type='QDockWidget' visible='1'}

View File

@@ -84,27 +84,40 @@ def __checkBuildAndRun__():
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Kits") clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Kits")
__iterateTree__(":BuildAndRun_QTreeView", __kitFunc__, foundQt, foundCompilerNames) __iterateTree__(":BuildAndRun_QTreeView", __kitFunc__, foundQt, foundCompilerNames)
def __processSubItems__(treeObjStr, section, parModelIndexStr, doneItems,
additionalFunc, *additionalParameters):
global currentSelectedTreeItem
model = waitForObject(treeObjStr).model()
items = dumpIndices(model, section)
for it in items:
indexName = str(it.data().toString())
itObj = "%s container=%s}" % (objectMap.realName(it)[:-1], parModelIndexStr)
alreadyDone = doneItems.count(itObj)
doneItems.append(itObj)
if alreadyDone:
itObj = "%s occurrence='%d'}" % (itObj[:-1], alreadyDone + 1)
currentSelectedTreeItem = waitForObject(itObj, 3000)
mouseClick(currentSelectedTreeItem, 5, 5, 0, Qt.LeftButton)
additionalFunc(indexName, *additionalParameters)
currentSelectedTreeItem = None
if model.rowCount(it) > 0:
__processSubItems__(treeObjStr, it, itObj, doneItems,
additionalFunc, *additionalParameters)
def __iterateTree__(treeObjStr, additionalFunc, *additionalParameters): def __iterateTree__(treeObjStr, additionalFunc, *additionalParameters):
global currentSelectedTreeItem global currentSelectedTreeItem
model = waitForObject(treeObjStr).model() model = waitForObject(treeObjStr).model()
# 1st row: Auto-detected, 2nd row: Manual # 1st row: Auto-detected, 2nd row: Manual
for sect in dumpIndices(model): for sect in dumpIndices(model):
sObj = "%s container='%s'}" % (objectMap.realName(sect)[:-1], treeObjStr)
items = dumpIndices(model, sect)
doneItems = [] doneItems = []
for it in items: parentModelIndex = "%s container='%s'}" % (objectMap.realName(sect)[:-1], treeObjStr)
indexName = str(it.data().toString()) __processSubItems__(treeObjStr, sect, parentModelIndex, doneItems,
itObj = "%s container=%s}" % (objectMap.realName(it)[:-1], sObj) additionalFunc, *additionalParameters)
alreadyDone = doneItems.count(itObj)
doneItems.append(itObj)
if alreadyDone:
itObj = "%s occurrence='%d'}" % (itObj[:-1], alreadyDone + 1)
currentSelectedTreeItem = waitForObject(itObj, 3000)
mouseClick(currentSelectedTreeItem, 5, 5, 0, Qt.LeftButton)
additionalFunc(indexName, *additionalParameters)
currentSelectedTreeItem = None
def __compFunc__(it, foundComp, foundCompNames): def __compFunc__(it, foundComp, foundCompNames):
# skip sub section items (will continue on its children)
if str(it) == "C" or str(it) == "C++":
return
try: try:
waitFor("object.exists(':Path.Utils_BaseValidatingLineEdit')", 1000) waitFor("object.exists(':Path.Utils_BaseValidatingLineEdit')", 1000)
pathLineEdit = findObject(":Path.Utils_BaseValidatingLineEdit") pathLineEdit = findObject(":Path.Utils_BaseValidatingLineEdit")
@@ -144,12 +157,17 @@ def __kitFunc__(it, foundQt, foundCompNames):
test.compare(it, "Desktop (default)", "Verifying whether default Desktop kit has been created.") test.compare(it, "Desktop (default)", "Verifying whether default Desktop kit has been created.")
if foundQt: if foundQt:
test.compare(qtVersionStr, foundQt, "Verifying if Qt versions match.") test.compare(qtVersionStr, foundQt, "Verifying if Qt versions match.")
compilerCombo = findObject(":Compiler:_QComboBox") cCompilerCombo = findObject(":CCompiler:_QComboBox")
test.compare(compilerCombo.enabled, compilerCombo.count > 1, test.compare(cCompilerCombo.enabled, cCompilerCombo.count > 1,
"Verifying whether compiler combo is enabled/disabled correctly.") "Verifying whether C compiler combo is enabled/disabled correctly.")
cppCompilerCombo = findObject(":CppCompiler:_QComboBox")
test.compare(cppCompilerCombo.enabled, cppCompilerCombo.count > 1,
"Verifying whether C++ compiler combo is enabled/disabled correctly.")
test.verify(str(compilerCombo.currentText) in foundCompNames, test.verify(str(cCompilerCombo.currentText) in foundCompNames,
"Verifying if one of the found compilers had been set.") "Verifying if one of the found C compilers had been set.")
test.verify(str(cppCompilerCombo.currentText) in foundCompNames,
"Verifying if one of the found C++ compilers had been set.")
if currentSelectedTreeItem: if currentSelectedTreeItem:
foundWarningOrError = warningOrError.search(str(currentSelectedTreeItem.toolTip)) foundWarningOrError = warningOrError.search(str(currentSelectedTreeItem.toolTip))
if foundWarningOrError: if foundWarningOrError:
@@ -158,12 +176,13 @@ def __kitFunc__(it, foundQt, foundCompNames):
test.warning("Detected error and/or warning: %s" % details) test.warning("Detected error and/or warning: %s" % details)
def __getExpectedCompilers__(): def __getExpectedCompilers__():
# TODO: enhance this to distinguish between C and C++ compilers
expected = [] expected = []
if platform.system() in ('Microsoft', 'Windows'): if platform.system() in ('Microsoft', 'Windows'):
expected.extend(__getWinCompilers__()) expected.extend(__getWinCompilers__())
compilers = ["g++"] compilers = ["g++", "gcc"]
if platform.system() in ('Linux', 'Darwin'): if platform.system() in ('Linux', 'Darwin'):
compilers.extend(["g++-4.0", "g++-4.2", "clang++"]) compilers.extend(["g++-4.0", "g++-4.2", "clang++", "clang"])
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
xcodeClang = getOutputFromCmdline(["xcrun", "--find", "clang++"]).strip("\n") xcodeClang = getOutputFromCmdline(["xcrun", "--find", "clang++"]).strip("\n")
if xcodeClang and os.path.exists(xcodeClang) and xcodeClang not in expected: if xcodeClang and os.path.exists(xcodeClang) and xcodeClang not in expected:
@@ -171,7 +190,7 @@ def __getExpectedCompilers__():
for compiler in compilers: for compiler in compilers:
compilerPath = which(compiler) compilerPath = which(compiler)
if compilerPath: if compilerPath:
if compiler.endswith('clang++'): if compiler.endswith('clang++') or compiler.endswith('clang'):
if subprocess.call([compiler, '-dumpmachine']) != 0: if subprocess.call([compiler, '-dumpmachine']) != 0:
test.warning("clang found in PATH, but version is not supported.") test.warning("clang found in PATH, but version is not supported.")
continue continue