forked from qt-creator/qt-creator
SquishTests: Adapt to ui changes
Change-Id: I275d8f6cbb3cb30b716df68120921cbf9192fcfb Reviewed-by: Jukka Nokso <jukka.nokso@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1254,7 +1254,9 @@ public:
|
|||||||
ProjectWindowTabWidget(QWidget *parent = nullptr)
|
ProjectWindowTabWidget(QWidget *parent = nullptr)
|
||||||
: QTabWidget(parent)
|
: QTabWidget(parent)
|
||||||
{
|
{
|
||||||
setTabBar(new QtcTabBar); // Must be the first called setter!
|
auto tabBar = new QtcTabBar;
|
||||||
|
setTabBar(tabBar); // Must be the first called setter!
|
||||||
|
tabBar->setObjectName("ProjectConfigurationTabBar"); // used by Squish
|
||||||
setDocumentMode(true);
|
setDocumentMode(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1409,6 +1411,7 @@ public:
|
|||||||
m_scrollArea->setWidget(scrolledWidget);
|
m_scrollArea->setWidget(scrolledWidget);
|
||||||
|
|
||||||
m_projectSelection = new QComboBox;
|
m_projectSelection = new QComboBox;
|
||||||
|
m_projectSelection->setObjectName("ProjectSelection"); // used by Squish
|
||||||
m_projectSelection->setModel(&m_projectsModel);
|
m_projectSelection->setModel(&m_projectsModel);
|
||||||
connect(m_projectSelection, &QComboBox::activated,
|
connect(m_projectSelection, &QComboBox::activated,
|
||||||
this, &ProjectWindowPrivate::projectSelected, Qt::QueuedConnection);
|
this, &ProjectWindowPrivate::projectSelected, Qt::QueuedConnection);
|
||||||
|
@@ -15,18 +15,33 @@ def __kitIsActivated__(kit):
|
|||||||
return not ("<h3>Click to activate</h3>" in str(kit.toolTip)
|
return not ("<h3>Click to activate</h3>" in str(kit.toolTip)
|
||||||
or "<h3>Kit is unsuited for project</h3>" in str(kit.toolTip))
|
or "<h3>Kit is unsuited for project</h3>" in str(kit.toolTip))
|
||||||
|
|
||||||
|
|
||||||
|
# helper function - assumes to be already in Projects mode
|
||||||
|
def kitIndicesFromProjectsMode():
|
||||||
|
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
|
||||||
|
projectCombo = waitForObject(":ProjectSelectionComboBox")
|
||||||
|
currentProject = str(projectCombo.currentText)
|
||||||
|
allIndices = dumpIndices(treeView.model())
|
||||||
|
projectIndex = None
|
||||||
|
for idx in allIndices:
|
||||||
|
if str(idx.data(0)) == currentProject:
|
||||||
|
projectIndex = idx
|
||||||
|
break
|
||||||
|
test.verify(projectIndex is not None, "Found the project index.")
|
||||||
|
secondLevelIndices = dumpIndices(treeView.model(), projectIndex)
|
||||||
|
test.compare(3, len(secondLevelIndices), "Verify expected count of secondary level.")
|
||||||
|
kitIndices = dumpIndices(treeView.model(), secondLevelIndices[0])
|
||||||
|
return kitIndices
|
||||||
|
|
||||||
|
|
||||||
# returns a list of the IDs (see class Targets) of all kits
|
# returns a list of the IDs (see class Targets) of all kits
|
||||||
# which are currently configured for the active project
|
# which are currently configured for the active project
|
||||||
# Creator must be in projects mode when calling
|
# Creator must be in projects mode when calling
|
||||||
def iterateConfiguredKits():
|
def iterateConfiguredKits():
|
||||||
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
|
kitIndices = kitIndicesFromProjectsMode()
|
||||||
bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView")
|
|
||||||
kitIndices = dumpIndices(treeView.model(), waitForObject(bAndRIndex))
|
|
||||||
configuredKitNames = map(lambda t: str(t.data(0)),
|
configuredKitNames = map(lambda t: str(t.data(0)),
|
||||||
filter(__kitIsActivated__, kitIndices))
|
filter(__kitIsActivated__, kitIndices))
|
||||||
# Remove hide/show entries which are in tree but not kits
|
|
||||||
configuredKitNames = filter(lambda n: n != "Hide Inactive Kits" and n != "Show All Kits",
|
|
||||||
configuredKitNames)
|
|
||||||
return map(Targets.getIdForTargetName, configuredKitNames)
|
return map(Targets.getIdForTargetName, configuredKitNames)
|
||||||
|
|
||||||
|
|
||||||
@@ -40,15 +55,14 @@ def iterateConfiguredKits():
|
|||||||
# ProjectSettings.BUILD or ProjectSettings.RUN)
|
# ProjectSettings.BUILD or ProjectSettings.RUN)
|
||||||
def switchToBuildOrRunSettingsFor(wantedKit, projectSettings):
|
def switchToBuildOrRunSettingsFor(wantedKit, projectSettings):
|
||||||
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
|
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
|
||||||
bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView")
|
|
||||||
wantedKitName = Targets.getStringForTarget(wantedKit)
|
wantedKitName = Targets.getStringForTarget(wantedKit)
|
||||||
wantedKitIndexString = getQModelIndexStr("text='%s'" % wantedKitName, bAndRIndex)
|
wantedKitIndexString = getQModelIndexStr("text='%s'" % wantedKitName, ":Projects.ProjectNavigationTreeView")
|
||||||
if not test.verify(__kitIsActivated__(findObject(wantedKitIndexString)),
|
if not test.verify(__kitIsActivated__(findObject(wantedKitIndexString)),
|
||||||
"Verifying target '%s' is enabled." % wantedKitName):
|
"Verifying target '%s' is enabled." % wantedKitName):
|
||||||
raise Exception("Kit '%s' is not activated in the project." % wantedKitName)
|
raise Exception("Kit '%s' is not activated in the project." % wantedKitName)
|
||||||
index = waitForObject(wantedKitIndexString)
|
index = waitForObject(wantedKitIndexString)
|
||||||
projectAlreadySelected = index.font.bold
|
kitAlreadySelected = index.font.bold
|
||||||
if projectAlreadySelected:
|
if kitAlreadySelected:
|
||||||
test.log("Kit '%s' is already selected." % wantedKitName)
|
test.log("Kit '%s' is already selected." % wantedKitName)
|
||||||
else:
|
else:
|
||||||
test.log("Selecting kit '%s'..." % wantedKitName)
|
test.log("Selecting kit '%s'..." % wantedKitName)
|
||||||
@@ -56,14 +70,14 @@ def switchToBuildOrRunSettingsFor(wantedKit, projectSettings):
|
|||||||
mouseClick(index)
|
mouseClick(index)
|
||||||
|
|
||||||
if projectSettings == ProjectSettings.BUILD:
|
if projectSettings == ProjectSettings.BUILD:
|
||||||
settingsIndex = getQModelIndexStr("text='Build'", wantedKitIndexString)
|
settingsText = "Build Settings"
|
||||||
elif projectSettings == ProjectSettings.RUN:
|
elif projectSettings == ProjectSettings.RUN:
|
||||||
settingsIndex = getQModelIndexStr("text='Run'", wantedKitIndexString)
|
settingsText = "Run Settings"
|
||||||
else:
|
else:
|
||||||
raise Exception("Unexpected projectSettings parameter (%s), needs to be BUILD or RUN."
|
raise Exception("Unexpected projectSettings parameter (%s), needs to be BUILD or RUN."
|
||||||
% str(projectSettings))
|
% str(projectSettings))
|
||||||
mouseClick(waitForObject(settingsIndex))
|
clickOnTab(":ProjectConfigurationTabBar", settingsText)
|
||||||
return not projectAlreadySelected
|
return not kitAlreadySelected
|
||||||
|
|
||||||
# this function switches "Run in terminal" on or off in a project's run settings
|
# this function switches "Run in terminal" on or off in a project's run settings
|
||||||
# param wantedKit specifies the ID of the kit to edit (see class Targets)
|
# param wantedKit specifies the ID of the kit to edit (see class Targets)
|
||||||
|
@@ -4,13 +4,11 @@
|
|||||||
source("../../shared/qtcreator.py")
|
source("../../shared/qtcreator.py")
|
||||||
|
|
||||||
def verifyProjectsMode(expectedKits):
|
def verifyProjectsMode(expectedKits):
|
||||||
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
|
kitIndices = kitIndicesFromProjectsMode()
|
||||||
bAndRIndex = getQModelIndexStr("text='Build & Run'",
|
foundKits = list(map(lambda t: str(t.data(0)), kitIndices))
|
||||||
":Projects.ProjectNavigationTreeView")
|
|
||||||
foundKits = dumpItems(treeView.model(), waitForObject(bAndRIndex))
|
# ignore Python kits
|
||||||
# ignore Python kits and non-kit item
|
relevantKits = list(filter(lambda x: 'Python' not in x, foundKits))
|
||||||
excludes = ('Python', 'Hide Inactive Kits', 'Show All Kits')
|
|
||||||
relevantKits = list(filter(lambda x: all(ex not in x for ex in excludes), foundKits))
|
|
||||||
test.compare(len(relevantKits), len(expectedKits), "Verify number of listed kits.")
|
test.compare(len(relevantKits), len(expectedKits), "Verify number of listed kits.")
|
||||||
test.compare(set(relevantKits), set(expectedKits), "Verify if expected kits are listed.")
|
test.compare(set(relevantKits), set(expectedKits), "Verify if expected kits are listed.")
|
||||||
hasKits = len(expectedKits) > 0
|
hasKits = len(expectedKits) > 0
|
||||||
|
Reference in New Issue
Block a user