Newer
Older
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#ifdef QT_DEBUG
#endif
#include "ParameterManager.h"
#include <QQuickItem>
/// FactSystem Unit Test
FactSystemTestBase::FactSystemTestBase(void)
void FactSystemTestBase::_init(MAV_AUTOPILOT autopilot)
_plugin = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()->autopilotPlugin();
void FactSystemTestBase::_cleanup(void)
{
UnitTest::cleanup();
}
/// Basic test of parameter values in Fact System
void FactSystemTestBase::_parameter_default_component_id_test(void)
QVERIFY(_vehicle->parameterManager()->parameterExists(FactSystem::defaultComponentId, "RC_MAP_THROTTLE"));
Fact* fact = _vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, "RC_MAP_THROTTLE");
QCOMPARE(factValue.isValid(), true);
}
void FactSystemTestBase::_parameter_specific_component_id_test(void)
{
QVERIFY(_vehicle->parameterManager()->parameterExists(MAV_COMP_ID_AUTOPILOT1, "RC_MAP_THROTTLE"));
Fact* fact = _vehicle->parameterManager()->getParameter(MAV_COMP_ID_AUTOPILOT1, "RC_MAP_THROTTLE");
void FactSystemTestBase::_qml_test(void)
widget->setAutoPilot(_plugin);
widget->setSource(QUrl::fromUserInput("qrc:unittest/FactSystemTest.qml"));
QQuickItem* rootObject = widget->rootObject();
QObject* control = rootObject->findChild<QObject*>("testControl");
QVERIFY(control != NULL);
QVariant qmlValue = control->property("text").toInt();
void FactSystemTestBase::_qmlUpdate_test(void)
widget->setAutoPilot(_plugin);
widget->setSource(QUrl::fromUserInput("qrc:unittest/FactSystemTest.qml"));
qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()->parameterManager()->getParameter(FactSystem::defaultComponentId, "RC_MAP_THROTTLE")->setRawValue(paramValue);
QTest::qWait(500); // Let the signals flow through
QQuickItem* rootObject = widget->rootObject();
QObject* control = rootObject->findChild<QObject*>("testControl");
QVERIFY(control != NULL);
QCOMPARE(control->property("text").toInt(), 12);