Debian Codegraph @

test_suite/FGTestApi/testGlobals.hxx

raw symbols SCIP
1 /*
2 SPDX-Copyright: James Turner
3 SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
6 #pragma once
7
8 #include <string>
9 #include <functional>
10 #include <vector>
11
12 #include <simgear/math/SGGeod.hxx>
13 #include <simgear/props/propsfwd.hxx>
14 #include <simgear/structure/SGSharedPtr.hxx>
15
16 namespace flightgear
17 {
18 class FlightPlan;
19 typedef SGSharedPtr<FlightPlan> FlightPlanRef;
20
21 typedef std::vector<SGGeod> SGGeodVec;
22 }
23
24 namespace FGTestApi {
25
26 namespace setUp {
27
28 void initTestGlobals(const std::string& testName);
29
30 bool logPositionToKML(const std::string& testName);
31 /**Don't log aircraft positions*/
32 bool logLinestringsToKML(const std::string& testName);
33
34 void initStandardNasal(bool withCanvas = false);
35
36 void populateFPWithoutNasal(flightgear::FlightPlanRef f,
37 const std::string& depICAO, const std::string& depRunway,
38 const std::string& destICAO, const std::string& destRunway,
39 const std::string& waypoints);
40
41 void populateFPWithNasal(flightgear::FlightPlanRef f,
42 const std::string& depICAO, const std::string& depRunway,
43 const std::string& destICAO, const std::string& destRunway,
44 const std::string& waypoints);
45
46 } // End of namespace setUp.
47
48 // helpers during tests
49
50 SGPropertyNode_ptr propsFromString(const std::string& s);
51
52 const SGGeod getPosition();
53 void setPosition(const SGGeod& g);
54 void setPositionAndStabilise(const SGGeod& g);
55
56 void runForTime(double t);
57
58 /**
59 @brief set the simulation date/time clock to 'time'
60 */
61 void adjustSimulationWorldTime(time_t time);
62
63 using RunCheck = std::function<bool(void)>;
64
65 bool runForTimeWithCheck(double t, RunCheck check);
66
67 void writeFlightPlanToKML(flightgear::FlightPlanRef fp);
68
69 void writeGeodsToKML(const std::string &label, const flightgear::SGGeodVec& geods);
70 void writePointToKML(const std::string& ident, const SGGeod& pos);
71
72 bool executeNasal(const std::string& code);
73
74 bool geodsApproximatelyEqual(const SGGeod& a, const SGGeod& b);
75
76 namespace tearDown {
77
78 void shutdownTestGlobals();
79
80 } // End of namespace tearDown.
81
82 } // End of namespace FGTestApi.