mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 11:45:40 +08:00
refs #893, unit test for property index
This commit is contained in:
committed by
Mathew Sutcliffe
parent
88106d6d8a
commit
f8b2e4f23f
@@ -22,6 +22,7 @@
|
|||||||
#include "testmath.h"
|
#include "testmath.h"
|
||||||
#include "testphysicalquantities.h"
|
#include "testphysicalquantities.h"
|
||||||
#include "testprocess.h"
|
#include "testprocess.h"
|
||||||
|
#include "testpropertyindex.h"
|
||||||
#include "testslot.h"
|
#include "testslot.h"
|
||||||
#include "teststringutils.h"
|
#include "teststringutils.h"
|
||||||
#include "testvaluecache.h"
|
#include "testvaluecache.h"
|
||||||
@@ -51,6 +52,10 @@ namespace BlackMiscTest
|
|||||||
CTestAviation avBaseTests;
|
CTestAviation avBaseTests;
|
||||||
status |= test.exec(&avBaseTests, "blackmisc_aviation");
|
status |= test.exec(&avBaseTests, "blackmisc_aviation");
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
CTestPropertyIndex piTests;
|
||||||
|
status |= test.exec(&piTests, "blackmisc_propertyindex");
|
||||||
|
}
|
||||||
{
|
{
|
||||||
CTestGeo geoTests;
|
CTestGeo geoTests;
|
||||||
status |= test.exec(&geoTests, "blackmisc_geo");
|
status |= test.exec(&geoTests, "blackmisc_geo");
|
||||||
|
|||||||
43
tests/blackmisc/testpropertyindex.cpp
Normal file
43
tests/blackmisc/testpropertyindex.cpp
Normal file
@@ -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 <QTest>
|
||||||
|
|
||||||
|
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<CFrequency>();
|
||||||
|
QVERIFY2(pf == f, "Frequencies should have same value");
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
//! \endcond
|
||||||
38
tests/blackmisc/testpropertyindex.h
Normal file
38
tests/blackmisc/testpropertyindex.h
Normal file
@@ -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 <QObject>
|
||||||
|
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user