1
0
Fork 0

Update tests for revised Subsystem API

This commit is contained in:
James Turner 2021-04-25 18:57:36 +01:00
parent e6307b1494
commit e8952b6c0f
16 changed files with 44 additions and 39 deletions

View file

@ -177,17 +177,13 @@ FGViewMgr::update (double dt)
// update the camera now
osg::ref_ptr<flightgear::CameraGroup> cameraGroup = flightgear::CameraGroup::getDefault();
if (!cameraGroup) {
// attempting to diagnose the cause of FLIGHTGEAR-H9F
throw sg_exception("FGViewMgr::update: no camera group exists");
}
if (cameraGroup) {
cameraGroup->setCameraParameters(currentView->get_v_fov(),
cameraGroup->getMasterAspectRatio());
cameraGroup->update(toOsg(currentView->getViewPosition()),
toOsg(currentView->getViewOrientation()));
}
SviewUpdate(dt);
}

View file

@ -45,7 +45,7 @@ void AIManagerTests::setUp()
FGTestApi::setUp::initTestGlobals("AI");
FGTestApi::setUp::initNavDataCache();
globals->add_new_subsystem<FGAIManager>();
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
auto props = globals->get_props();
props->setBoolValue("sim/ai/enabled", true);

View file

@ -49,8 +49,8 @@ void SubmodelsTests::setUp()
props->setBoolValue("sim/ai/enabled", true);
props->setStringValue("sim/submodels/path", "Aircraft/Test/submodels.xml");
globals->add_new_subsystem<FGAIManager>();
globals->add_new_subsystem<FGSubmodelMgr>();
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGSubmodelMgr>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();

View file

@ -61,10 +61,10 @@ void TrafficTests::setUp()
egph->testSuiteInjectGroundnetXML(SGPath::fromUtf8(FG_TEST_SUITE_DATA) / "EGPH.groundnet.xml");
globals->add_new_subsystem<PerformanceDB>();
globals->add_new_subsystem<FGATCManager>();
globals->add_new_subsystem<FGAIManager>();
globals->add_new_subsystem<flightgear::AirportDynamicsManager>();
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGATCManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();
@ -135,7 +135,7 @@ void TrafficTests::testTrafficManager()
fgSetBool("/sim/traffic-manager/active", true);
fgSetBool("/sim/terrasync/ai-data-update-now", false);
auto tfc = globals->add_new_subsystem<FGTrafficManager>();
auto tfc = globals->add_new_subsystem<FGTrafficManager>(SGSubsystemMgr::GENERAL);
// specify traffic files to read

View file

@ -56,7 +56,7 @@ void DigitalFilterTests::testNoise()
auto ap = new FGXMLAutopilot::Autopilot(globals->get_props(), config);
globals->add_subsystem("ap", ap);
globals->add_subsystem("ap", ap, SGSubsystemMgr::FDM);
ap->bind();
ap->init();

View file

@ -86,7 +86,7 @@ void PidControllerTests::test()
auto ap = new FGXMLAutopilot::Autopilot(globals->get_props(), config);
globals->add_subsystem("ap", ap);
globals->add_subsystem("ap", ap, SGSubsystemMgr::FDM);
ap->bind();
ap->init();

View file

@ -51,7 +51,7 @@ SGSubsystemRef CommRadioTests::setupStandardRadio(const std::string& name, int i
r->bind();
r->init();
globals->add_subsystem("comm-radio", r);
globals->add_subsystem("comm-radio", r, SGSubsystemMgr::GENERAL);
return r;
}

View file

