AutoTest: Unify TestTreeItem::modify*() functions

Change-Id: Ia234fb6a8a8466c039060f6f00b1a5e3dea2af9e
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2017-05-10 13:42:44 +02:00
parent 3bd32292b7
commit a9d511ff7d
6 changed files with 23 additions and 27 deletions

View File

@@ -115,39 +115,37 @@ Qt::ItemFlags TestTreeItem::flags(int /*column*/) const
}
}
bool TestTreeItem::modifyTestCaseContent(const QString &name, unsigned line, unsigned column)
bool TestTreeItem::modifyTestCaseContent(const TestParseResult *result)
{
bool hasBeenModified = modifyName(name);
hasBeenModified |= modifyLineAndColumn(line, column);
bool hasBeenModified = modifyName(result->name);
hasBeenModified |= modifyLineAndColumn(result);
return hasBeenModified;
}
bool TestTreeItem::modifyTestFunctionContent(const TestParseResult *result)
{
bool hasBeenModified = modifyFilePath(result->fileName);
hasBeenModified |= modifyLineAndColumn(result->line, result->column);
hasBeenModified |= modifyLineAndColumn(result);
return hasBeenModified;
}
// TODO pass TestParseResult * to all modifyXYZ() OR remove completely if possible
bool TestTreeItem::modifyDataTagContent(const QString &name, const QString &fileName,
unsigned line, unsigned column)
bool TestTreeItem::modifyDataTagContent(const TestParseResult *result)
{
bool hasBeenModified = modifyFilePath(fileName);
hasBeenModified |= modifyName(name);
hasBeenModified |= modifyLineAndColumn(line, column);
bool hasBeenModified = modifyTestFunctionContent(result);
hasBeenModified |= modifyName(result->name);
return hasBeenModified;
}
bool TestTreeItem::modifyLineAndColumn(unsigned line, unsigned column)
bool TestTreeItem::modifyLineAndColumn(const TestParseResult *result)
{
bool hasBeenModified = false;
if (m_line != line) {
m_line = line;
if (m_line != result->line) {
m_line = result->line;
hasBeenModified = true;
}
if (m_column != column) {
m_column = column;
if (m_column != result->column) {
m_column = result->column;
hasBeenModified = true;
}
return hasBeenModified;