1
0
Fork 0

TestSuite: Complete removal of FG_TESTLIB.

This commit is contained in:
Edward d'Auvergne 2018-06-11 11:35:09 +02:00
parent 583461a812
commit feb854946e
14 changed files with 5 additions and 90 deletions

View file

@ -186,7 +186,6 @@ public:
private:
void populate()
{
#if !defined(FG_TESTLIB)
SGVec3d cartAirportPos = m_airport->cart();
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
for (auto ai : aiManager->get_ai_list()) {
@ -199,7 +198,6 @@ private:
m_cache.push_back(cart);
}
#endif
m_populated = true;
}

View file

@ -27,12 +27,8 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#ifdef FG_TESTLIB
#include <tests/fake_sgSky.hxx>
#else
#include <simgear/scene/sky/sky.hxx>
#include <simgear/scene/model/particles.hxx>
#endif
#include <simgear/structure/event_mgr.hxx>
#include <Main/main.hxx>
@ -52,7 +48,6 @@
#include "gravity.hxx"
#include "magvarmanager.hxx"
#ifndef FG_TESTLIB
class FG3DCloudsListener : public SGPropertyChangeListener {
public:
FG3DCloudsListener( FGClouds * fgClouds );
@ -83,7 +78,6 @@ void FG3DCloudsListener::valueChanged( SGPropertyNode * node )
{
_fgClouds->set_3dClouds( _enableNode->getBoolValue() );
}
#endif
FGEnvironmentMgr::FGEnvironmentMgr () :
_environment(new FGEnvironment()),
@ -92,17 +86,13 @@ FGEnvironmentMgr::FGEnvironmentMgr () :
_3dCloudsEnableListener(nullptr),
_sky(globals->get_renderer()->getSky())
{
#ifndef FG_TESTLIB
fgClouds = new FGClouds;
_3dCloudsEnableListener = new FG3DCloudsListener(fgClouds);
#endif
set_subsystem("controller", Environment::LayerInterpolateController::createInstance( fgGetNode("/environment/config", true ) ));
set_subsystem("precipitation", new FGPrecipitationMgr);
#ifndef FG_TESTLIB
set_subsystem("realwx", Environment::RealWxController::createInstance( fgGetNode("/environment/realwx", true ) ), 1.0 );
set_subsystem("terrainsampler", Environment::TerrainSampler::createInstance( fgGetNode("/environment/terrain", true ) ));
#endif
set_subsystem("ridgelift", new FGRidgeLift);
set_subsystem("magvar", new FGMagVarManager);
@ -117,10 +107,8 @@ FGEnvironmentMgr::~FGEnvironmentMgr ()
remove_subsystem("controller");
remove_subsystem("magvar");
#ifndef FG_TESTLIB
delete fgClouds;
delete _3dCloudsEnableListener;
#endif
delete _environment;
}
@ -129,9 +117,7 @@ SGSubsystem::InitStatus FGEnvironmentMgr::incrementalInit()
InitStatus r = SGSubsystemGroup::incrementalInit();
if (r == INIT_DONE) {
#ifndef FG_TESTLIB
fgClouds->Init();
#endif
globals->get_event_mgr()->addTask("updateClosestAirport", this,
&FGEnvironmentMgr::updateClosestAirport, 30 );
}
@ -164,11 +150,9 @@ FGEnvironmentMgr::bind ()
_tiedProperties.Tie( "effective-visibility-m", _sky,
&SGSky::get_visibility );
#ifndef FG_TESTLIB
_tiedProperties.Tie("rebuild-layers", fgClouds,
&FGClouds::get_update_event,
&FGClouds::set_update_event);
#endif
// _tiedProperties.Tie("turbulence/use-cloud-turbulence", &sgEnviro,
// &SGEnviro::get_turbulence_enable_state,
// &SGEnviro::set_turbulence_enable_state);
@ -256,14 +240,12 @@ FGEnvironmentMgr::update (double dt)
SGGeod aircraftPos(globals->get_aircraft_position());
_environment->set_elevation_ft( aircraftPos.getElevationFt() );
#ifndef FG_TESTLIB
simgear::Particles::setWindFrom( _environment->get_wind_from_heading_deg(),
_environment->get_wind_speed_kt() );
if( _cloudLayersDirty ) {
_cloudLayersDirty = false;
fgClouds->set_update_event( fgClouds->get_update_event()+1 );
}
#endif
fgSetDouble( "/environment/gravitational-acceleration-mps2",
Environment::Gravity::instance()->getGravity(aircraftPos));

View file

@ -36,10 +36,8 @@
class FGPrecipitationMgr : public SGSubsystem
{
private:
#ifndef FG_TESTLIB
osg::ref_ptr<osg::MatrixTransform> transform;
osg::ref_ptr<SGPrecipitation> precipitation;
#endif
float getPrecipitationAtAltitudeMax(void);
simgear::TiedPropertyList _tiedProperties;

View file

@ -240,10 +240,8 @@ setFreeze (bool f)
}
}
#ifndef FG_TESTLIB
// Pause the particle system
simgear::Particles::setFrozen(f);
#endif
}

