132 lines
4.1 KiB
C++
Executable File
132 lines
4.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Unittest
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <TargetManagement/tgt_dtc.h>
|
|
#include <TargetManagement/tgt_ftc.h>
|
|
#include <TargetManagement/tgt_ftc_types.h>
|
|
#include <TargetManagement/logger.h>
|
|
#include <ExerciseEventManagement/eem_dts.h>
|
|
#include <ParticipantManagement/ppm_dts.h>
|
|
#include <Proxies/TrainingAreaBase/tab_dts.h>
|
|
|
|
#include <DDS/DDSConnector/dds_connector.h>
|
|
|
|
#include <QCoreApplication>
|
|
#include <QtTest/QTest>
|
|
|
|
#include <memory>
|
|
|
|
namespace TargetManagement
|
|
{
|
|
class tgtTestShootbackTarget : public QObject
|
|
, protected TargetManagement::Interface::Ftc::ShootbackAreaModifyReplyHandler
|
|
, protected TargetManagement::Interface::Ftc::ShootbackAreaRemoveReplyHandler
|
|
, protected TargetManagement::Interface::Ftc::ShootbackTargetModifyReplyHandler
|
|
, protected TargetManagement::Interface::Ftc::ShootbackTargetRemoveReplyHandler
|
|
, protected TargetManagement::Interface::Ftc::TargetAreaAssignmentModifyReplyHandler
|
|
, protected TargetManagement::Interface::Ftc::TargetAreaAssignmentRemoveReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
tgtTestShootbackTarget();
|
|
virtual ~tgtTestShootbackTarget();
|
|
|
|
void setPara(int domainId, int exerciseId)
|
|
{
|
|
m_domainId = domainId;
|
|
m_exerciseId = exerciseId;
|
|
}
|
|
|
|
|
|
private Q_SLOTS:
|
|
void initTestCase(); // one time at the beginning
|
|
|
|
// basics
|
|
void testShootbackArea();
|
|
void testShootbackTarget();
|
|
void testTargetAreaAssignment();
|
|
|
|
// based on defaultSituation:
|
|
void testPlayerMoves();
|
|
void testPlayerMovesLos();
|
|
|
|
|
|
void testPlayerRemove();
|
|
|
|
void testAreaChanges();
|
|
void testAreaRemove();
|
|
|
|
void testAssignmentRemove();
|
|
void testAssignmentChanges();
|
|
|
|
void cleanupTestCase(); // one time at the end
|
|
|
|
protected:
|
|
void onShootbackAreaModifyReply(const Core::FunctionReplyObject &reply) override final;
|
|
void onShootbackAreaRemoveReply(const Core::FunctionReplyObject &reply) override final;
|
|
|
|
void onShootbackTargetModifyReply(const Core::FunctionReplyObject &reply) override final;
|
|
void onShootbackTargetRemoveReply(const Core::FunctionReplyObject &reply) override final;
|
|
|
|
void onTargetAreaAssignmentModifyReply(const Core::FunctionReplyObject &reply) override final;
|
|
void onTargetAreaAssignmentRemoveReply(const Core::FunctionReplyObject &reply) override final;
|
|
|
|
private:
|
|
qint64 currentSampleTime();
|
|
void checkShootbackAreaChangedWasEmitted(int number, int line);
|
|
void checkShootbackTargetChangedWasEmitted(int number, int line);
|
|
void checkAssignmentChangedWasEmitted(int number, int line);
|
|
void removeTestObjects();
|
|
|
|
void createArea(int &areaIdInOut, const QString &name, double lon, double lat);
|
|
void modifyArea(int &areaId, const QString &name, double lon, double lat);
|
|
void removeArea(int areaId, bool checkUsingSpy = true);
|
|
|
|
void createTarget(int &targetIdOut, int targetParticipantId, const QString &name);
|
|
void modifyTarget(int targetId, int targetParticipantId, const QString &name, double lon, double lat, double z);
|
|
void removeTarget(int targetId, bool checkUsingSpy = true);
|
|
std::vector<int32_t> visiParticpantsOfTarget(int targetId);
|
|
|
|
void createAssignment(int areaId, int targetParticipantId, int &assignmentIdOut, const QString &name);
|
|
void modifyAssignment(int areaId, int targetParticipantId, int &assignmentId, const QString &name);
|
|
void removeAssignment(int id, bool checkUsingSpy = true);
|
|
|
|
void moveParticipant(int participantId, double lon, double lat);
|
|
|
|
void prepareDefaultSituation();
|
|
|
|
|
|
|
|
private:
|
|
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
|
std::shared_ptr<TargetManagement::Interface::Ftc> m_ftcTgt;
|
|
std::shared_ptr<TargetManagement::Interface::Dtc> m_dtcTgt;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dts> m_dtsPpm;
|
|
std::shared_ptr<TrainingAreaBase::Interface::Dts> m_dtsTab;
|
|
|
|
int m_domainId = -1;
|
|
int m_exerciseId = -1;
|
|
|
|
int m_areaId1 = -1;
|
|
int m_areaId2 = -1;
|
|
int m_targetDataId1 = -1;
|
|
int m_targetDataId2 = -1;
|
|
int m_assignmentId1 = -1;
|
|
|
|
int m_replyShootbackAreaId = -1;
|
|
int m_replyShootbackTargetId = -1;
|
|
int m_replyTargetAreaAssignmentId = -1;
|
|
|
|
NGL::INGLLogger &m_logger;
|
|
|
|
};
|
|
} // namespace
|