diff --git a/test_suite/unit_tests/Navaids/test_routeManager.cxx b/test_suite/unit_tests/Navaids/test_routeManager.cxx index 3ae5a2021..eb511c171 100644 --- a/test_suite/unit_tests/Navaids/test_routeManager.cxx +++ b/test_suite/unit_tests/Navaids/test_routeManager.cxx @@ -867,6 +867,36 @@ void RouteManagerTests::testsSelectNavaid() CPPUNIT_ASSERT_EQUAL(wp2->source()->name(), string{"BRYANSK NDB"}); } +void RouteManagerTests::testsSelectWaypoint() +{ + // another part of the issue at + // https://sourceforge.net/p/flightgear/codetickets/2372/ + + auto rm = globals->get_subsystem(); + + FlightPlanRef f = new FlightPlan; + rm->setFlightPlan(f); + + auto rmNode = globals->get_props()->getNode("autopilot/route-manager", true); + rmNode->setStringValue("input", "70N,015E"); + rmNode->setStringValue("input", "55N,015E"); + rmNode->setStringValue("input", "@INSERT1:OSS"); + rmNode->setStringValue("input", "@INSERT2:BOR"); + + auto leg = f->legAtIndex(1); + auto wp1 = leg->waypoint(); + CPPUNIT_ASSERT_EQUAL(wp1->ident(), string{"OSS"}); + CPPUNIT_ASSERT_EQUAL(wp1->source()->name(), string{"OSTERSUND VOR-DME"}); + + // CPPUNIT_ASSERT_DOUBLES_EQUAL(227, leg->courseDeg(), 0.5); + // CPPUNIT_ASSERT_DOUBLES_EQUAL(59, leg->distanceNm(), 0.5); + + leg = f->legAtIndex(2); + auto wp2 = leg->waypoint(); + CPPUNIT_ASSERT_EQUAL(wp2->ident(), string{"BOR"}); + CPPUNIT_ASSERT_EQUAL(wp2->source()->name(), string{"BORLANGE VOR-DME"}); +} + void RouteManagerTests::testCommandAPI() { auto rm = globals->get_subsystem(); diff --git a/test_suite/unit_tests/Navaids/test_routeManager.hxx b/test_suite/unit_tests/Navaids/test_routeManager.hxx index 3ae33acb7..efcd64629 100644 --- a/test_suite/unit_tests/Navaids/test_routeManager.hxx +++ b/test_suite/unit_tests/Navaids/test_routeManager.hxx @@ -46,6 +46,7 @@ class RouteManagerTests : public CppUnit::TestFixture CPPUNIT_TEST(testRouteWithApproachProcedures); CPPUNIT_TEST(testsSelectNavaid); CPPUNIT_TEST(testCommandAPI); + CPPUNIT_TEST(testsSelectWaypoint); CPPUNIT_TEST_SUITE_END(); @@ -74,6 +75,7 @@ public: void testRouteWithApproachProcedures(); void testsSelectNavaid(); void testCommandAPI(); + void testsSelectWaypoint(); private: GPS* m_gps = nullptr;