mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
CTestFsxP3DCommon changed to the UNIT test style of the other unit tests
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
/* Copyright (C) 2018
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
//! \file
|
||||
//! \ingroup testpluginfsxp3d
|
||||
|
||||
#include "testblacksimpluginfsxp3dmain.h"
|
||||
#include "blackmisc/registermetadata.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackSimPluginFsxP3D;
|
||||
|
||||
/*!
|
||||
* Starter for test cases
|
||||
* \brief main
|
||||
* \param argc
|
||||
* \param argv
|
||||
* \return
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
Q_UNUSED(a);
|
||||
|
||||
BlackMisc::registerMetadata();
|
||||
return CBlackSimPluginFsxP3DTest::unitMain(argc, argv);;
|
||||
}
|
||||
|
||||
//! \endcond
|
||||
@@ -2,18 +2,24 @@ load(common_pre)
|
||||
|
||||
QT += core testlib dbus network gui widgets
|
||||
|
||||
TARGET = testsimpluginfsxp3d
|
||||
TEMPLATE = app
|
||||
|
||||
CONFIG += console
|
||||
TARGET = testsimpluginfsxp3d
|
||||
CONFIG -= app_bundle
|
||||
CONFIG += blackmisc blackcore blackconfig blackgui
|
||||
CONFIG += simulatorfsxcommon simulatorfscommon simulatorplugincommon fsuipc simconnect
|
||||
CONFIG += testcase
|
||||
CONFIG += no_testcase_installs
|
||||
|
||||
DEPENDPATH += . $$SourceRoot/src
|
||||
INCLUDEPATH += . $$SourceRoot/src
|
||||
TEMPLATE = app
|
||||
|
||||
DEPENDPATH += \
|
||||
. \
|
||||
$$SourceRoot/src \
|
||||
$$SourceRoot/tests \
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$SourceRoot/src \
|
||||
$$SourceRoot/tests \
|
||||
|
||||
HEADERS += *.h
|
||||
SOURCES += *.cpp
|
||||
DESTDIR = $$DestRoot/bin
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/* Copyright (C) 2018
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
//! \file
|
||||
//! \ingroup testplugins
|
||||
|
||||
#include "testblacksimpluginfsxp3dmain.h"
|
||||
#include "testfsxp3dcommon.h"
|
||||
#include "testsimconnectsymbols.h"
|
||||
#include "blackmisc/test/test.h"
|
||||
#include <QStringList>
|
||||
#include <QTest>
|
||||
|
||||
namespace BlackSimPluginFsxP3D
|
||||
{
|
||||
int CBlackSimPluginFsxP3DTest::unitMain(int argc, char *argv[])
|
||||
{
|
||||
BlackMisc::Test::CTest test(argc, argv);
|
||||
|
||||
int status = 0;
|
||||
{
|
||||
CTestSimconnectSymbols simconnectSymbolsTest;
|
||||
status |= test.exec(&simconnectSymbolsTest, "blacksimpluginfsxp3d_simconnectsymbols");
|
||||
|
||||
CTestFsxP3DCommon commonTest;
|
||||
status |= test.exec(&commonTest, "blacksimpluginfsxp3d_fsxp3dcommon");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//! \endcond
|
||||
@@ -1,34 +0,0 @@
|
||||
/* Copyright (C) 2018
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef BLACKSIMPLUGINFSXP3D_TESTMAIN_H
|
||||
#define BLACKSIMPLUGINFSXP3D_TESTMAIN_H
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
//! \file
|
||||
//! \ingroup testplugins
|
||||
|
||||
namespace BlackSimPluginFsxP3D
|
||||
{
|
||||
/*!
|
||||
* Class firing all unit tests in this namespace.
|
||||
* Avoids clashes with other main(..) functions and allows to fire the test cases
|
||||
* simply from any other main.
|
||||
*/
|
||||
class CBlackSimPluginFsxP3DTest
|
||||
{
|
||||
public:
|
||||
//! Starting all
|
||||
static int unitMain(int argc, char *argv[]);
|
||||
};
|
||||
} // ns
|
||||
|
||||
//! \endcond
|
||||
|
||||
#endif // guard
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "testfsxp3dcommon.h"
|
||||
#include "plugins/simulator/fsxcommon/simconnectdatadefinition.h"
|
||||
#include "plugins/simulator/fsxcommon/simconnectsymbols.h"
|
||||
#include "plugins/simulator/fsxcommon/simulatorfsxcommon.h"
|
||||
#include <QTest>
|
||||
|
||||
@@ -23,6 +24,14 @@ using namespace BlackSimPlugin::FsxCommon;
|
||||
|
||||
namespace BlackSimPluginFsxP3D
|
||||
{
|
||||
void CTestFsxP3DCommon::resolveSymbols()
|
||||
{
|
||||
QVERIFY2(loadAndResolveSimConnect(false), "Could not load and resolve SimConnect library!");
|
||||
HANDLE hSimConnect;
|
||||
SimConnect_Open(&hSimConnect, "Test", nullptr, 0, nullptr, 0);
|
||||
SimConnect_Close(hSimConnect);
|
||||
}
|
||||
|
||||
void CTestFsxP3DCommon::requestIds()
|
||||
{
|
||||
DWORD objectId = 666;
|
||||
@@ -61,4 +70,7 @@ namespace BlackSimPluginFsxP3D
|
||||
}
|
||||
} // ns
|
||||
|
||||
//! main
|
||||
BLACKTEST_APPLESS_MAIN(BlackSimPluginFsxP3D::CTestFsxP3DCommon);
|
||||
|
||||
//! \endcond
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
//! \file
|
||||
//! \ingroup testblacksimplugin
|
||||
|
||||
#include "test.h"
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackSimPluginFsxP3D
|
||||
@@ -28,6 +29,9 @@ namespace BlackSimPluginFsxP3D
|
||||
explicit CTestFsxP3DCommon(QObject *parent = nullptr) : QObject(parent) {}
|
||||
|
||||
private slots:
|
||||
//! Resolve SimConnect Symbols
|
||||
void resolveSymbols();
|
||||
|
||||
//! Request IDs
|
||||
void requestIds();
|
||||
};
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/* Copyright (C) 2018
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \ingroup testblacksimplugin
|
||||
*/
|
||||
|
||||
#include "testsimconnectsymbols.h"
|
||||
#include "plugins/simulator/fsxcommon/simconnectsymbols.h"
|
||||
#include "plugins/simulator/fsxcommon/simconnectwindows.h"
|
||||
#include <QTest>
|
||||
|
||||
namespace BlackSimPluginFsxP3D
|
||||
{
|
||||
void CTestSimconnectSymbols::resolveSymbols()
|
||||
{
|
||||
QVERIFY2(loadAndResolveSimConnect(false), "Could not load and resolve SimConnect library!");
|
||||
HANDLE hSimConnect;
|
||||
SimConnect_Open(&hSimConnect, "Test", nullptr, 0, 0, 0);
|
||||
SimConnect_Close(hSimConnect);
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
//! \endcond
|
||||
@@ -1,38 +0,0 @@
|
||||
/* Copyright (C) 2018
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef BLACKSIMPLUGINFSXP3D_TESTSIMCONNECTSYMBOLS_H
|
||||
#define BLACKSIMPLUGINFSXP3D_TESTSIMCONNECTSYMBOLS_H
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
//! \file
|
||||
//! \ingroup testblacksimplugin
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackSimPluginFsxP3D
|
||||
{
|
||||
//! FSX/P3D common tests
|
||||
class CTestSimconnectSymbols : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Standard test case constructor
|
||||
explicit CTestSimconnectSymbols(QObject *parent = nullptr) : QObject(parent) {}
|
||||
|
||||
private slots:
|
||||
//! Resolve SimConnect Symbols
|
||||
void resolveSymbols();
|
||||
};
|
||||
} // namespace
|
||||
|
||||
//! \endcond
|
||||
|
||||
#endif // guard
|
||||
@@ -64,7 +64,6 @@ int main(int argc, char *argv[]) \
|
||||
return QTest::qExec(&to, args); \
|
||||
}
|
||||
|
||||
|
||||
//! \endcond
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user