@ -74,6 +74,9 @@ void GPSTests::setUp()
FGTestApi::setUp::initTestGlobals("gps");
FGTestApi::setUp::initNavDataCache();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();
setupRouteManager();
}
@ -106,7 +109,7 @@ GPS* GPSTests::setupStandardGPS(SGPropertyNode_ptr config,
void GPSTests::setupRouteManager()
{
auto rm = globals->add_new_subsystem<FGRouteMgr>();
auto rm = globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
rm->bind();
rm->init();
rm->postinit();

View file

@ -73,6 +73,9 @@ void HoldControllerTests::setUp()
FGTestApi::setUp::initTestGlobals("hold-ctl");
FGTestApi::setUp::initNavDataCache();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();
setupRouteManager();
}
@ -114,7 +117,7 @@ GPS* HoldControllerTests::setupStandardGPS(SGPropertyNode_ptr config,
void HoldControllerTests::setupRouteManager()
{
auto rm = globals->add_new_subsystem<FGRouteMgr>();
auto rm = globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
rm->bind();
rm->init();
rm->postinit();

View file

@ -135,6 +135,9 @@ void RNAVProcedureTests::setUp()
FGTestApi::setUp::initTestGlobals("rnav-procedures");
FGTestApi::setUp::initNavDataCache();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();
SGPath proceduresPath = SGPath::fromEnv("FG_PROCEDURES_PATH");
if (proceduresPath.exists()) {
globals->append_fg_scenery(proceduresPath);
@ -173,7 +176,7 @@ GPS* RNAVProcedureTests::setupStandardGPS(SGPropertyNode_ptr config,
void RNAVProcedureTests::setupRouteManager()
{
auto rm = globals->add_new_subsystem<FGRouteMgr>();
auto rm = globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
rm->bind();
rm->init();
rm->postinit();

View file

@ -40,7 +40,7 @@ SGSubsystemRef TransponderTests::setupStandardTransponder(const std::string& nam
r->bind();
r->init();
globals->add_subsystem("transponder", r);
globals->add_subsystem("transponder", r, SGSubsystemMgr::FDM);
return r;
}

View file

@ -61,10 +61,10 @@ void PosInitTests::setUp()
apt->testSuiteInjectGroundnetXML(SGPath::fromUtf8(FG_TEST_SUITE_DATA) / "EDDF.groundnet.xml");
globals->add_new_subsystem<flightgear::AirportDynamicsManager>();
globals->add_new_subsystem<PerformanceDB>();
globals->add_new_subsystem<FGATCManager>();
globals->add_new_subsystem<FGAIManager>();
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGATCManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
}

View file

@ -185,7 +185,7 @@ void TimeManagerTests::testETCTimeZones()
const auto testDate = 314611200L;
fgSetInt("/sim/time/cur-time-override", testDate);
globals->add_subsystem("time", timeManager);
globals->add_subsystem("time", timeManager, SGSubsystemMgr::INIT);
FGTestApi::setPositionAndStabilise(phto->geod());
timeManager->reposition();

View file

@ -34,7 +34,7 @@ void FPNasalTests::setUp()
}
// flightplan() acces needs the route manager
globals->add_new_subsystem<FGRouteMgr>();
globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();

View file

@ -48,7 +48,7 @@ void RouteManagerTests::setUp()
globals->append_fg_scenery(proceduresPath);
}
globals->add_new_subsystem<FGRouteMgr>();
globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::FDM);
// setup the default GPS, which is needed for waypoint
// sequencing to work

View file

@ -49,7 +49,7 @@ void ViewsTests::tearDown()
void ViewsTests::testBasic()
{
auto vm = globals->add_new_subsystem<FGViewMgr>();
auto vm = globals->add_new_subsystem<FGViewMgr>(SGSubsystemMgr::DISPLAY);
CPPUNIT_ASSERT_EQUAL(static_cast<flightgear::View*>(nullptr), vm->get_current_view());
@ -84,9 +84,9 @@ void ViewsTests::testBasic()
fgSetInt("/sim/current-view/view-number", 0);
vm->bind();
vm->init();
vm->postinit();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();
globals->get_subsystem_mgr()->postinit();
auto c = vm->get_current_view();
CPPUNIT_ASSERT(c);