forked from qt-creator/qt-creator
AutoTest: Use settings for test run
Change-Id: I3871d15c34f19ea87d9c6ff99a6b0a83dad16fd1 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -24,8 +24,10 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "autotestconstants.h"
|
#include "autotestconstants.h"
|
||||||
|
#include "autotestplugin.h"
|
||||||
#include "autotestunittests.h"
|
#include "autotestunittests.h"
|
||||||
#include "testcodeparser.h"
|
#include "testcodeparser.h"
|
||||||
|
#include "testsettings.h"
|
||||||
#include "testtreemodel.h"
|
#include "testtreemodel.h"
|
||||||
|
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
@@ -40,8 +42,6 @@
|
|||||||
#include <QSignalSpy>
|
#include <QSignalSpy>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include <coreplugin/navigationwidget.h>
|
|
||||||
|
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
@@ -73,10 +73,17 @@ void AutoTestUnitTests::initTestCase()
|
|||||||
QSKIP("This test requires that there is a kit with a toolchain.");
|
QSKIP("This test requires that there is a kit with a toolchain.");
|
||||||
|
|
||||||
m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(QLatin1String(":/unit_test"));
|
m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(QLatin1String(":/unit_test"));
|
||||||
|
|
||||||
|
m_originalAlwaysParse = AutotestPlugin::instance()->settings()->alwaysParse;
|
||||||
|
if (!m_originalAlwaysParse) {
|
||||||
|
AutotestPlugin::instance()->settings()->alwaysParse = true;
|
||||||
|
TestTreeModel::instance()->enableParsingFromSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTestUnitTests::cleanupTestCase()
|
void AutoTestUnitTests::cleanupTestCase()
|
||||||
{
|
{
|
||||||
|
AutotestPlugin::instance()->settings()->alwaysParse = m_originalAlwaysParse;
|
||||||
delete m_tmpDir;
|
delete m_tmpDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,9 +95,6 @@ void AutoTestUnitTests::testCodeParser()
|
|||||||
QFETCH(int, expectedUnnamedQuickTestsCount);
|
QFETCH(int, expectedUnnamedQuickTestsCount);
|
||||||
QFETCH(int, expectedDataTagsCount);
|
QFETCH(int, expectedDataTagsCount);
|
||||||
|
|
||||||
NavigationWidget *navigation = NavigationWidget::instance();
|
|
||||||
navigation->activateSubWidget(Constants::AUTOTEST_ID);
|
|
||||||
|
|
||||||
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
||||||
const CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true);
|
const CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true);
|
||||||
QVERIFY(projectInfo.isValid());
|
QVERIFY(projectInfo.isValid());
|
||||||
@@ -140,9 +144,6 @@ void AutoTestUnitTests::testCodeParserSwitchStartup()
|
|||||||
QFETCH(QList<int>, expectedUnnamedQuickTestsCount);
|
QFETCH(QList<int>, expectedUnnamedQuickTestsCount);
|
||||||
QFETCH(QList<int>, expectedDataTagsCount);
|
QFETCH(QList<int>, expectedDataTagsCount);
|
||||||
|
|
||||||
NavigationWidget *navigation = NavigationWidget::instance();
|
|
||||||
navigation->activateSubWidget(Constants::AUTOTEST_ID);
|
|
||||||
|
|
||||||
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
||||||
for (int i = 0; i < projectFilePaths.size(); ++i) {
|
for (int i = 0; i < projectFilePaths.size(); ++i) {
|
||||||
qDebug() << "Opening project" << projectFilePaths.at(i);
|
qDebug() << "Opening project" << projectFilePaths.at(i);
|
||||||
@@ -193,9 +194,6 @@ void AutoTestUnitTests::testCodeParserGTest()
|
|||||||
if (qgetenv("GOOGLETEST_DIR").isEmpty())
|
if (qgetenv("GOOGLETEST_DIR").isEmpty())
|
||||||
QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)");
|
QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)");
|
||||||
|
|
||||||
NavigationWidget *navigation = NavigationWidget::instance();
|
|
||||||
navigation->activateSubWidget(Constants::AUTOTEST_ID);
|
|
||||||
|
|
||||||
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
||||||
CppTools::ProjectInfo projectInfo = projectManager.open(
|
CppTools::ProjectInfo projectInfo = projectManager.open(
|
||||||
QString(m_tmpDir->path() + QLatin1String("/simple_gt/simple_gt.pro")), true);
|
QString(m_tmpDir->path() + QLatin1String("/simple_gt/simple_gt.pro")), true);
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ private:
|
|||||||
TestTreeModel *m_model;
|
TestTreeModel *m_model;
|
||||||
CppTools::Tests::TemporaryCopiedDir *m_tmpDir;
|
CppTools::Tests::TemporaryCopiedDir *m_tmpDir;
|
||||||
bool m_isQt4;
|
bool m_isQt4;
|
||||||
|
bool m_originalAlwaysParse;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user