summaryrefslogtreecommitdiff
path: root/plugins/autotest/testtreemodel.cpp
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@theqtcompany.com>2015-02-10 14:20:43 +0100
committerChristian Stenger <christian.stenger@theqtcompany.com>2015-02-17 10:26:28 +0200
commit213a687f454682b8cd1e79fc27762ac6f374502e (patch)
treef4d1fd940546a261862ecdfc389575390c1b24e3 /plugins/autotest/testtreemodel.cpp
parent751d2e2bb1f0f2829fff8dac15b534fbadc25b3c (diff)
downloadqt-creator-213a687f454682b8cd1e79fc27762ac6f374502e.tar.gz
Rework parsing and provide unit test
Handling of parsing has slightly changed. The parser now uses simple states to be capable of postponing triggered parses if there is already a parsing in progress. Furthermore the parser now waits for the current project to be completely scanned. Change-Id: I6d4968d28194ba8d23d3a0ee6ab454d81a549e67 Reviewed-by: Andre Poenitz <andre.poenitz@theqtcompany.com>
Diffstat (limited to 'plugins/autotest/testtreemodel.cpp')
-rw-r--r--plugins/autotest/testtreemodel.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp
index f2ea94d626..bccabf898a 100644
--- a/plugins/autotest/testtreemodel.cpp
+++ b/plugins/autotest/testtreemodel.cpp
@@ -61,8 +61,6 @@ TestTreeModel::TestTreeModel(QObject *parent) :
connect(m_parser, &TestCodeParser::unnamedQuickTestsRemoved,
this, &TestTreeModel::removeUnnamedQuickTests);
- m_parser->updateTestTree();
-
// CppTools::CppModelManagerInterface *cppMM = CppTools::CppModelManagerInterface::instance();
// if (cppMM) {
// // replace later on by
@@ -808,6 +806,27 @@ void TestTreeModel::processChildren(QModelIndex &parentIndex, const TestTreeItem
}
}
+#ifdef WITH_TESTS
+int TestTreeModel::autoTestsCount() const
+{
+ return m_autoTestRootItem ? m_autoTestRootItem->childCount() : 0;
+}
+
+int TestTreeModel::namedQuickTestsCount() const
+{
+ return m_quickTestRootItem
+ ? m_quickTestRootItem->childCount() - (hasUnnamedQuickTests() ? 1 : 0)
+ : 0;
+}
+
+int TestTreeModel::unnamedQuickTestsCount() const
+{
+ if (TestTreeItem *unnamed = unnamedQuickTests())
+ return unnamed->childCount();
+ return 0;
+}
+#endif
+
/***************************** Sort/Filter Model **********************************/
TestTreeSortFilterModel::TestTreeSortFilterModel(TestTreeModel *sourceModel, QObject *parent)