1
0
Fork 0
Commit graph

63 commits

Author SHA1 Message Date
James Turner
3ac7673236 Tests: fix compilation 2023-07-21 16:33:48 +01:00
James Turner
78e6a209f1 Add some missing cases to Nasal FlightPlan binding
Expose 'between' restrictions as a 2-tuple.
2022-12-02 12:22:15 +00:00
James Turner
0a85e23cde Extend FlightPlan to handle ‘between’ restrictons
As part of this, also improve units handling in speed/altitude
restrictions.
2022-11-28 15:34:00 +00:00
Edward d'Auvergne
c5aa3ca0f1 SGSubsystem classes: Switch to the new SGSubsystemMgr::add() functions.
Most subsystems are now created via the subsystem manager using the global
subsystem registrations.

The FGGlobals add_subsystem() and add_new_subsystem() methods have been removed
as the subsystem manager addition and creation function interface now exceeds
the functionality of these helper functions.
2022-11-17 15:57:39 +00:00
James Turner
1db1187b15 Use real magvar in a unit-test
Changes to the magnetic model exposed some weaknesses in this code.
2022-09-22 09:43:34 +03:00
James Turner
fe9aadd8bb RoutePath: fix pointAlongPath for fly-overs
FIx some bugs in computing turnExitPos for fly-over waypoints,
and computing leg course when preceeeding leg is a runway.
In both cass we had an incorrect turnExitPos, so points along
the leg were incorreclty positioned.

Extend the test cases to cover this further.
2022-01-20 20:33:37 +00:00
James Turner
a6a29f5482 Tests for airwsys in Nasal 2022-01-15 22:23:38 +00:00
James Turner
7ac03debf4 Add tests for isRoute FlightPlans 2022-01-15 22:23:38 +00:00
James Turner
d59db8ea54 FlightPlan: distuinguish routes from flight-plans
Add a bool flag isRoute to flight-plan, and use it to model
routes (which contain VIAs) from plans/legs, which do not.

Default isRoute to false, so most users only see expanded
Vias, and hence something that can be flown directly.
2022-01-15 22:23:38 +00:00
James Turner
c1e5cc3074 Improve creating VIA segments
Improve argument parsing for createViaTo, createViaFromTo to
handle Airway ghosts as well as strings. As part of this, allow
specification of the airway level explicitly when looking
up an airway.

SF-ID: https://sourceforge.net/p/flightgear/codetickets/2686/
2022-01-05 15:44:50 +00:00
Julian Smith
1b7e8504ef test_suite/unit_tests/: cope with getStringValue() now returning std::string. 2021-12-27 10:19:34 +00:00
James Turner
4236cee7b2 Another waypoint selection test from MikeD
Currently selects the wrong VOR, bvut the code is working as
designed, we think.
2021-09-02 11:29:02 +01:00
James Turner
45d969f319 Add tests cases around bug 2616
Can't reproduce this, but capturing in a unit-test just to make sure.

SF-Ticket: https://sourceforge.net/p/flightgear/codetickets/2616/
2021-08-21 13:09:39 +01:00
James Turner
4bf88a0b67 Extend unit-test for route-manager waypoint selection
SF-Ticket: https://sourceforge.net/p/flightgear/codetickets/2372/
2021-08-20 12:08:17 +01:00
James Turner
e8952b6c0f Update tests for revised Subsystem API 2021-04-25 19:18:56 +01:00
James Turner
7a3f8276a6 Add unit-tests for Route-manager commands
Fix some bugs in insert-waypt command discovered during the testing
(w00t, tests FTW)
2020-12-14 11:45:46 +00:00
James Turner
72f1b84837 Improve waypointFromString logic
- exclude POIs and some other types from the ident match, to avoid
  confusing results
- improve how the search vicinity is computed when inserting a leg,
  which is the common case for a route with a destination set. Use
  the midpoint of the leg ending at the insert position, as the optimal
  search vicinity
- move the waypointFromString code into route.cxx, since it is mostly
  independent of a FlightPlan instance
