From 2dda76b831eb9b8af81b2866b4a1f57d6124bce9 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Sun, 21 Mar 2021 13:36:28 +0000 Subject: [PATCH] test_suite/unit_tests/Main/test_posinit.*: added test with AI disabled. --- test_suite/unit_tests/Main/test_posinit.cxx | 45 +++++++++++++++++++++ test_suite/unit_tests/Main/test_posinit.hxx | 2 + 2 files changed, 47 insertions(+) diff --git a/test_suite/unit_tests/Main/test_posinit.cxx b/test_suite/unit_tests/Main/test_posinit.cxx index 34a4016f1..ba7d598d1 100644 --- a/test_suite/unit_tests/Main/test_posinit.cxx +++ b/test_suite/unit_tests/Main/test_posinit.cxx @@ -982,3 +982,48 @@ void PosInitTests::testMPRunwayStartNoGroundnet() checkPosition(rwy->threshold()); } +void PosInitTests::testParkNoAI() +{ + fgSetBool("/sim/traffic-manager/enabled", false); + { + Options* opts = Options::sharedInstance(); + opts->setShouldLoadDefaultConfig(false); + + const char* args[] = {"dummypath", "--airport=EDDF", "--parkpos=F235"}; + opts->init(3, (char**) args, SGPath()); + opts->processOptions(); + } + + CPPUNIT_ASSERT(!fgGetBool("/sim/traffic-manager/enabled")); + CPPUNIT_ASSERT(fgGetBool("/sim/presets/airport-requested")); + CPPUNIT_ASSERT(! fgGetBool("/sim/presets/runway-requested")); + + checkStringProp("/sim/presets/parkpos", "F235"); + initPosition(); + + auto apt = FGAirport::getByIdent("EDDF"); + auto parking1 = apt->groundNetwork()->findParkingByName("F235"); + CPPUNIT_ASSERT(parking1); + + fgSetDouble("/environment/metar/base-wind-dir-deg", 350.0); + fgSetBool("/environment/metar/valid", true); + + simulateFinalizePosition(); + + checkClosestAirport("EDDF"s); + checkPosition(parking1->geod(), 20); + + ////////// + fgSetDouble("/sim/presets/longitude-deg", -9990.00); + fgSetDouble("/sim/presets/latitude-deg", -9990.00); + fgSetString("/sim/presets/airport-id", "EDDF"); + fgSetDouble("/sim/presets/heading-deg", 9990.00); + fgSetString("/sim/presets/parkpos", "foobarzot"); + + simulateStartReposition(); + finalizePosition(); + + // we should be on the best runway, let's see + auto runway = apt->getRunwayByIdent("36"); + checkPosition(runway->threshold()); +} diff --git a/test_suite/unit_tests/Main/test_posinit.hxx b/test_suite/unit_tests/Main/test_posinit.hxx index 53b0e0720..74e1859f0 100644 --- a/test_suite/unit_tests/Main/test_posinit.hxx +++ b/test_suite/unit_tests/Main/test_posinit.hxx @@ -47,6 +47,7 @@ class PosInitTests : public CppUnit::TestFixture CPPUNIT_TEST(testParkAtOccupied); CPPUNIT_TEST(testParkInvalid); CPPUNIT_TEST(testAirportRunwayRepositionAirport); + CPPUNIT_TEST(testParkNoAI); // Navaid tests @@ -99,6 +100,7 @@ public: void testDefaultStartup(); void testParkAtOccupied(); void testParkInvalid(); + void testParkNoAI(); // Navaid tests void testVOROnlyStartup();