2023-09-11 10:50:59 +00:00
|
|
|
/*
|
|
|
|
SPDX-Copyright: James Turner
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2018-07-16 13:59:21 +00:00
|
|
|
|
|
|
|
#include <string>
|
2019-04-19 11:26:07 +00:00
|
|
|
#include <functional>
|
2019-09-19 15:05:26 +00:00
|
|
|
#include <vector>
|
2019-04-19 11:26:07 +00:00
|
|
|
|
2019-09-19 15:05:26 +00:00
|
|
|
#include <simgear/math/SGGeod.hxx>
|
2023-09-11 10:50:59 +00:00
|
|
|
#include <simgear/props/propsfwd.hxx>
|
2019-04-23 17:10:39 +00:00
|
|
|
#include <simgear/structure/SGSharedPtr.hxx>
|
2018-07-16 13:59:21 +00:00
|
|
|
|
2019-04-23 17:10:39 +00:00
|
|
|
namespace flightgear
|
|
|
|
{
|
|
|
|
class FlightPlan;
|
|
|
|
typedef SGSharedPtr<FlightPlan> FlightPlanRef;
|
2019-09-23 22:14:32 +00:00
|
|
|
|
|
|
|
typedef std::vector<SGGeod> SGGeodVec;
|
2019-04-23 17:10:39 +00:00
|
|
|
}
|
|
|
|
|
2018-07-16 13:59:21 +00:00
|
|
|
namespace FGTestApi {
|
|
|
|
|
|
|
|
namespace setUp {
|
|
|
|
|
|
|
|
void initTestGlobals(const std::string& testName);
|
|
|
|
|
2019-04-19 11:26:07 +00:00
|
|
|
bool logPositionToKML(const std::string& testName);
|
2021-03-08 20:56:54 +00:00
|
|
|
/**Don't log aircraft positions*/
|
|
|
|
bool logLinestringsToKML(const std::string& testName);
|
2019-09-19 15:05:26 +00:00
|
|
|
|
2020-03-11 17:14:38 +00:00
|
|
|
void initStandardNasal(bool withCanvas = false);
|
2019-04-19 11:26:07 +00:00
|
|
|
|
|
|
|
void populateFPWithoutNasal(flightgear::FlightPlanRef f,
|
|
|
|
const std::string& depICAO, const std::string& depRunway,
|
|
|
|
const std::string& destICAO, const std::string& destRunway,
|
|
|
|
const std::string& waypoints);
|
|
|
|
|
|
|
|
void populateFPWithNasal(flightgear::FlightPlanRef f,
|
|
|
|
const std::string& depICAO, const std::string& depRunway,
|
|
|
|
const std::string& destICAO, const std::string& destRunway,
|
|
|
|
const std::string& waypoints);
|
2019-04-23 17:10:39 +00:00
|
|
|
|
2018-07-16 13:59:21 +00:00
|
|
|
} // End of namespace setUp.
|
|
|
|
|
2019-09-24 10:29:05 +00:00
|
|
|
// helpers during tests
|
2021-03-08 20:56:54 +00:00
|
|
|
|
2023-09-11 10:50:59 +00:00
|
|
|
SGPropertyNode_ptr propsFromString(const std::string& s);
|
|
|
|
|
2021-03-08 20:56:54 +00:00
|
|
|
const SGGeod getPosition();
|
2018-10-10 08:26:06 +00:00
|
|
|
void setPosition(const SGGeod& g);
|
2019-09-24 10:29:05 +00:00
|
|
|
void setPositionAndStabilise(const SGGeod& g);
|
|
|
|
|
2019-04-22 10:57:55 +00:00
|
|
|
void runForTime(double t);
|
|
|
|
|
2021-04-24 20:39:14 +00:00
|
|
|
/**
|
|
|
|
@brief set the simulation date/time clock to 'time'
|
|
|
|
*/
|
|
|
|
void adjustSimulationWorldTime(time_t time);
|
|
|
|
|
2019-09-24 10:29:05 +00:00
|
|
|
using RunCheck = std::function<bool(void)>;
|
2019-04-19 11:26:07 +00:00
|
|
|
|
|
|
|
bool runForTimeWithCheck(double t, RunCheck check);
|
2019-09-19 15:05:26 +00:00
|
|
|
|
|
|
|
void writeFlightPlanToKML(flightgear::FlightPlanRef fp);
|
|
|
|
|
2019-09-23 22:14:32 +00:00
|
|
|
void writeGeodsToKML(const std::string &label, const flightgear::SGGeodVec& geods);
|
2020-04-20 13:50:24 +00:00
|
|
|
void writePointToKML(const std::string& ident, const SGGeod& pos);
|
2019-09-24 10:29:05 +00:00
|
|
|
|
|
|
|
bool executeNasal(const std::string& code);
|
2019-04-19 11:26:07 +00:00
|
|
|
|
2018-07-16 13:59:21 +00:00
|
|
|
namespace tearDown {
|
|
|
|
|
|
|
|
void shutdownTestGlobals();
|
|
|
|
|
|
|
|
} // End of namespace tearDown.
|
|
|
|
|
|
|
|
} // End of namespace FGTestApi.
|