1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
/*
SPDX-FileCopyrightText: 2010 Andreas Pakulat <apaku@gmx.de>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-or-later
*/
#include "test_custombuildsystemplugin.h"
#include <QTest>
#include <QDebug>
#include <tests/autotestshell.h>
#include <tests/testcore.h>
#include <tests/kdevsignalspy.h>
#include <tests/projectsgenerator.h>
#include <shell/sessioncontroller.h>
#include <interfaces/iprojectcontroller.h>
#include <interfaces/isession.h>
#include <interfaces/iproject.h>
#include <project/interfaces/ibuildsystemmanager.h>
#include <project/projectmodel.h>
#include <serialization/indexedstring.h>
#include "testconfig.h"
using KDevelop::Core;
using KDevelop::ICore;
using KDevelop::IProject;
using KDevelop::TestCore;
using KDevelop::AutoTestShell;
using KDevelop::KDevSignalSpy;
using KDevelop::ProjectsGenerator;
using KDevelop::Path;
QTEST_MAIN(TestCustomBuildSystemPlugin)
void TestCustomBuildSystemPlugin::cleanupTestCase()
{
TestCore::shutdown();
}
void TestCustomBuildSystemPlugin::initTestCase()
{
AutoTestShell::init({"KDevCustomBuildSystem", "KDevStandardOutputView"});
TestCore::initialize();
}
void TestCustomBuildSystemPlugin::cleanup()
{
ICore::self()->projectController()->closeAllProjects( );
}
void TestCustomBuildSystemPlugin::loadSimpleProject()
{
m_currentProject = ProjectsGenerator::GenerateSimpleProject();
QVERIFY( m_currentProject );
QCOMPARE( m_currentProject->buildSystemManager()->buildDirectory( m_currentProject->projectItem() ),
Path( QStringLiteral("file:///") + QDir::temp().absolutePath() + QStringLiteral("/simpleproject/build/") ) );
}
void TestCustomBuildSystemPlugin::buildDirProject()
{
m_currentProject = ProjectsGenerator::GenerateEmptyBuildDirProject();
QVERIFY( m_currentProject );
QCOMPARE( m_currentProject->buildSystemManager()->buildDirectory( m_currentProject->projectItem() ),
Path( QStringLiteral("file:///") + QDir::temp().absolutePath() + QStringLiteral("/simpleproject/build/") ) );
}
void TestCustomBuildSystemPlugin::loadMultiPathProject()
{
m_currentProject = ProjectsGenerator::GenerateMultiPathProject();
QVERIFY( m_currentProject );
KDevelop::ProjectBaseItem* mainfile = nullptr;
const auto& files = m_currentProject->fileSet();
for (const auto& file : files) {
const auto& filesForPath = m_currentProject->filesForPath(file);
for (auto i: filesForPath) {
if( i->text() == QLatin1String("main.cpp") ) {
mainfile = i;
break;
}
}
}
QVERIFY(mainfile);
QCOMPARE( m_currentProject->buildSystemManager()->buildDirectory( mainfile ),
Path( QStringLiteral("file:///") + QDir::temp().absolutePath() + QStringLiteral("/multipathproject/build/src") ) );
}
#include "moc_test_custombuildsystemplugin.cpp"
|