1
0
Fork 0

Test for cloning plan with procedures

This commit is contained in:
legoboyvdlp R 2020-05-24 23:46:42 +01:00 committed by James Turner
parent 14c729027c
commit 1a94f4858b
2 changed files with 28 additions and 0 deletions

View file

@ -949,4 +949,30 @@ void FlightplanTests::testCloningFGFP()
CPPUNIT_ASSERT(fp2->legAtIndex(6)->waypoint()->source()->ident() == "PSA");
CPPUNIT_ASSERT_EQUAL(7, fp2->numLegs());
}
void FlightplanTests::testCloningProcedures() {
// procedures not loaded, abandon test
if (!static_haveProcedures)
return;
static_factory = std::make_shared<TestFPDelegateFactory>();
FlightPlan::registerDelegateFactory(static_factory);
auto egkk = FGAirport::findByIdent("EGKK");
auto sid = egkk->findSIDWithIdent("SAM3P");
FlightPlanRef fp1 = makeTestFP("EGKK", "08R", "EGJJ", "27",
"");
auto ourDelegate = TestFPDelegateFactory::delegateForPlan(fp1);
fp1->setSID(sid);
auto fp2 = fp1->clone();
CPPUNIT_ASSERT(fp2->departureAirport()->ident() == "EGKK");
CPPUNIT_ASSERT(fp2->departureRunway()->ident() == "08R");
CPPUNIT_ASSERT(fp2->destinationAirport()->ident() == "EGJJ");
CPPUNIT_ASSERT(fp2->destinationRunway()->ident() == "27");
CPPUNIT_ASSERT(fp2->legAtIndex(0)->waypoint()->source()->ident() == "08R");
CPPUNIT_ASSERT_EQUAL(fp2->sid()->ident(), string{"SAM3P"});
}

View file

@ -51,6 +51,7 @@ class FlightplanTests : public CppUnit::TestFixture
CPPUNIT_TEST(loadFGFPWithProcedureIdents);
CPPUNIT_TEST(testCloningBasic);
CPPUNIT_TEST(testCloningFGFP);
CPPUNIT_TEST(testCloningProcedures);
// CPPUNIT_TEST(testParseICAORoute);
// CPPUNIT_TEST(testParseICANLowLevelRoute);
@ -86,6 +87,7 @@ public:
void loadFGFPWithProcedureIdents();
void testCloningBasic();
void testCloningFGFP();
void testCloningProcedures();
};
#endif // FG_FLIGHTPLAN_UNIT_TESTS_HXX