File indexing completed on 2024-04-28 04:37:34
0001 /* 0002 SPDX-FileCopyrightText: 2008 Harald Fernengel <harry@kdevelop.org> 0003 SPDX-FileCopyrightText: 2013 Milian Wolff <mail@milianw.de> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KDEVPLATFORM_AUTOTESTSHELL_H 0009 #define KDEVPLATFORM_AUTOTESTSHELL_H 0010 0011 #include <QStringList> 0012 0013 #include "testsexport.h" 0014 #include <shell/shellextension.h> 0015 #include <shell/core.h> 0016 0017 /* This is a dummy shell for unit tests. It basically does nothing :) 0018 0019 You can initialize it in initTestCase() to get a minimal shell to run 0020 your autotests. 0021 0022 Example of a minimal KDevPlatform unit test: 0023 0024 void Mytest::initTestCase() 0025 { 0026 AutoTestShell::init(); 0027 TestCore::initialize(); 0028 } 0029 0030 */ 0031 0032 namespace KDevelop { 0033 class KDEVPLATFORMTESTS_EXPORT AutoTestShell 0034 : public KDevelop::ShellExtension 0035 { 0036 public: 0037 ~AutoTestShell(); 0038 0039 QString xmlFile() override { return QString(); } 0040 QString executableFilePath() override { return QString(); }; 0041 QString defaultProfile() { return QStringLiteral("kdevtest"); } 0042 KDevelop::AreaParams defaultArea() override 0043 { 0044 KDevelop::AreaParams params; 0045 params.name = QStringLiteral("test"); 0046 params.title = QStringLiteral("Test"); 0047 return params; 0048 } 0049 QString projectFileExtension() override { return QString(); } 0050 QString projectFileDescription() override { return QString(); } 0051 QStringList defaultPlugins() override { return m_plugins; } 0052 0053 /** 0054 * Initialize the AutoTestShell and set the global instance. 0055 * 0056 * @p plugins A list of default global plugins which should be loaded. 0057 * By default, all global plugins are loaded. 0058 */ 0059 static void init(const QStringList& plugins = QStringList()); 0060 0061 private: 0062 AutoTestShell() = default; 0063 QStringList m_plugins; 0064 }; 0065 } 0066 0067 #endif