Skip to content
Snippets Groups Projects
Commit 3d82a674 authored by Francois Ferrand's avatar Francois Ferrand
Browse files

Autotests: emit testTreeModelChanged when new tests are added.


The signal used to be emitted only on reset or when tests are actually removed during sweep phase:
thus the 'run tests' button in test panel stayed disabled if the panel was opened while tests were
scanned.

Change-Id: I274c9d03f1e1140c8aa375f92465c5a0c866cd62
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 04a68518
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ TestTreeItem::TestTreeItem(const QString &name, const QString &filePath, Type ty
m_filePath(filePath),
m_type(type),
m_line(0),
m_markedForRemoval(false)
m_status(NewlyAdded)
{
m_checked = (m_type == TestCase || m_type == TestFunctionOrSet) ? Qt::Checked : Qt::Unchecked;
}
......@@ -207,12 +207,12 @@ Qt::CheckState TestTreeItem::checked() const
void TestTreeItem::markForRemoval(bool mark)
{
m_markedForRemoval = mark;
m_status = mark ? MarkedForRemoval : Cleared;
}
void TestTreeItem::markForRemovalRecursively(bool mark)
{
m_markedForRemoval = mark;
markForRemoval(mark);
for (int row = 0, count = childCount(); row < count; ++row)
childItem(row)->markForRemovalRecursively(mark);
}
......
......@@ -90,7 +90,8 @@ public:
Type type() const { return m_type; }
void markForRemoval(bool mark);
void markForRemovalRecursively(bool mark);
bool markedForRemoval() const { return m_markedForRemoval; }
bool markedForRemoval() const { return m_status == MarkedForRemoval; }
bool newlyAdded() const { return m_status == NewlyAdded; }
TestTreeItem *parentItem() const;
TestTreeItem *childItem(int row) const;
......@@ -114,6 +115,13 @@ private:
void revalidateCheckState();
bool modifyName(const QString &name);
enum Status
{
NewlyAdded,
MarkedForRemoval,
Cleared
};
QString m_name;
QString m_filePath;
Qt::CheckState m_checked;
......@@ -121,7 +129,7 @@ private:
unsigned m_line;
unsigned m_column;
QString m_proFile;
bool m_markedForRemoval;
Status m_status;
};
typedef QVector<TestCodeLocationAndType> TestCodeLocationList;
......
......@@ -703,6 +703,7 @@ bool TestTreeModel::sweepChildren(TestTreeItem *item)
continue;
}
}
hasChanged |= child->newlyAdded();
child->markForRemoval(false);
}
return hasChanged;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment