summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@theqtcompany.com>2015-11-02 11:06:19 +0100
committerChristian Stenger <christian.stenger@theqtcompany.com>2015-11-13 11:32:23 +0000
commit28fc8c02b36875dae31c1baa5d77a6d4b08fd0c1 (patch)
tree7610b138203d8014c93f39a15e7790a277bd3edc
parent1b97b5e4d3757e5e5ca85032c133009dea9de945 (diff)
downloadqt-creator-28fc8c02b36875dae31c1baa5d77a6d4b08fd0c1.tar.gz
Add plugin unit test for data tagsat-v3.6.0-rc1
Change-Id: I765989cd18c3aff0b8bbc81e4e303e9354e327b7 Reviewed-by: David Schulz <david.schulz@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
-rw-r--r--plugins/autotest/autotestunittests.cpp21
-rw-r--r--plugins/autotest/testtreemodel.cpp11
-rw-r--r--plugins/autotest/testtreemodel.h1
3 files changed, 27 insertions, 6 deletions
diff --git a/plugins/autotest/autotestunittests.cpp b/plugins/autotest/autotestunittests.cpp
index 8878f75418..1a8097c48c 100644
--- a/plugins/autotest/autotestunittests.cpp
+++ b/plugins/autotest/autotestunittests.cpp
@@ -79,6 +79,7 @@ void AutoTestUnitTests::testCodeParser()
QFETCH(int, expectedAutoTestsCount);
QFETCH(int, expectedNamedQuickTestsCount);
QFETCH(int, expectedUnnamedQuickTestsCount);
+ QFETCH(int, expectedDataTagsCount);
NavigationWidget *navigation = NavigationWidget::instance();
navigation->activateSubWidget(Constants::AUTOTEST_ID);
@@ -96,6 +97,7 @@ void AutoTestUnitTests::testCodeParser()
QCOMPARE(m_model->autoTestsCount(), expectedAutoTestsCount);
QCOMPARE(m_model->namedQuickTestsCount(), expectedNamedQuickTestsCount);
QCOMPARE(m_model->unnamedQuickTestsCount(), expectedUnnamedQuickTestsCount);
+ QCOMPARE(m_model->dataTagsCount(), expectedDataTagsCount);
QCOMPARE(m_model->parser()->autoTestsCount(), expectedAutoTestsCount);
QCOMPARE(m_model->parser()->namedQuickTestsCount(), expectedNamedQuickTestsCount);
@@ -109,20 +111,21 @@ void AutoTestUnitTests::testCodeParser_data()
QTest::addColumn<int>("expectedAutoTestsCount");
QTest::addColumn<int>("expectedNamedQuickTestsCount");
QTest::addColumn<int>("expectedUnnamedQuickTestsCount");
+ QTest::addColumn<int>("expectedDataTagsCount");
QTest::newRow("plainAutoTest")
<< QString(m_tmpDir->path() + QLatin1String("/plain/plain.pro"))
- << 1 << 0 << 0;
+ << 1 << 0 << 0 << 0;
QTest::newRow("mixedAutoTestAndQuickTests")
<< QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.pro"))
- << 3 << 5 << 3;
+ << 3 << 5 << 3 << 8;
QTest::newRow("plainAutoTestQbs")
<< QString(m_tmpDir->path() + QLatin1String("/plain/plain.qbs"))
- << 1 << 0 << 0;
- QTest::newRow("mixedAuotTestAndQuickTestsQbs")
+ << 1 << 0 << 0 << 0;
+ QTest::newRow("mixedAutoTestAndQuickTestsQbs")
<< QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.qbs"))
- << 3 << 5 << 3;
+ << 3 << 5 << 3 << 8;
}
void AutoTestUnitTests::testCodeParserSwitchStartup()
@@ -131,6 +134,7 @@ void AutoTestUnitTests::testCodeParserSwitchStartup()
QFETCH(QList<int>, expectedAutoTestsCount);
QFETCH(QList<int>, expectedNamedQuickTestsCount);
QFETCH(QList<int>, expectedUnnamedQuickTestsCount);
+ QFETCH(QList<int>, expectedDataTagsCount);
NavigationWidget *navigation = NavigationWidget::instance();
navigation->activateSubWidget(Constants::AUTOTEST_ID);
@@ -149,6 +153,8 @@ void AutoTestUnitTests::testCodeParserSwitchStartup()
m_isQt4 ? 0 : expectedNamedQuickTestsCount.at(i));
QCOMPARE(m_model->unnamedQuickTestsCount(),
m_isQt4 ? 0 : expectedUnnamedQuickTestsCount.at(i));
+ QCOMPARE(m_model->dataTagsCount(),
+ expectedDataTagsCount.at(i));
QCOMPARE(m_model->parser()->autoTestsCount(), expectedAutoTestsCount.at(i));
QCOMPARE(m_model->parser()->namedQuickTestsCount(),
@@ -164,6 +170,7 @@ void AutoTestUnitTests::testCodeParserSwitchStartup_data()
QTest::addColumn<QList<int> >("expectedAutoTestsCount");
QTest::addColumn<QList<int> >("expectedNamedQuickTestsCount");
QTest::addColumn<QList<int> >("expectedUnnamedQuickTestsCount");
+ QTest::addColumn<QList<int> >("expectedDataTagsCount");
QStringList projects = QStringList()
<< QString(m_tmpDir->path() + QLatin1String("/plain/plain.pro"))
@@ -174,9 +181,11 @@ void AutoTestUnitTests::testCodeParserSwitchStartup_data()
QList<int> expectedAutoTests = QList<int>() << 1 << 3 << 1 << 3;
QList<int> expectedNamedQuickTests = QList<int>() << 0 << 5 << 0 << 5;
QList<int> expectedUnnamedQuickTests = QList<int>() << 0 << 3 << 0 << 3;
+ QList<int> expectedDataTagsCount = QList<int>() << 0 << 8 << 0 << 8;
QTest::newRow("loadMultipleProjects")
- << projects << expectedAutoTests << expectedNamedQuickTests << expectedUnnamedQuickTests;
+ << projects << expectedAutoTests << expectedNamedQuickTests
+ << expectedUnnamedQuickTests << expectedDataTagsCount;
}
} // namespace Internal
diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp
index c59d69a745..7271ccfd17 100644
--- a/plugins/autotest/testtreemodel.cpp
+++ b/plugins/autotest/testtreemodel.cpp
@@ -670,6 +670,17 @@ int TestTreeModel::unnamedQuickTestsCount() const
return unnamed->childCount();
return 0;
}
+
+int TestTreeModel::dataTagsCount() const
+{
+ int dataTagCount = 0;
+ foreach (Utils::TreeItem *item, m_autoTestRootItem->children()) {
+ TestTreeItem *classItem = static_cast<TestTreeItem *>(item);
+ foreach (Utils::TreeItem *functionItem, classItem->children())
+ dataTagCount += functionItem->childCount();
+ }
+ return dataTagCount;
+}
#endif
/***************************** Sort/Filter Model **********************************/
diff --git a/plugins/autotest/testtreemodel.h b/plugins/autotest/testtreemodel.h
index 5c51648ed5..fe0a8d702b 100644
--- a/plugins/autotest/testtreemodel.h
+++ b/plugins/autotest/testtreemodel.h
@@ -67,6 +67,7 @@ public:
int autoTestsCount() const;
int namedQuickTestsCount() const;
int unnamedQuickTestsCount() const;
+ int dataTagsCount() const;
#endif
signals: