diff --git a/tests/blackmisc/testblackmiscmain.cpp b/tests/blackmisc/testblackmiscmain.cpp index ab3946083..f1d7d6085 100644 --- a/tests/blackmisc/testblackmiscmain.cpp +++ b/tests/blackmisc/testblackmiscmain.cpp @@ -22,6 +22,7 @@ #include "testmath.h" #include "testphysicalquantities.h" #include "testprocess.h" +#include "testpropertyindex.h" #include "testslot.h" #include "teststringutils.h" #include "testvaluecache.h" @@ -51,6 +52,10 @@ namespace BlackMiscTest CTestAviation avBaseTests; status |= test.exec(&avBaseTests, "blackmisc_aviation"); } + { + CTestPropertyIndex piTests; + status |= test.exec(&piTests, "blackmisc_propertyindex"); + } { CTestGeo geoTests; status |= test.exec(&geoTests, "blackmisc_geo"); diff --git a/tests/blackmisc/testpropertyindex.cpp b/tests/blackmisc/testpropertyindex.cpp new file mode 100644 index 000000000..981a84c61 --- /dev/null +++ b/tests/blackmisc/testpropertyindex.cpp @@ -0,0 +1,43 @@ +/* Copyright (C) 2017 + * swift Project Community / Contributors + * + * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \cond PRIVATE_TESTS +//! \file +//! \ingroup testblackmisc + +#include "testpropertyindex.h" +#include "blackmisc/simulation/simulatedaircraft.h" +#include + +using namespace BlackMisc; +using namespace BlackMisc::Aviation; +using namespace BlackMisc::Simulation; +using namespace BlackMisc::PhysicalQuantities; + +namespace BlackMiscTest +{ + CTestPropertyIndex::CTestPropertyIndex(QObject *parent): QObject(parent) + { + // void + } + + void CTestPropertyIndex::propertyIndexCSimulatedAircraft() + { + const CFrequency f(123.50, CFrequencyUnit::MHz()); + const CPropertyIndex i({ CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }); + CSimulatedAircraft aircraft; + aircraft.setCallsign("DEIHL"); + aircraft.setCom1ActiveFrequency(f); + CVariant vf = aircraft.propertyByIndex(i); + const CFrequency pf = vf.value(); + QVERIFY2(pf == f, "Frequencies should have same value"); + } +} // namespace + +//! \endcond diff --git a/tests/blackmisc/testpropertyindex.h b/tests/blackmisc/testpropertyindex.h new file mode 100644 index 000000000..d052a0d83 --- /dev/null +++ b/tests/blackmisc/testpropertyindex.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2017 + * swift project community / contributors + * + * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#ifndef BLACKMISCTEST_TESTPROPERTYINDEX_H +#define BLACKMISCTEST_TESTPROPERTYINDEX_H + +//! \cond PRIVATE_TESTS +//! \file +//! \ingroup testblackmisc + +#include + +namespace BlackMiscTest +{ + //! Testing property index access + class CTestPropertyIndex : public QObject + { + Q_OBJECT + + public: + //! Standard test case constructor + explicit CTestPropertyIndex(QObject *parent = nullptr); + + private slots: + //! Simulated aircraft index checks + void propertyIndexCSimulatedAircraft(); + }; +} // namespace + +//! \endcond + +#endif // guard