- extend the tests to cover the bug which flagged these issues

Ticket-Id: https://sourceforge.net/p/flightgear/codetickets/2372/
2020-12-13 17:55:32 +00:00
Scott Giese
43c530b660 Modernize: std::string_literals 2020-12-05 14:25:59 -06:00
legoboyvdlp R
b00520ffdb Add test case for issue with routepath at Paro. Also add support for approaches to the TestDelegate. 2020-10-13 09:32:11 +01:00
James Turner
a297c89144 Flightplans: add clearAll, rename clear -> clearLegs
Improve naming of clear() methods, and expose the new ones to Nasal.
this will allow RouteManager dialog ‘clear’ button to clear all, soon.

See ticket:
https://sourceforge.net/p/flightgear/codetickets/2064/
2020-08-17 16:11:10 +01:00
legoboyvdlp R
d6b7eaf60f Fix that tp_type will return nil for transitions 2020-07-30 12:26:04 +01:00
legoboyvdlp R
668b499ff4 Correct restrictions above and below. Add test case. Fix contributed by Tobias Dammers 2020-07-30 12:25:02 +01:00
legoboyvdlp R
3255105190 Ensure that cruise parameters are set when cloning flightplan 2020-07-22 11:31:07 +01:00
James Turner
2f4b2153ef Fix test: find airways.
Fix handling of ‘both’ level option in several places, and amend
the test to make it explicit that we want Clacton VOR, not NDB.
2020-07-16 11:28:50 +01:00
legoboyvdlp R
cd5a0ffe0b Expose totalDistanceNm to Nasal flightplan ghost
Requested by Tobias Dammers, includes associated test. 
May be cherry-picked to 2020.2.
2020-06-30 13:30:35 +01:00
legoboyvdlp R
585c821bde Extend wp.hidden unit test to ensure path is empty after a hidden waypoint 2020-06-19 09:47:16 +01:00
legoboyvdlp R
f05c10e13a Add test for airway() nasal function 2020-06-18 09:22:03 +01:00
legoboyvdlp R
b210f9e253 Add test for cloning flightplan with approach transitions 2020-06-10 17:18:23 +01:00
James Turner
58d7454976 Explicit support for approach transitions
Make the handling of approach transitions consistent with SID and STAR
transitions, including the Nasal API. Add some tests to cover the
new features.
2020-05-27 21:44:59 +01:00
James Turner
55ce199535 Fixes for cloning FPs with procedures 2020-05-27 16:09:18 +01:00
legoboyvdlp R
1a94f4858b Test for cloning plan with procedures 2020-05-25 09:42:52 +01:00
legoboyvdlp R
14c729027c Tests for cloning flightplan.
Two initial tests: basic flightplan and with fgfp-loaded flightplan
2020-05-25 09:42:44 +01:00
James Turner
54f660764e Tests: change how we find+load data files
Avoid encoding test-data as strings, since this exceeds MSVC limits
on string literals, and tests don’t need to be relocatable anyway,
so we can just hard-code the source location into config.h
2020-05-24 14:14:35 +01:00
James Turner
d66edf42f5 Expose new index-of-interest FP methods to Nasal
Add some test checks for the Nasal API as well
2020-05-22 15:52:54 +01:00
James Turner
fffcd14362 Fix FlightPlan procedure transition handling
Overhaul how transitions are stored in FlightPlan XML, and how
they’re exposed to Nasal. Simplify the Nasal access by making
‘sid_trans’ and ‘star_trans’ writeable.

Extend the unit-tests a lot to cover this, both from C++ and also
from Nasal

As part of this, overhaul the ownership of FlightPlan delegate
factories, to make it safer (use ref-counting of the factories,
and allow the factory to customise delegate clean-up behaviour)
2020-05-21 22:32:28 +01:00
James Turner
8af20fbcab Fix for loading of FGFP plans.
Where the plan does not contain departure / arrival WPs, fire the
corresponding delegate methods after load, to run the selection logic.

