diff --git a/src/Terrain/TerrainQuery.cc b/src/Terrain/TerrainQuery.cc index f30fa958c8b2dad4aeb352997e076b93bf7c2c3c..ed7ebb46b1690efc119fe19edc26cb46614add0a 100644 --- a/src/Terrain/TerrainQuery.cc +++ b/src/Terrain/TerrainQuery.cc @@ -10,6 +10,7 @@ #include "TerrainQuery.h" #include "QGCMapEngine.h" #include "QGeoMapReplyQGC.h" +#include "QGCApplication.h" #include #include @@ -36,6 +37,11 @@ TerrainAirMapQuery::TerrainAirMapQuery(QObject* parent) void TerrainAirMapQuery::requestCoordinateHeights(const QList& coordinates) { + if (qgcApp()->runningUnitTests()) { + emit coordinateHeights(false, QList()); + return; + } + QString points; foreach (const QGeoCoordinate& coord, coordinates) { points += QString::number(coord.latitude(), 'f', 10) + "," @@ -52,6 +58,11 @@ void TerrainAirMapQuery::requestCoordinateHeights(const QList& c void TerrainAirMapQuery::requestPathHeights(const QGeoCoordinate& fromCoord, const QGeoCoordinate& toCoord) { + if (qgcApp()->runningUnitTests()) { + emit pathHeights(false, qQNaN(), qQNaN(), QList()); + return; + } + QString points; points += QString::number(fromCoord.latitude(), 'f', 10) + "," + QString::number(fromCoord.longitude(), 'f', 10) + ","; @@ -67,6 +78,11 @@ void TerrainAirMapQuery::requestPathHeights(const QGeoCoordinate& fromCoord, con void TerrainAirMapQuery::requestCarpetHeights(const QGeoCoordinate& swCoord, const QGeoCoordinate& neCoord, bool statsOnly) { + if (qgcApp()->runningUnitTests()) { + emit carpetHeights(false, qQNaN(), qQNaN(), QList>()); + return; + } + QString points; points += QString::number(swCoord.latitude(), 'f', 10) + "," + QString::number(swCoord.longitude(), 'f', 10) + ","; @@ -240,6 +256,11 @@ TerrainOfflineAirMapQuery::TerrainOfflineAirMapQuery(QObject* parent) void TerrainOfflineAirMapQuery::requestCoordinateHeights(const QList& coordinates) { + if (qgcApp()->runningUnitTests()) { + emit coordinateHeights(false, QList()); + return; + } + if (coordinates.length() == 0) { return; } @@ -249,11 +270,21 @@ void TerrainOfflineAirMapQuery::requestCoordinateHeights(const QListrunningUnitTests()) { + emit pathHeights(false, qQNaN(), qQNaN(), QList()); + return; + } + _terrainTileManager->addPathQuery(this, fromCoord, toCoord); } void TerrainOfflineAirMapQuery::requestCarpetHeights(const QGeoCoordinate& swCoord, const QGeoCoordinate& neCoord, bool statsOnly) { + if (qgcApp()->runningUnitTests()) { + emit carpetHeights(false, qQNaN(), qQNaN(), QList>()); + return; + } + // TODO Q_UNUSED(swCoord); Q_UNUSED(neCoord);