View file

@ -25,10 +25,8 @@
#include <boost/foreach.hpp>
#include <algorithm>
#ifndef FG_TESTLIB
#include <osgViewer/Viewer>
#include <osgDB/Registry>
#endif
#include <simgear/structure/commands.hxx>
#include <simgear/structure/exception.hxx>
@ -54,7 +52,6 @@
#include <GUI/gui.h>
#include <Viewer/viewmgr.hxx>
#ifndef FG_TESTLIB
#include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx>
#include <Viewer/renderer.hxx>
@ -63,7 +60,6 @@
#include <simgear/sound/soundmgr.hxx>
#include <simgear/scene/material/matlib.hxx>
#endif
#include "globals.hxx"
#include "locale.hxx"
@ -148,9 +144,7 @@ FGGlobals *globals = NULL;
// Constructor
FGGlobals::FGGlobals() :
#ifndef FG_TESTLIB
renderer( new FGRenderer ),
#endif
subsystem_mgr( new SGSubsystemMgr ),
event_mgr( new SGEventMgr ),
sim_time_sec( 0.0 ),
@ -201,7 +195,6 @@ FGGlobals::~FGGlobals()
// stop OSG threading first, to avoid thread races while we tear down
// scene-graph pieces
#ifndef FG_TESTLIB
osg::ref_ptr<osgViewer::Viewer> vw(renderer->getViewer());
if (vw) {
// https://code.google.com/p/flightgear-bugs/issues/detail?id=1291
@ -210,11 +203,9 @@ FGGlobals::~FGGlobals()
// GraphicsContext)
vw->stopThreading();
}
#endif
subsystem_mgr->shutdown();
subsystem_mgr->unbind();
#ifndef FG_TESTLIB
// don't cancel the pager until after shutdown, since AIModels (and
// potentially others) can queue delete requests on the pager.
if (vw && vw->getDatabasePager()) {
@ -230,14 +221,11 @@ FGGlobals::~FGGlobals()
FGFontCache::shutdown();
fgCancelSnapShot();
#endif
delete subsystem_mgr;
subsystem_mgr = NULL; // important so ::get_subsystem returns NULL
#ifndef FG_TESTLIB
vw = nullptr; // don't delete the viewer until now
set_matlib(NULL);
#endif
delete time_params;
delete channel_options_list;
@ -245,9 +233,7 @@ FGGlobals::~FGGlobals()
delete channellist;
simgear::PropertyObjectBase::setDefaultRoot(NULL);
#ifndef FG_TESTLIB
simgear::SGModelLib::resetPropertyRoot();
#endif
delete locale;
locale = NULL;
@ -520,14 +506,12 @@ FGGlobals::get_renderer () const
void FGGlobals::set_renderer(FGRenderer *render)
{
#ifndef FG_TESTLIB
if (render == renderer) {
return;
}
delete renderer;
renderer = render;
#endif
}
SGSubsystemMgr *
@ -870,11 +854,7 @@ void FGGlobals::set_warp_delta( long int d )
FGScenery* FGGlobals::get_scenery () const
{
#ifdef FG_TESTLIB
return nullptr;
#else
return get_subsystem<FGScenery>();
#endif
}
FGViewMgr *FGGlobals::get_viewmgr() const
@ -890,9 +870,7 @@ flightgear::View* FGGlobals::get_current_view () const
void FGGlobals::set_matlib( SGMaterialLib *m )
{
#ifndef FG_TESTLIB
matlib = m;
#endif
}
FGControls *FGGlobals::get_controls() const

View file

@ -118,10 +118,8 @@ private:
// Time structure
SGTime *time_params;
#ifndef FG_TESTLIB
// Material properties library
SGSharedPtr<SGMaterialLib> matlib;
#endif
SGCommandMgr *commands;
@ -324,11 +322,7 @@ public:
inline SGMaterialLib *get_matlib() const
{
#ifdef FG_TESTLIB
return nullptr;
#else
return matlib;
#endif
}
void set_matlib( SGMaterialLib *m );

View file

@ -60,7 +60,7 @@
#include <GUI/gui.h>
#include <GUI/MessageBox.hxx>
#if defined(HAVE_QT) && !defined(FG_TESTLIB)
#if defined(HAVE_QT)
#include <GUI/QtLauncher.hxx>
#include <GUI/SetupRootDialog.hxx>
#endif
@ -238,12 +238,10 @@ void fgSetDefaults ()
SGPropertyNode* v = globals->get_props()->getNode("/sim/version", true);
v->setValueReadOnly("flightgear", FLIGHTGEAR_VERSION);
v->setValueReadOnly("simgear", SG_STRINGIZE(SIMGEAR_VERSION));
#ifndef FG_TESTLIB
v->setValueReadOnly("openscenegraph", osgGetVersion());
#if OSG_VERSION_LESS_THAN(3,5,2)
v->setValueReadOnly("openscenegraph-thread-safe-reference-counting",
osg::Referenced::getThreadSafeReferenceCounting());
#endif
#endif
v->setValueReadOnly("revision", REVISION);
v->setValueReadOnly("build-number", HUDSON_BUILD_NUMBER);
@ -1036,14 +1034,12 @@ fgOptJpgHttpd( const char * arg )
static int
fgOptHttpd( const char * arg )
{
#ifndef FG_TESTLIB
// port may be any valid address:port notation
// like 127.0.0.1:8080
// or just the port 8080
string port = simgear::strutils::strip(string(arg));
if( port.empty() ) return FG_OPTIONS_ERROR;
fgSetString( string(flightgear::http::PROPERTY_ROOT).append("/options/listening-port").c_str(), port );
#endif
return FG_OPTIONS_OK;
}
@ -2109,9 +2105,7 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath)
}
if (!p->shouldLoadDefaultConfig) {
#if !defined(FG_TESTLIB)
setupRoot(argc, argv);
#endif
return;
}
@ -2750,9 +2744,7 @@ void Options::showVersion() const
PathList scn = globals->get_fg_scenery();
cout << SGPath::join(scn, SGPath::pathListSep) << endl;
cout << "SimGear version: " << SG_STRINGIZE(SIMGEAR_VERSION) << endl;
#ifndef FG_TESTLIB
cout << "OSG version: " << osgGetVersion() << endl;
#endif
cout << "PLIB version: " << PLIB_VERSION << endl;
}
@ -2890,7 +2882,7 @@ void Options::setupRoot(int argc, char **argv)
root = SGPath::fromLocal8Bit(envp);
SG_LOG(SG_GENERAL, SG_INFO, "set from FG_ROOT env var: fg_root = " << root );
} else {
#if defined(HAVE_QT) && !defined(FG_TESTLIB)
#if defined(HAVE_QT)
flightgear::initApp(argc, argv);
root = SetupRootDialog::restoreUserSelectedRoot();
#endif
@ -2908,7 +2900,7 @@ void Options::setupRoot(int argc, char **argv)
string base_version = fgBasePackageVersion(root);
#if defined(HAVE_QT) && !defined(FG_TESTLIB)
#if defined(HAVE_QT)
// only compare major and minor version, not the patch level.
const int versionComp = simgear::strutils::compare_versions(FLIGHTGEAR_VERSION, base_version, 2);

View file

@ -456,7 +456,6 @@ static bool fgSetPosFromNAV( const string& id,
static InitPosResult setInitialPosFromCarrier( const string& carrier )
{
#if !defined(FG_TESTLIB)
const auto initialPos = FGAICarrier::initialPositionForCarrier(carrier);
if (initialPos.first) {
// set these so scenery system has a vicinity to work with, and
@ -468,7 +467,6 @@ static InitPosResult setInitialPosFromCarrier( const string& carrier )
}
SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate aircraft carrier = " << carrier );
#endif
return Failure;
}
@ -476,7 +474,6 @@ static InitPosResult setInitialPosFromCarrier( const string& carrier )
static InitPosResult setFinalPosFromCarrier( const string& carrier, const string& posid )
{
#if !defined(FG_TESTLIB)
SGSharedPtr<FGAICarrier> carrierRef = FGAICarrier::findCarrierByNameOrPennant(carrier);
if (!carrierRef) {
SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate aircraft carrier = "
@ -540,7 +537,6 @@ static InitPosResult setFinalPosFromCarrier( const string& carrier, const string
/////////
return ExactPosition;
}
#endif
SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate aircraft carrier = " << carrier );
return Failure;
}

View file

@ -1262,7 +1262,6 @@ static naRef f_geodinfo(naContext c, naRef me, int argc, naRef* args)
naRef vec = naNewVector(c);
naVec_append(vec, naNum(elev));
#ifndef FG_TESTLIB
naRef matdata = naNil();
const SGMaterial *mat = dynamic_cast<const SGMaterial *>(material);
@ -1281,7 +1280,6 @@ static naRef f_geodinfo(naContext c, naRef me, int argc, naRef* args)
HASHSET("light_coverage", 14, naNum(mat->get_light_coverage()));
}
naVec_append(vec, matdata);
#endif
return vec;
#undef HASHSET
}

View file

@ -913,10 +913,8 @@ void FGNasalSys::init()
initNasalPositioned(_globals, _context);
initNasalPositioned_cppbind(_globals, _context);
initNasalAircraft(_globals, _context);
#ifndef FG_TESTLIB
NasalClipboard::init(this);
initNasalCanvas(_globals, _context);
#endif
initNasalCondition(_globals, _context);
initNasalHTTP(_globals, _context);
initNasalSGPath(_globals, _context);
@ -1016,17 +1014,14 @@ naRef FGNasalSys::wrappedPropsNode(SGPropertyNode* aProps)
void FGNasalSys::update(double)
{
#ifndef FG_TESTLIB
if( NasalClipboard::getInstance() )
NasalClipboard::getInstance()->update();
#endif
if(!_dead_listener.empty()) {
vector<FGNasalListener *>::iterator it, end = _dead_listener.end();
for(it = _dead_listener.begin(); it != end; ++it) delete *it;
_dead_listener.clear();
}
#ifndef FG_TESTLIB
if (!_loadList.empty())
{
if( _delay_load )
@ -1042,7 +1037,6 @@ void FGNasalSys::update(double)
// (only unload one per update loop to avoid excessive lags)
_unloadList.pop()->unload();
}
#endif
// Destroy all queued ghosts
nasal::ghostProcessDestroyList();
@ -1478,18 +1472,14 @@ naRef FGNasalSys::removeListener(naContext c, int argc, naRef* args)
void FGNasalSys::registerToLoad(FGNasalModelData *data)
{
#ifndef FG_TESTLIB
if( _loadList.empty() )
_delay_load = true;
_loadList.push(data);
#endif
}
void FGNasalSys::registerToUnload(FGNasalModelData *data)
{
#ifndef FG_TESTLIB
_unloadList.push(data);
#endif
}
void FGNasalSys::addCommand(naRef func, const std::string& name)

View file

@ -160,10 +160,8 @@ private:
//friend class FGNasalScript;
friend class FGNasalListener;
friend class FGNasalModuleListener;
#ifndef FG_TESTLIB
SGLockedQueue<SGSharedPtr<FGNasalModelData> > _loadList;
SGLockedQueue<SGSharedPtr<FGNasalModelData> > _unloadList;
#endif
// Delay removing items of the _loadList to ensure the are already attached
// to the scene graph (eg. enables to retrieve world position in load
// callback).

View file

@ -1078,11 +1078,7 @@ double View::getOrientation_z() const{
double View::get_aspect_ratio() const
{
#ifdef FG_TESTLIB
return 4.0 / 3.0;
#else
return flightgear::CameraGroup::getDefault()->getMasterAspectRatio();
#endif
}
double View::getLon_deg() const

View file

@ -137,15 +137,12 @@ FGViewMgr::update (double dt)
// Update the current view
currentView->update(dt);
#ifndef FG_TESTLIB
// update the camera now
osg::ref_ptr<flightgear::CameraGroup> cameraGroup = flightgear::CameraGroup::getDefault();
cameraGroup->update(toOsg(currentView->getViewPosition()),
toOsg(currentView->getViewOrientation()));
cameraGroup->setCameraParameters(currentView->get_v_fov(),
cameraGroup->getMasterAspectRatio());
#endif
}
void FGViewMgr::clear()

View file

@ -4,7 +4,7 @@
#include "globals.hxx"
#if defined(HAVE_QT) && !defined(FG_TESTLIB)
#if defined(HAVE_QT)
#include <GUI/QtLauncher.hxx>
#endif
@ -57,7 +57,7 @@ void shutdownTestGlobals()
{
// The QApplication instance must be destroyed before exit() begins, see
// <https://bugreports.qt.io/browse/QTBUG-48709> (otherwise, segfault).
#if defined(HAVE_QT) && !defined(FG_TESTLIB)
#if defined(HAVE_QT)
flightgear::shutdownQtApp();
#endif