Also, add a ‘loaded’ delegate callback, to give delegates a chance to
perform validation and fix-up after all flight-plan loads.
2020-05-19 22:01:42 +01:00
legoboyvdlp R
5747b51df3 Add test for fgfp procedures (failing) 2020-05-14 11:32:49 +01:00
James Turner
134685b527 Fix FP delegate when loading GPXs
When load a GPX route, run normal departure/arrival airport callbacks
on the delegates. (They are blocked for ‘native’ XML routes to avoid
losing SIDs and STARs)

https://sourceforge.net/p/flightgear/codetickets/2227/
2020-05-03 08:30:18 +01:00
James Turner
6baa55b36b Waypoint hiding support (for the A320, etc)
To support FMS which delete ‘past’ waypoints, add some helpers:
 - waypoints can be flagged as hidden, this property is exposed to Nasal
 - currentWP() accepts an offset parameter, allowing FlightPlan indexing
   to treat the current WP as index 0
 - a ‘numRemainingWaypoints()’ function on flightPlan in Nasal, again
   to range how many waypoints are left, starting from the current WP

Add some basic tests of these new features to the route-manager tests.
2020-05-01 09:28:42 +01:00
James Turner
b85048db2d GPS/FLightPlan test updates
- fix reseting of the NavData each test
- improve the test-pilot’s GPS following (reduce turn range close
   to the desired course)
- test DME intercepts
2020-04-21 15:48:41 +01:00
James Turner
b016c4b489 GPS/FP radial-intercept tests
By Jonathan Redpath, with some additions from me. Starting to exercise
both GPS and route-path for radial intercepts
2020-04-20 11:03:35 +01:00
James Turner
492c6daeca Bugfix for DISCON GPS test
Relocate before starting the GPS, to avoid confusion when we teleport
2020-04-19 17:04:46 +01:00
James Turner
17774dbe4c FlightPlan: DISCON works with pointAlongRoute
Add some tests for the default GPS / route-manager handling of
DISCON in flight-plans. Especially check behaviour when sequencing
a DISCON, and resuming with a Direct-to after one. 

This requires a corresponding FGData update to the default GPS Nasal.
2020-04-19 16:44:49 +01:00
James Turner
1a925b152d FlightPlan: don’t assert on invalid waypoints
When there is no first anchor waypoint (eg a runway or navaid), avoid
asserts from the RoutePath code.
2020-04-19 12:27:50 +01:00
James Turner
4c0965e3c1 Some initial tests for route discontinuities.
Probably many more to add, but this is some basic testing at least of
inserting, querying and removing discontinuities.
2020-04-15 16:11:33 +01:00
James Turner
3f14d53286 FlightPlans: fix save/load of restrictions, deleting legs from Nasal
- Fix Leg ownership to avoid segfaults when deleting them via Nasal
- Modify FP save/load code so restrictions and holds are correctly
  saved and restored

Extend the tests to cover these cases.
2020-03-10 14:00:40 +00:00
legoboyvdlp R
b920a09fcf Correct whitespace in NasalPositioned.cxx; fix segfault in NasalPositioned by adding null check in the legGhostGetMember method; add test case for segfault 2020-01-27 16:27:46 +00:00
James Turner
36f88f6f07 Rename test globals to testGlobals [.cxx|.hxx] 2019-09-24 11:39:34 +01:00
James Turner
18c19885c6 Improvements to Nasal hold API
Ensure changes from Nasal are picked up by delegates (such as GPS) when
they are made. Add a route-manager test which sets and exits a hold
using Nasal.

As part of this, update the test API to make it easy to run Nasal from
a test.
2019-09-24 11:29:05 +01:00
James Turner
45df8f51b2 Move GPS sequencing into Nasal (optionally)
GPS now lets the delegate handle the sequencing behaviour, by
setting a new config property. The default GPS delegate (in Nasal)
now sets this property.

This requires a corresponding FGData update.
2019-09-20 13:05:57 +01:00