Add test for cloning flightplan with approach transitions
This commit is contained in:
parent
bce6b56c8d
commit
b210f9e253
2 changed files with 42 additions and 0 deletions
test_suite/unit_tests/Navaids
|
@ -252,3 +252,43 @@ void FPNasalTests::testApproachTransitionAPI()
|
||||||
CPPUNIT_ASSERT_EQUAL(string{"LUL1C"}, fp->approachTransition()->ident());
|
CPPUNIT_ASSERT_EQUAL(string{"LUL1C"}, fp->approachTransition()->ident());
|
||||||
CPPUNIT_ASSERT_EQUAL(string{"ILS08L"}, fp->approach()->ident());
|
CPPUNIT_ASSERT_EQUAL(string{"ILS08L"}, fp->approach()->ident());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FPNasalTests::testApproachTransitionAPIWithCloning()
|
||||||
|
{
|
||||||
|
if (!static_haveProcedures) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto rm = globals->get_subsystem<FGRouteMgr>();
|
||||||
|
|
||||||
|
bool ok = FGTestApi::executeNasal(R"(
|
||||||
|
var fp = flightplan();
|
||||||
|
fp.departure = airportinfo("EGLL");
|
||||||
|
fp.destination = airportinfo("EHAM");
|
||||||
|
fp.star = fp.destination.getStar("REDF1A");
|
||||||
|
fp.destination_runway = fp.destination.runway('06');
|
||||||
|
|
||||||
|
var approach = fp.destination.getApproach("ILS06");
|
||||||
|
unitTest.assert(approach != nil, "No approach loaded");
|
||||||
|
|
||||||
|
var trans = approach.transition('SUG2A');
|
||||||
|
unitTest.assert(trans != nil, "approach transition not found");
|
||||||
|
|
||||||
|
fp.approach = trans;
|
||||||
|
|
||||||
|
unitTest.assert_equal(fp.approach.id, "ILS06", "Incorrect approach returned");
|
||||||
|
unitTest.assert_equal(fp.approach_trans.id, "SUG2A", "Incorrect transition returned");
|
||||||
|
)");
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(ok);
|
||||||
|
|
||||||
|
auto fp = rm->flightPlan();
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(fp->approach());
|
||||||
|
CPPUNIT_ASSERT_EQUAL(string{"SUG2A"}, fp->approachTransition()->ident());
|
||||||
|
CPPUNIT_ASSERT_EQUAL(string{"ILS06"}, fp->approach()->ident());
|
||||||
|
|
||||||
|
auto fp2 = fp->clone("testplan2");
|
||||||
|
CPPUNIT_ASSERT_EQUAL(string{"ILS06"}, fp2->approach()->ident());
|
||||||
|
CPPUNIT_ASSERT_EQUAL(string{"SUG2A"}, fp2->approachTransition()->ident());
|
||||||
|
}
|
|
@ -34,6 +34,7 @@ class FPNasalTests : public CppUnit::TestFixture
|
||||||
CPPUNIT_TEST(testSIDTransitionAPI);
|
CPPUNIT_TEST(testSIDTransitionAPI);
|
||||||
CPPUNIT_TEST(testSTARTransitionAPI);
|
CPPUNIT_TEST(testSTARTransitionAPI);
|
||||||
CPPUNIT_TEST(testApproachTransitionAPI);
|
CPPUNIT_TEST(testApproachTransitionAPI);
|
||||||
|
CPPUNIT_TEST(testApproachTransitionAPIWithCloning);
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
@ -50,4 +51,5 @@ public:
|
||||||
void testSIDTransitionAPI();
|
void testSIDTransitionAPI();
|
||||||
void testSTARTransitionAPI();
|
void testSTARTransitionAPI();
|
||||||
void testApproachTransitionAPI();
|
void testApproachTransitionAPI();
|
||||||
|
void testApproachTransitionAPIWithCloning();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue