qttest: Fix issues reported by Krazy

Change-Id: I7bce3cd862b7f680f1b8f42249ae0df4c12e10d9
Reviewed-on: http://codereview.qt-project.org/4299
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
This commit is contained in:
Shane Bradley
2011-09-07 10:19:21 +10:00
committed by Bill King
parent 942973faf4
commit c1e32ad604
7 changed files with 52 additions and 47 deletions

View File

@@ -176,6 +176,11 @@ public:
int m_startLine;
};
const QPixmap TestViewItem::m_selectpxm(selected_xpm);
const QPixmap TestViewItem::m_unselectpxm(unselected_xpm);
const QPixmap TestViewItem::m_parentAssignpxm(parentAssigned_xpm);
const QPixmap TestViewItem::m_childAssignpxm(childAssigned_xpm);
TestViewItem::TestViewItem(TestViewItem *parent, const QString &name, bool testSuite, int type) :
QTreeWidgetItem(parent, QStringList() << name, type),
m_errored(false)
@@ -356,22 +361,17 @@ TestViewItem *TestSelector::recastItem(QTreeWidgetItem *item)
void TestViewItem::updatePixmap()
{
static QPixmap selectpxm = QPixmap(selected_xpm);
static QPixmap unselectpxm = QPixmap(unselected_xpm);
static QPixmap parentAssignpxm = QPixmap(parentAssigned_xpm);
static QPixmap childAssignpxm = QPixmap(childAssigned_xpm);
if (m_errored)
return;
if (m_assigned)
setIcon(0, QIcon(selectpxm));
setIcon(0, QIcon(m_selectpxm));
else if (m_parentAssigned > 0)
setIcon(0, QIcon(parentAssignpxm));
setIcon(0, QIcon(m_parentAssignpxm));
else if (m_childAssigned > 0)
setIcon(0, QIcon(childAssignpxm));
setIcon(0, QIcon(m_childAssignpxm));
else
setIcon(0, QIcon(unselectpxm));
setIcon(0, QIcon(m_unselectpxm));
}
void TestViewItem::removeAllChildren()
@@ -840,7 +840,7 @@ void TestSelector::updateActions()
void TestSelector::selectGroup()
{
SelectDlg dlg("Select a group",
QPointer<SelectDlg> dlg = new SelectDlg("Select a group",
"Please select the groups that you'd want to test",
QAbstractItemView::MultiSelection,
300, 400, QStringList() << "Groups", QByteArray(), this);
@@ -853,7 +853,7 @@ void TestSelector::selectGroup()
TestFunctionInfo *inf = tc->testFunction(j);
if (inf && (inf->testStartLine() >= 0)) {
if (!inf->testGroups().isEmpty()) {
dlg.addSelectableItems(inf->testGroups()
dlg->addSelectableItems(inf->testGroups()
.split(QLatin1Char(','), QString::SkipEmptyParts));
groupsList.append(tc->testCase() + "::" + inf->functionName()
+ QLatin1Char('@') + inf->testGroups().split(QLatin1Char(','), QString::SkipEmptyParts).join(QString(QLatin1Char('@'))));
@@ -863,8 +863,8 @@ void TestSelector::selectGroup()
}
}
if (dlg.exec()) {
QStringList selectedGroups = dlg.selectedItems();
if (dlg->exec()) {
QStringList selectedGroups = dlg->selectedItems();
unassignAll();
int current = 0;
while (current < groupsList.count()) {
@@ -884,6 +884,7 @@ void TestSelector::selectGroup()
}
setSelectedTests(true, groupsList);
}
delete dlg;
}
QString TestSelector::curTestSuite(bool fullPath)
@@ -1462,19 +1463,18 @@ void TestSelector::testInsertUnitOrSystemTest()
if (cfg)
basePath = cfg->srcPath();
}
NewTestCaseDlg dlg(basePath, this);
if (dlg.exec() == QDialog::Accepted) {
QPointer<NewTestCaseDlg> dlg = new NewTestCaseDlg(basePath, this);
if (dlg->exec() == QDialog::Accepted) {
TestGenerator gen;
QString classFile;
gen.enableComponentInTestName(dlg.componentInName());
gen.setTestCase(dlg.mode(),
dlg.location(),
gen.enableComponentInTestName(dlg->componentInName());
gen.setTestCase(dlg->mode(),
dlg->location(),
QString(), // use automatic "subdir" selection
dlg.testCaseName(),
dlg.testedComponent(),
dlg.testedClassName(),
dlg->testCaseName(),
dlg->testedComponent(),
dlg->testedClassName(),
classFile);
if (gen.generateTest()) {
@@ -1486,4 +1486,5 @@ void TestSelector::testInsertUnitOrSystemTest()
}
}
}
delete dlg;
}