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 // update the camera now
osg::ref_ptr<flightgear::CameraGroup> cameraGroup = flightgear::CameraGroup::getDefault(); 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) { if (cameraGroup) {
cameraGroup->setCameraParameters(currentView->get_v_fov(), cameraGroup->setCameraParameters(currentView->get_v_fov(),
cameraGroup->getMasterAspectRatio()); cameraGroup->getMasterAspectRatio());
cameraGroup->update(toOsg(currentView->getViewPosition()), cameraGroup->update(toOsg(currentView->getViewPosition()),
toOsg(currentView->getViewOrientation())); toOsg(currentView->getViewOrientation()));
} }
SviewUpdate(dt); SviewUpdate(dt);
} }

View file

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

View file

@ -49,8 +49,8 @@ void SubmodelsTests::setUp()
props->setBoolValue("sim/ai/enabled", true); props->setBoolValue("sim/ai/enabled", true);
props->setStringValue("sim/submodels/path", "Aircraft/Test/submodels.xml"); props->setStringValue("sim/submodels/path", "Aircraft/Test/submodels.xml");
globals->add_new_subsystem<FGAIManager>(); globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGSubmodelMgr>(); globals->add_new_subsystem<FGSubmodelMgr>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->bind(); globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init(); 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"); egph->testSuiteInjectGroundnetXML(SGPath::fromUtf8(FG_TEST_SUITE_DATA) / "EGPH.groundnet.xml");
globals->add_new_subsystem<PerformanceDB>(); globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGATCManager>(); globals->add_new_subsystem<FGATCManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGAIManager>(); globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(); globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->bind(); globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init(); globals->get_subsystem_mgr()->init();
@ -135,7 +135,7 @@ void TrafficTests::testTrafficManager()
fgSetBool("/sim/traffic-manager/active", true); fgSetBool("/sim/traffic-manager/active", true);
fgSetBool("/sim/terrasync/ai-data-update-now", false); 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 // specify traffic files to read

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -34,7 +34,7 @@ void FPNasalTests::setUp()
} }
// flightplan() acces needs the route manager // 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()->bind();
globals->get_subsystem_mgr()->init(); globals->get_subsystem_mgr()->init();

View file

@ -47,11 +47,11 @@ void RouteManagerTests::setUp()
static_haveProcedures = true; static_haveProcedures = true;
globals->append_fg_scenery(proceduresPath); 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 // setup the default GPS, which is needed for waypoint
// sequencing to work // sequencing to work
SGPropertyNode_ptr configNode(new SGPropertyNode); SGPropertyNode_ptr configNode(new SGPropertyNode);
configNode->setStringValue("name", "gps"); configNode->setStringValue("name", "gps");
configNode->setIntValue("number", 0); configNode->setIntValue("number", 0);

View file

@ -49,7 +49,7 @@ void ViewsTests::tearDown()
void ViewsTests::testBasic() 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()); 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); fgSetInt("/sim/current-view/view-number", 0);
vm->bind(); globals->get_subsystem_mgr()->bind();
vm->init(); globals->get_subsystem_mgr()->init();
vm->postinit(); globals->get_subsystem_mgr()->postinit();
auto c = vm->get_current_view(); auto c = vm->get_current_view();
CPPUNIT_ASSERT(c); CPPUNIT_ASSERT(c);