diff --git a/src/plugins/autotest/gtest/gtesttreeitem.cpp b/src/plugins/autotest/gtest/gtesttreeitem.cpp index e3a44fc9646..a57d44f358f 100644 --- a/src/plugins/autotest/gtest/gtesttreeitem.cpp +++ b/src/plugins/autotest/gtest/gtesttreeitem.cpp @@ -239,7 +239,7 @@ bool GTestTreeItem::modify(const TestParseResult *result) bool GTestTreeItem::modifyTestSetContent(const GTestParseResult *result) { - bool hasBeenModified = modifyLineAndColumn(result->line, result->column); + bool hasBeenModified = modifyLineAndColumn(result); GTestTreeItem::TestStates states = result->disabled ? GTestTreeItem::Disabled : GTestTreeItem::Enabled; if (m_state != states) { diff --git a/src/plugins/autotest/gtest/gtesttreeitem.h b/src/plugins/autotest/gtest/gtesttreeitem.h index 67973771dd5..f20264e17e3 100644 --- a/src/plugins/autotest/gtest/gtesttreeitem.h +++ b/src/plugins/autotest/gtest/gtesttreeitem.h @@ -62,13 +62,13 @@ public: void setStates(TestStates states) { m_state = states; } void setState(TestState state) { m_state |= state; } TestStates state() const { return m_state; } - bool modifyTestSetContent(const GTestParseResult *result); TestTreeItem *findChildByNameStateAndFile(const QString &name, GTestTreeItem::TestStates state, const QString &proFile) const; QString nameSuffix() const; private: + bool modifyTestSetContent(const GTestParseResult *result); GTestTreeItem::TestStates m_state; }; diff --git a/src/plugins/autotest/qtest/qttesttreeitem.cpp b/src/plugins/autotest/qtest/qttesttreeitem.cpp index 53f60b22fee..def491c196a 100644 --- a/src/plugins/autotest/qtest/qttesttreeitem.cpp +++ b/src/plugins/autotest/qtest/qttesttreeitem.cpp @@ -243,13 +243,13 @@ bool QtTestTreeItem::modify(const TestParseResult *result) switch (type()) { case TestCase: - return modifyTestCaseContent(result->name, result->line, result->column); + return modifyTestCaseContent(result); case TestFunctionOrSet: case TestDataFunction: case TestSpecialFunction: return modifyTestFunctionContent(result); case TestDataTag: - return modifyDataTagContent(result->name, result->fileName, result->line, result->column); + return modifyDataTagContent(result); default: return false; } diff --git a/src/plugins/autotest/quick/quicktesttreeitem.cpp b/src/plugins/autotest/quick/quicktesttreeitem.cpp index b26e3b8599e..d6cd78b82af 100644 --- a/src/plugins/autotest/quick/quicktesttreeitem.cpp +++ b/src/plugins/autotest/quick/quicktesttreeitem.cpp @@ -285,12 +285,11 @@ bool QuickTestTreeItem::modify(const TestParseResult *result) switch (type()) { case TestCase: - return result->name.isEmpty() ? false : modifyTestCaseContent(result->name, result->line, - result->column); + return result->name.isEmpty() ? false : modifyTestCaseContent(result); case TestFunctionOrSet: case TestDataFunction: case TestSpecialFunction: - return name().isEmpty() ? modifyLineAndColumn(result->line, result->column) + return name().isEmpty() ? modifyLineAndColumn(result) : modifyTestFunctionContent(result); default: return false; diff --git a/src/plugins/autotest/testtreeitem.cpp b/src/plugins/autotest/testtreeitem.cpp index bbba24cfb3b..9d69a6e50d2 100644 --- a/src/plugins/autotest/testtreeitem.cpp +++ b/src/plugins/autotest/testtreeitem.cpp @@ -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; diff --git a/src/plugins/autotest/testtreeitem.h b/src/plugins/autotest/testtreeitem.h index 33636b5d7e1..1c5c3f95a1e 100644 --- a/src/plugins/autotest/testtreeitem.h +++ b/src/plugins/autotest/testtreeitem.h @@ -70,11 +70,10 @@ public: virtual QVariant data(int column, int role) const override; virtual bool setData(int column, const QVariant &data, int role) override; virtual Qt::ItemFlags flags(int column) const override; - bool modifyTestCaseContent(const QString &name, unsigned line, unsigned column); + bool modifyTestCaseContent(const TestParseResult *result); bool modifyTestFunctionContent(const TestParseResult *result); - bool modifyDataTagContent(const QString &name, const QString &fileName, unsigned line, - unsigned column); - bool modifyLineAndColumn(unsigned line, unsigned column); + bool modifyDataTagContent(const TestParseResult *result); + bool modifyLineAndColumn(const TestParseResult *result); const QString name() const { return m_name; } void setName(const QString &name) { m_name = name; } @@ -112,12 +111,12 @@ public: virtual bool modify(const TestParseResult *result) = 0; protected: - bool modifyFilePath(const QString &filePath); typedef std::function CompareFunction; TestTreeItem *findChildBy(CompareFunction compare) const; private: void revalidateCheckState(); + bool modifyFilePath(const QString &filePath); bool modifyName(const QString &name); enum Status