diff --git a/src/core/context/contextaudio.cpp b/src/core/context/contextaudio.cpp index c6f43f2da..c7ccd3e93 100644 --- a/src/core/context/contextaudio.cpp +++ b/src/core/context/contextaudio.cpp @@ -321,29 +321,14 @@ namespace swift::core::context return this->getAudioDevices().getOutputDevices(); } - CAudioDeviceInfoList CContextAudioBase::getAudioDevicesPlusDefault() const - { - return CAudioDeviceInfoList::allDevicesPlusDefault(); - } - - CAudioDeviceInfoList CContextAudioBase::getAudioInputDevicesPlusDefault() const - { - return this->getAudioDevicesPlusDefault().getInputDevices(); - } - - CAudioDeviceInfoList CContextAudioBase::getAudioOutputDevicesPlusDefault() const - { - return this->getAudioDevicesPlusDefault().getOutputDevices(); - } - CAudioDeviceInfoList CContextAudioBase::getCurrentAudioDevices() const { const QString inputDeviceName = m_inputDeviceSetting.get(); - const CAudioDeviceInfo inputDevice = this->getAudioInputDevicesPlusDefault().findByNameOrDefault( + const CAudioDeviceInfo inputDevice = this->getAudioInputDevices().findByNameOrDefault( inputDeviceName, CAudioDeviceInfo::getDefaultInputDevice()); const QString outputDeviceName = m_outputDeviceSetting.get(); - const CAudioDeviceInfo outputDevice = this->getAudioOutputDevicesPlusDefault().findByNameOrDefault( + const CAudioDeviceInfo outputDevice = this->getAudioOutputDevices().findByNameOrDefault( outputDeviceName, CAudioDeviceInfo::getDefaultOutputDevice()); CAudioDeviceInfoList devices; diff --git a/src/core/context/contextaudio.h b/src/core/context/contextaudio.h index b7a2d7ab5..e2b14c245 100644 --- a/src/core/context/contextaudio.h +++ b/src/core/context/contextaudio.h @@ -154,9 +154,6 @@ namespace swift::core swift::misc::audio::CAudioDeviceInfoList getAudioDevices() const; swift::misc::audio::CAudioDeviceInfoList getAudioInputDevices() const; swift::misc::audio::CAudioDeviceInfoList getAudioOutputDevices() const; - swift::misc::audio::CAudioDeviceInfoList getAudioDevicesPlusDefault() const; - swift::misc::audio::CAudioDeviceInfoList getAudioInputDevicesPlusDefault() const; - swift::misc::audio::CAudioDeviceInfoList getAudioOutputDevicesPlusDefault() const; //! @} //! Get current audio device diff --git a/src/core/fsd/fsdclient.cpp b/src/core/fsd/fsdclient.cpp index 2e7e38e6a..1084fb78f 100644 --- a/src/core/fsd/fsdclient.cpp +++ b/src/core/fsd/fsdclient.cpp @@ -1215,8 +1215,9 @@ namespace swift::core::fsd CSpeed(dataUpdate.m_groundSpeed, CSpeedUnit::kts())); situation.setPressureAltitude(CAltitude(dataUpdate.m_altitudePressure, CAltitude::MeanSeaLevel, CAltitude::PressureAltitude, CLengthUnit::ft())); + // NotSetGroundDetails because here we do not know if this FSD protocol actually utilizes this flag const COnGroundInfo og(dataUpdate.m_onGround ? COnGroundInfo::OnGround : COnGroundInfo::NotOnGround, - COnGroundInfo::InFromNetwork); + COnGroundInfo::NotSetGroundDetails); situation.setOnGroundInfo(og); // Ref T297, default offset time @@ -1255,8 +1256,9 @@ namespace swift::core::fsd CHeading(data.m_heading, CAngleUnit::deg()), CAngle(-data.m_pitch, CAngleUnit::deg()), CAngle(-data.m_bank, CAngleUnit::deg()), CSpeed(data.m_groundSpeed, CSpeedUnit::kts())); + // NotSetGroundDetails because here we do not know if this FSD protocol actually utilizes this flag const COnGroundInfo og(data.m_onGround ? COnGroundInfo::OnGround : COnGroundInfo::NotOnGround, - COnGroundInfo::InFromNetwork); + COnGroundInfo::NotSetGroundDetails); situation.setOnGroundInfo(og); // Ref T297, default offset time @@ -1756,9 +1758,10 @@ namespace swift::core::fsd CAngle(interimPilotDataUpdate.m_pitch, CAngleUnit::deg()), CAngle(interimPilotDataUpdate.m_bank, CAngleUnit::deg()), CSpeed(interimPilotDataUpdate.m_groundSpeed, CSpeedUnit::kts())); + // NotSetGroundDetails because here we do not know if this FSD protocol actually utilizes this flag const COnGroundInfo og(interimPilotDataUpdate.m_onGround ? COnGroundInfo::OnGround : COnGroundInfo::NotOnGround, - COnGroundInfo::InFromNetwork); + COnGroundInfo::NotSetGroundDetails); situation.setOnGroundInfo(og); // Ref T297, default offset time diff --git a/src/gui/components/audiodevicevolumesetupcomponent.cpp b/src/gui/components/audiodevicevolumesetupcomponent.cpp index b657290d9..86bf0b751 100644 --- a/src/gui/components/audiodevicevolumesetupcomponent.cpp +++ b/src/gui/components/audiodevicevolumesetupcomponent.cpp @@ -382,7 +382,7 @@ namespace swift::gui::components void CAudioDeviceVolumeSetupComponent::initAudioDeviceLists() { if (!this->hasAudio()) { return; } - const bool changed = this->onAudioDevicesChanged(sGui->getCContextAudioBase()->getAudioDevicesPlusDefault()); + const bool changed = this->onAudioDevicesChanged(sGui->getCContextAudioBase()->getAudioDevices()); if (!changed) { return; } const CAudioDeviceInfoList currentDevices = sGui->getCContextAudioBase()->getCurrentAudioDevices(); this->onAudioStarted(currentDevices.getInputDevices().frontOrDefault(), @@ -525,14 +525,14 @@ namespace swift::gui::components CAudioDeviceInfo CAudioDeviceVolumeSetupComponent::getSelectedInputDevice() const { if (!hasAudio()) { return CAudioDeviceInfo(); } - const CAudioDeviceInfoList devices = sGui->getCContextAudioBase()->getAudioInputDevicesPlusDefault(); + const CAudioDeviceInfoList devices = sGui->getCContextAudioBase()->getAudioInputDevices(); return devices.findByName(ui->cb_SetupAudioInputDevice->currentText()); } CAudioDeviceInfo CAudioDeviceVolumeSetupComponent::getSelectedOutputDevice() const { if (!hasAudio()) { return CAudioDeviceInfo(); } - const CAudioDeviceInfoList devices = sGui->getCContextAudioBase()->getAudioOutputDevicesPlusDefault(); + const CAudioDeviceInfoList devices = sGui->getCContextAudioBase()->getAudioOutputDevices(); return devices.findByName(ui->cb_SetupAudioOutputDevice->currentText()); } diff --git a/src/gui/components/interpolationcomponent.cpp b/src/gui/components/interpolationcomponent.cpp index cf6d900f1..27a06c384 100644 --- a/src/gui/components/interpolationcomponent.cpp +++ b/src/gui/components/interpolationcomponent.cpp @@ -21,8 +21,6 @@ namespace swift::gui::components ui->setupUi(this); ui->tw_InterpolationSetup->setCurrentIndex(0); - connect(ui->comp_InterpolationSetup, &CInterpolationSetupComponent::requestRenderingRestrictionsWidget, this, - &CInterpolationComponent::requestRenderingRestrictionsWidget); connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validChangedCallsignEntered, this, &CInterpolationComponent::displayInterpolationMessages); connect(ui->pb_ReloadInterpolationMessages, &QPushButton::released, this, diff --git a/src/gui/components/interpolationcomponent.h b/src/gui/components/interpolationcomponent.h index dc41770a7..513cfe7d4 100644 --- a/src/gui/components/interpolationcomponent.h +++ b/src/gui/components/interpolationcomponent.h @@ -29,10 +29,6 @@ namespace swift::gui::components //! Destructor virtual ~CInterpolationComponent() override; - signals: - //! Request redering restrictions widget - void requestRenderingRestrictionsWidget(); - private: QScopedPointer ui; diff --git a/src/gui/components/interpolationsetupcomponent.cpp b/src/gui/components/interpolationsetupcomponent.cpp index f3fd82fdd..2da8475c0 100644 --- a/src/gui/components/interpolationsetupcomponent.cpp +++ b/src/gui/components/interpolationsetupcomponent.cpp @@ -28,8 +28,6 @@ namespace swift::gui::components ui->cb_IgnoreGlobal->setChecked(true); ui->tvp_InterpolationSetup->menuAddItems(CInterpolationSetupView::MenuRemoveSelectedRows); - connect(ui->pb_RenderingSetup, &QPushButton::clicked, this, - &CInterpolationSetupComponent::requestRenderingRestrictionsWidget); connect(ui->pb_Save, &QPushButton::clicked, this, &CInterpolationSetupComponent::saveSetup); connect(ui->pb_DeleteOrReset, &QPushButton::clicked, this, &CInterpolationSetupComponent::removeOrResetSetup); connect(ui->pb_Reload, &QPushButton::clicked, this, &CInterpolationSetupComponent::reloadSetup, diff --git a/src/gui/components/interpolationsetupcomponent.h b/src/gui/components/interpolationsetupcomponent.h index c738d8fee..b37878bf3 100644 --- a/src/gui/components/interpolationsetupcomponent.h +++ b/src/gui/components/interpolationsetupcomponent.h @@ -41,10 +41,6 @@ namespace swift::gui::components //! Setup mode Mode getSetupMode() const; - signals: - //! Request restrictions UI - void requestRenderingRestrictionsWidget(); - private: QScopedPointer ui; diff --git a/src/gui/components/interpolationsetupcomponent.ui b/src/gui/components/interpolationsetupcomponent.ui index 6196e6fe7..eff277dd5 100644 --- a/src/gui/components/interpolationsetupcomponent.ui +++ b/src/gui/components/interpolationsetupcomponent.ui @@ -161,16 +161,6 @@ - - - - goto rendering setup - - - rendering - - - @@ -215,7 +205,6 @@ rb_Global pb_Reload cb_IgnoreGlobal - pb_RenderingSetup pb_DeleteOrReset pb_Save diff --git a/src/gui/models/aircraftsituationlistmodel.cpp b/src/gui/models/aircraftsituationlistmodel.cpp index d60ff9a0e..7a71e8e85 100644 --- a/src/gui/models/aircraftsituationlistmodel.cpp +++ b/src/gui/models/aircraftsituationlistmodel.cpp @@ -29,6 +29,8 @@ namespace swift::gui::models m_columns.addColumn(CColumn("latitude", CAircraftSituation::IndexLatitude, new CLatLonFormatter())); m_columns.addColumn(CColumn("longitude", CAircraftSituation::IndexLongitude, new CLatLonFormatter())); m_columns.addColumn(CColumn("gs.", CAircraftSituation::IndexGroundSpeed, new CSpeedKtsFormatter())); + m_columns.addColumn(CColumn::standardValueObject("gnd factor", CAircraftSituation::IndexIsOnGroundInfo, + CDefaultFormatter::alignRightVCenter())); m_columns.addColumn(CColumn::standardString("PBH", "pitch bank heading", CAircraftSituation::IndexPBHInfo)); m_columns.addColumn(CColumn::standardString("gnd.elv.", CAircraftSituation::IndexGroundElevationPlusInfo)); m_columns.addColumn(CColumn::standardString("gnd.elv.alt.", { CAircraftSituation::IndexGroundElevationPlane, diff --git a/src/gui/views/viewbase.h b/src/gui/views/viewbase.h index e57084f18..c90ec094a 100644 --- a/src/gui/views/viewbase.h +++ b/src/gui/views/viewbase.h @@ -519,6 +519,9 @@ namespace swift::gui //! Settings have been changed void settingsChanged(); + //! Select all rows + void selectAll() override; + //! @{ //! Change selection modes void setMultiSelection(); diff --git a/src/gui/views/viewbasenontemplate.cpp b/src/gui/views/viewbasenontemplate.cpp index 84bf205a9..f53c0a2f8 100644 --- a/src/gui/views/viewbasenontemplate.cpp +++ b/src/gui/views/viewbasenontemplate.cpp @@ -877,6 +877,18 @@ namespace swift::gui::views m_displayAutomatically = a->isChecked(); } + void CViewBaseNonTemplate::selectAll() + { + // FIXME: Workaround to implement the logic on our own because the default selectAll() implementation does not + // seem to work + this->clearSelection(); + QItemSelection selectedItems; + const int columns = this->model()->columnCount() - 1; + const int rows = this->model()->rowCount() - 1; + selectedItems.select(this->model()->index(0, 0), this->model()->index(rows, columns)); + this->selectionModel()->select(selectedItems, QItemSelectionModel::Select); + } + void CViewBaseNonTemplate::setSingleSelection() { this->setSelectionMode(SingleSelection); } void CViewBaseNonTemplate::setExtendedSelection() diff --git a/src/misc/audio/audiodeviceinfolist.cpp b/src/misc/audio/audiodeviceinfolist.cpp index da61cf92f..7c332f0a4 100644 --- a/src/misc/audio/audiodeviceinfolist.cpp +++ b/src/misc/audio/audiodeviceinfolist.cpp @@ -157,27 +157,6 @@ namespace swift::misc::audio return i; } - CAudioDeviceInfoList CAudioDeviceInfoList::allInputDevicesPlusDefault() - { - CAudioDeviceInfoList i = allInputDevices(); - i.push_back(CAudioDeviceInfoList::defaultInputDevice()); - return i; - } - - CAudioDeviceInfoList CAudioDeviceInfoList::allOutputDevicesPlusDefault() - { - CAudioDeviceInfoList o = allOutputDevices(); - o.push_back(CAudioDeviceInfoList::defaultOutputDevice()); - return o; - } - - CAudioDeviceInfoList CAudioDeviceInfoList::allDevicesPlusDefault() - { - CAudioDeviceInfoList i = allInputDevicesPlusDefault(); - i.push_back(allOutputDevicesPlusDefault()); - return i; - } - QList CAudioDeviceInfoList::allQtInputDevices() { const QList devices = QMediaDevices::audioInputs(); diff --git a/src/misc/audio/audiodeviceinfolist.h b/src/misc/audio/audiodeviceinfolist.h index 34a7bcbf1..e48a86e32 100644 --- a/src/misc/audio/audiodeviceinfolist.h +++ b/src/misc/audio/audiodeviceinfolist.h @@ -86,9 +86,6 @@ namespace swift::misc::audio static CAudioDeviceInfoList allInputDevices(); static CAudioDeviceInfoList allOutputDevices(); static CAudioDeviceInfoList allDevices(); - static CAudioDeviceInfoList allInputDevicesPlusDefault(); - static CAudioDeviceInfoList allOutputDevicesPlusDefault(); - static CAudioDeviceInfoList allDevicesPlusDefault(); static QList allQtInputDevices(); static QList allQtOutputDevices(); static QAudioDevice defaultQtInputDevice(); diff --git a/src/misc/aviation/ongroundinfo.cpp b/src/misc/aviation/ongroundinfo.cpp index 129b04747..615accf8f 100644 --- a/src/misc/aviation/ongroundinfo.cpp +++ b/src/misc/aviation/ongroundinfo.cpp @@ -73,7 +73,7 @@ namespace swift::misc::aviation m_onGroundFactor(interpolatedGndFactor) { // Clip small ground factor values - if (m_onGroundFactor < 0.0) { m_onGroundFactor = -1.0; } + if (m_onGroundFactor < -0.1) { m_onGroundFactor = -1.0; } else if (m_onGroundFactor < 0.001) { m_onGroundFactor = 0.0; } else if (m_onGroundFactor > 0.999) { m_onGroundFactor = 1.0; } } diff --git a/src/misc/aviation/ongroundinfo.h b/src/misc/aviation/ongroundinfo.h index c76874330..2d9bbf21e 100644 --- a/src/misc/aviation/ongroundinfo.h +++ b/src/misc/aviation/ongroundinfo.h @@ -29,7 +29,7 @@ namespace swift::misc::aviation //! Reliability of on ground information enum OnGroundDetails { - NotSetGroundDetails, + NotSetGroundDetails, //!< not set or unknown if correct (e.g. FSD might or might not use the flag) // interpolated situation OnGroundByInterpolation, //!< strongest for remote aircraft OnGroundByElevationAndCG, diff --git a/src/sound/audioutilities.cpp b/src/sound/audioutilities.cpp index 3c2d66472..7886ca70f 100644 --- a/src/sound/audioutilities.cpp +++ b/src/sound/audioutilities.cpp @@ -90,8 +90,6 @@ namespace swift::sound if (supportedDevices.isEmpty()) { return {}; } QAudioDevice deviceWithLowestLatency = supportedDevices.at(0); - deviceWithLowestLatency = - device.isInputDevice() ? QMediaDevices::defaultAudioInput() : QMediaDevices::defaultAudioOutput(); if (supportedDevices.size() > 1) { diff --git a/src/swiftguistandard/swiftguistdinit.cpp b/src/swiftguistandard/swiftguistdinit.cpp index 15d3d61ad..466b82dcd 100644 --- a/src/swiftguistandard/swiftguistdinit.cpp +++ b/src/swiftguistandard/swiftguistdinit.cpp @@ -317,9 +317,6 @@ void SwiftGuiStd::initGuiSignals() // interpolation and validation connect(ui->comp_MainInfoArea->getMappingComponent(), &CMappingComponent::requestValidationDialog, this, &SwiftGuiStd::displayValidationDialog); - connect(ui->comp_MainInfoArea->getInterpolationComponent(), - &CInterpolationComponent::requestRenderingRestrictionsWidget, - [=] { this->setSettingsPage(CSettingsComponent::SettingTabSimulator); }); // on top connect(sGui, &CGuiApplication::alwaysOnTop, this, &SwiftGuiStd::onToggledWindowsOnTop, Qt::QueuedConnection); diff --git a/tests/misc/CMakeLists.txt b/tests/misc/CMakeLists.txt index 96ee8934c..f3b4adda8 100644 --- a/tests/misc/CMakeLists.txt +++ b/tests/misc/CMakeLists.txt @@ -36,6 +36,12 @@ add_swift_test( LINK_LIBRARIES misc tests_test Qt::Core ) +add_swift_test( + NAME misc_aviation_ongroundinfo + SOURCES aviation/testongroundinfo.cpp + LINK_LIBRARIES misc tests_test Qt::Core +) + ############## ## Geo ## ############## diff --git a/tests/misc/aviation/testaircraftsituation/testaircraftsituation.cpp b/tests/misc/aviation/testaircraftsituation/testaircraftsituation.cpp index 210bec9fc..b61924f53 100644 --- a/tests/misc/aviation/testaircraftsituation/testaircraftsituation.cpp +++ b/tests/misc/aviation/testaircraftsituation/testaircraftsituation.cpp @@ -5,20 +5,18 @@ //! \file //! \ingroup testmisc -#include "config/buildconfig.h" -#include "misc/aviation/aircraftsituationchange.h" -#include "misc/aviation/aircraftsituationlist.h" -#include "misc/cputime.h" -#include "misc/network/fsdsetup.h" -// #include "misc/math/mathutils.h" -// #include "misc/stringutils.h" #include #include #include -#include #include "test.h" +#include "config/buildconfig.h" +#include "misc/aviation/aircraftsituationchange.h" +#include "misc/aviation/aircraftsituationlist.h" +#include "misc/cputime.h" +#include "misc/network/fsdsetup.h" + using namespace swift::config; using namespace swift::misc; using namespace swift::misc::aviation; @@ -35,6 +33,9 @@ namespace MiscTest Q_OBJECT private slots: + // Default constructor + void defaultConstructor(); + //! All GND flags void allGndFlagsAndTakeOff() const; @@ -59,6 +60,14 @@ namespace MiscTest //! Using sort hint void sortHint(); + void isGfLanding(); + + void isGfStarting(); + + void isGfEqualAirborne(); + + void isGfEqualOnGround(); + private: //! Test situations (ascending) static swift::misc::aviation::CAircraftSituationList testSituations(); @@ -75,6 +84,17 @@ namespace MiscTest static const swift::misc::physical_quantities::CLength &cg(); }; + void CTestAircraftSituation::defaultConstructor() + { + CAircraftSituation sit; + + QVERIFY2(sit.isNull(), "Situation should be null"); + QVERIFY2(!sit.isOnGround(), "Should not be on ground"); + QVERIFY2(!sit.isOnGroundFromNetwork(), "Should not be on ground from network"); + QVERIFY2(!sit.isOnGroundFromParts(), "Should not be on ground from network"); + QVERIFY2(!sit.isOnGroundInfoAvailable(), "Should not be on ground from network"); + } + void CTestAircraftSituation::allGndFlagsAndTakeOff() const { CAircraftSituationList situations = testSituations(); @@ -363,6 +383,39 @@ namespace MiscTest return newSituations; } + void CTestAircraftSituation::isGfLanding() + { + + QVERIFY2(CAircraftSituation::isGfLanding(1.0, 0.0), "Should be landing"); + QVERIFY2(!CAircraftSituation::isGfLanding(0.0, 1.0), "Should be landing"); + QVERIFY2(!CAircraftSituation::isGfLanding(1.0, 0.9), "Should be landing"); + QVERIFY2(!CAircraftSituation::isGfLanding(0.5, 0.5), "Should be landing"); + } + + void CTestAircraftSituation::isGfStarting() + { + QVERIFY2(CAircraftSituation::isGfStarting(0.0, 1.0), "Should be starting"); + QVERIFY2(!CAircraftSituation::isGfStarting(1.0, 0.0), "Should be starting"); + QVERIFY2(!CAircraftSituation::isGfStarting(0.9, 1.0), "Should be starting"); + QVERIFY2(!CAircraftSituation::isGfStarting(0.5, 0.5), "Should be starting"); + } + + void CTestAircraftSituation::isGfEqualAirborne() + { + QVERIFY2(CAircraftSituation::isGfEqualAirborne(0.0, 0.0), "Should be airborne"); + QVERIFY2(!CAircraftSituation::isGfEqualAirborne(1.0, 1.0), "Should be airborne"); + QVERIFY2(!CAircraftSituation::isGfEqualAirborne(0.0, 0.1), "Should be airborne"); + QVERIFY2(!CAircraftSituation::isGfEqualAirborne(0.5, 0.5), "Should be airborne"); + } + + void CTestAircraftSituation::isGfEqualOnGround() + { + QVERIFY2(CAircraftSituation::isGfEqualOnGround(1.0, 1.0), "Should be ground"); + QVERIFY2(!CAircraftSituation::isGfEqualOnGround(0.0, 0.0), "Should be ground"); + QVERIFY2(!CAircraftSituation::isGfEqualOnGround(1.0, 0.9), "Should be ground"); + QVERIFY2(!CAircraftSituation::isGfEqualOnGround(0.5, 0.5), "Should be on ground"); + } + const CLength &CTestAircraftSituation::cg() { static const CLength cg(2.0, CLengthUnit::m()); diff --git a/tests/misc/aviation/testongroundinfo.cpp b/tests/misc/aviation/testongroundinfo.cpp new file mode 100644 index 000000000..ff31fcf48 --- /dev/null +++ b/tests/misc/aviation/testongroundinfo.cpp @@ -0,0 +1,84 @@ +// SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 + +//! \cond PRIVATE_TESTS +//! \file +//! \ingroup testmisc +#include + +#include "test.h" + +#include "misc/aviation/ongroundinfo.h" + +using namespace swift::misc::aviation; + +namespace MiscTest +{ + //! Aviation classes basic tests + class CMiscOnGroundInfo : public QObject + { + Q_OBJECT + private slots: + void createDefault(); + void createFromGndFactorNotOnGround(); + void createFromGndFactorOnGround(); + void getGroundFactorUnknown(); + void getGroundFactorOnGround(); + void getGroundFactorNotOnGround(); + }; + + void CMiscOnGroundInfo::createDefault() + { + COnGroundInfo info; + QVERIFY2(info.getGroundFactor() == -1, "Wrong ground factor"); + QVERIFY2(info.getGroundDetails() == COnGroundInfo::NotSetGroundDetails, "Wrong ground details"); + QVERIFY2(info.getOnGround() == COnGroundInfo::OnGroundSituationUnknown, "Wrong on ground situation"); + } + + void CMiscOnGroundInfo::createFromGndFactorNotOnGround() + { + COnGroundInfo info(0.5); + QCOMPARE(info.getGroundFactor(), 0.5); + QVERIFY2(info.getGroundDetails() == COnGroundInfo::OnGroundByInterpolation, "Wrong ground details"); + QVERIFY2(info.getOnGround() == COnGroundInfo::NotOnGround, "Wrong on ground situation"); + } + + void CMiscOnGroundInfo::createFromGndFactorOnGround() + { + COnGroundInfo info(0.96); + QCOMPARE(info.getGroundFactor(), 0.96); + QVERIFY2(info.getGroundDetails() == COnGroundInfo::OnGroundByInterpolation, "Wrong ground details"); + QVERIFY2(info.getOnGround() == COnGroundInfo::OnGround, "Wrong on ground situation"); + } + + void CMiscOnGroundInfo::getGroundFactorUnknown() + { + COnGroundInfo info(COnGroundInfo::OnGroundSituationUnknown, COnGroundInfo::NotSetGroundDetails); + QVERIFY2(info.getGroundFactor() == -1, "Wrong ground factor"); + QVERIFY2(info.getGroundDetails() == COnGroundInfo::NotSetGroundDetails, "Wrong ground details"); + QVERIFY2(info.getOnGround() == COnGroundInfo::OnGroundSituationUnknown, "Wrong on ground situation"); + } + + void CMiscOnGroundInfo::getGroundFactorOnGround() + { + COnGroundInfo info(COnGroundInfo::OnGround, COnGroundInfo::InFromNetwork); + QVERIFY2(info.getGroundFactor() == 1, "Wrong ground factor"); + QVERIFY2(info.getGroundDetails() == COnGroundInfo::InFromNetwork, "Wrong ground details"); + QVERIFY2(info.getOnGround() == COnGroundInfo::OnGround, "Wrong on ground situation"); + } + + void CMiscOnGroundInfo::getGroundFactorNotOnGround() + { + COnGroundInfo info(COnGroundInfo::NotOnGround, COnGroundInfo::InFromNetwork); + QVERIFY2(info.getGroundFactor() == 0, "Wrong ground factor"); + QVERIFY2(info.getGroundDetails() == COnGroundInfo::InFromNetwork, "Wrong ground details"); + QVERIFY2(info.getOnGround() == COnGroundInfo::NotOnGround, "Wrong on ground situation"); + } + +} // namespace MiscTest + +SWIFTTEST_APPLESS_MAIN(MiscTest::CMiscOnGroundInfo); + +#include "testongroundinfo.moc" + +//! \endcond