diff --git a/plugins/autotest/testtreeitem.cpp b/plugins/autotest/testtreeitem.cpp index 6b4c5b4bc59..7b1196c6cc3 100644 --- a/plugins/autotest/testtreeitem.cpp +++ b/plugins/autotest/testtreeitem.cpp @@ -73,6 +73,9 @@ static QIcon testTreeIcon(TestTreeItem::Type type) QIcon(QLatin1String(":/images/func.png")), QIcon(QLatin1String(":/images/data.png")) }; + if (type == TestTreeItem::GTestCase) + return icons[1]; + if (int(type) >= int(sizeof icons / sizeof *icons)) return icons[2]; return icons[type]; @@ -102,6 +105,9 @@ QVariant TestTreeItem::data(int /*column*/, int role) const case TestDataFunction: case TestSpecialFunction: case TestDataTag: + case GTestCase: + case GTestName: + case GTestNameDisabled: return QVariant(); case TestClass: return m_name.isEmpty() ? QVariant() : checked(); diff --git a/plugins/autotest/testtreeitemdelegate.cpp b/plugins/autotest/testtreeitemdelegate.cpp index 7068c064724..17475e2326a 100644 --- a/plugins/autotest/testtreeitemdelegate.cpp +++ b/plugins/autotest/testtreeitemdelegate.cpp @@ -64,6 +64,10 @@ void TestTreeItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem & } } + // paint disabled googletests in gray + if (index.data(TypeRole).toInt() == TestTreeItem::GTestNameDisabled) + opt.palette.setColor(QPalette::Text, QColor(0xa0, 0xa0, 0xa0)); + QStyledItemDelegate::paint(painter, opt, index); } diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 2d6d035885e..e1334725686 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -40,11 +40,13 @@ TestTreeModel::TestTreeModel(QObject *parent) : TreeModel(parent), m_autoTestRootItem(new TestTreeItem(tr("Auto Tests"), QString(), TestTreeItem::Root)), m_quickTestRootItem(new TestTreeItem(tr("Qt Quick Tests"), QString(), TestTreeItem::Root)), + m_googleTestRootItem(new TestTreeItem(tr("Google Tests"), QString(), TestTreeItem::Root)), m_parser(new TestCodeParser(this)), m_connectionsInitialized(false) { rootItem()->appendChild(m_autoTestRootItem); rootItem()->appendChild(m_quickTestRootItem); + rootItem()->appendChild(m_googleTestRootItem); connect(m_parser, &TestCodeParser::cacheCleared, this, &TestTreeModel::removeAllTestItems, Qt::QueuedConnection); @@ -170,6 +172,9 @@ Qt::ItemFlags TestTreeModel::flags(const QModelIndex &index) const case TestTreeItem::TestDataFunction: case TestTreeItem::TestSpecialFunction: case TestTreeItem::TestDataTag: + case TestTreeItem::GTestCase: + case TestTreeItem::GTestName: + case TestTreeItem::GTestNameDisabled: default: return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } @@ -177,7 +182,8 @@ Qt::ItemFlags TestTreeModel::flags(const QModelIndex &index) const bool TestTreeModel::hasTests() const { - return m_autoTestRootItem->childCount() > 0 || m_quickTestRootItem->childCount() > 0; + return m_autoTestRootItem->childCount() > 0 || m_quickTestRootItem->childCount() > 0 + || m_googleTestRootItem->childCount() > 0; } QList TestTreeModel::getAllTestCases() const @@ -533,6 +539,7 @@ void TestTreeModel::removeAllTestItems() { m_autoTestRootItem->removeChildren(); m_quickTestRootItem->removeChildren(); + m_googleTestRootItem->removeChildren(); emit testTreeModelChanged(); } @@ -558,6 +565,8 @@ TestTreeItem *TestTreeModel::rootItemForType(TestTreeModel::Type type) return m_autoTestRootItem; case QuickTest: return m_quickTestRootItem; + case GoogleTest: + return m_googleTestRootItem; } QTC_ASSERT(false, return 0); } @@ -569,6 +578,8 @@ QModelIndex TestTreeModel::rootIndexForType(TestTreeModel::Type type) return index(0, 0); case QuickTest: return index(1, 0); + case GoogleTest: + return index(2, 0); } QTC_ASSERT(false, return QModelIndex()); } diff --git a/plugins/autotest/testtreemodel.h b/plugins/autotest/testtreemodel.h index fe0a8d702b7..0a2a5e0be58 100644 --- a/plugins/autotest/testtreemodel.h +++ b/plugins/autotest/testtreemodel.h @@ -42,7 +42,8 @@ class TestTreeModel : public Utils::TreeModel public: enum Type { AutoTest, - QuickTest + QuickTest, + GoogleTest }; static TestTreeModel* instance(); @@ -95,6 +96,7 @@ private: TestTreeItem *m_autoTestRootItem; TestTreeItem *m_quickTestRootItem; + TestTreeItem *m_googleTestRootItem; TestCodeParser *m_parser; bool m_connectionsInitialized; QAtomicInt m_refCounter;