1
0
Fork 0

Add test case for issue with routepath at Paro. Also add support for approaches to the TestDelegate.

This commit is contained in:
legoboyvdlp R 2020-10-09 19:39:17 +01:00 committed by James Turner
parent c5e45f2b49
commit b00520ffdb
2 changed files with 40 additions and 3 deletions

View file

@ -122,6 +122,19 @@ public:
_plan->insertWayptAtIndex(w, insertIndex++);
}
}
if (_plan->approach()) {
WayptVec approachRoute;
bool ok = _plan->approach()->routeFromVectors(approachRoute);
if (!ok)
throw sg_exception("failed to route approach");
int insertIndex = leg->index();
for (auto w : approachRoute) {
w->setFlag(WPT_ARRIVAL);
w->setFlag(WPT_GENERATED);
_plan->insertWayptAtIndex(w, insertIndex++);
}
}
}
@ -352,6 +365,30 @@ void FlightplanTests::testRoutePathVec()
//CPPUNIT_ASSERT(vec.front()
}
void FlightplanTests::testRoutePathFinalLegVQPR15()
{
// test behaviour of RoutePath when the last leg prior to the arrival runway
// is beyond the runway. This occurs in Paro RNAVZ15 approach.
if (!static_haveProcedures)
return;
static_factory = std::make_shared<TestFPDelegateFactory>();
FlightPlan::registerDelegateFactory(static_factory);
FlightPlanRef f = new FlightPlan;
auto ourDelegate = TestFPDelegateFactory::delegateForPlan(f);
auto vidp = FGAirport::findByIdent("VIDP");
f->setDeparture(vidp->getRunwayByIdent("09"));
auto vqpr = FGAirport::findByIdent("VQPR");
f->setDestination(vqpr->getRunwayByIdent("15"));
f->setApproach(vqpr->findApproachWithIdent("RNVZ15"));
RoutePath rtepath(f);
CPPUNIT_ASSERT_DOUBLES_EQUAL(1100, rtepath.distanceForIndex(14), 100); // calculated from raw lat lon.
}
void FlightplanTests::testRoutPathWpt0Midflight()
{
// test behaviour of RoutePath when WP0 is not a runway
@ -1064,6 +1101,4 @@ void FlightplanTests::testCloningProcedures() {
CPPUNIT_ASSERT_EQUAL(fp2->star()->ident(), string{"EEL1A"});
CPPUNIT_ASSERT_EQUAL(fp2->starTransition()->ident(), string{"BEDUM"});
}
}

View file

@ -40,6 +40,7 @@ class FlightplanTests : public CppUnit::TestFixture
CPPUNIT_TEST(testBug1814);
CPPUNIT_TEST(testRoutPathWpt0Midflight);
CPPUNIT_TEST(testRoutePathVec);
CPPUNIT_TEST(testRoutePathFinalLegVQPR15);
CPPUNIT_TEST(testLoadSaveMachRestriction);
CPPUNIT_TEST(testOnlyDiscontinuityRoute);
CPPUNIT_TEST(testBasicDiscontinuity);
@ -76,6 +77,7 @@ public:
void testBug1814();
void testRoutPathWpt0Midflight();
void testRoutePathVec();
void testRoutePathFinalLegVQPR15();
void testLoadSaveMachRestriction();
void testBasicDiscontinuity();
void testOnlyDiscontinuityRoute();