VisualMissionItemTest.cc 3.96 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9 10 11 12
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#include "VisualMissionItemTest.h"
#include "SimpleMissionItem.h"
#include "QGCApplication.h"
13
#include "PlanMasterController.h"
14 15 16 17 18 19 20 21 22

VisualMissionItemTest::VisualMissionItemTest(void)
{
    
}

void VisualMissionItemTest::init(void)
{
    UnitTest::init();
23 24 25

    _masterController = new PlanMasterController(MAV_AUTOPILOT_PX4, MAV_TYPE_QUADROTOR, this);
    _controllerVehicle = _masterController->controllerVehicle();
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

    rgVisualItemSignals[altDifferenceChangedIndex] =                        SIGNAL(altDifferenceChanged(double));
    rgVisualItemSignals[altPercentChangedIndex] =                           SIGNAL(altPercentChanged(double));
    rgVisualItemSignals[azimuthChangedIndex] =                              SIGNAL(azimuthChanged(double));
    rgVisualItemSignals[commandDescriptionChangedIndex] =                   SIGNAL(commandDescriptionChanged());
    rgVisualItemSignals[commandNameChangedIndex] =                          SIGNAL(commandNameChanged());
    rgVisualItemSignals[abbreviationChangedIndex] =                         SIGNAL(abbreviationChanged());
    rgVisualItemSignals[coordinateChangedIndex] =                           SIGNAL(coordinateChanged(const QGeoCoordinate&));
    rgVisualItemSignals[exitCoordinateChangedIndex] =                       SIGNAL(exitCoordinateChanged(const QGeoCoordinate&));
    rgVisualItemSignals[dirtyChangedIndex] =                                SIGNAL(dirtyChanged(bool));
    rgVisualItemSignals[distanceChangedIndex] =                             SIGNAL(distanceChanged(double));
    rgVisualItemSignals[isCurrentItemChangedIndex] =                        SIGNAL(isCurrentItemChanged(bool));
    rgVisualItemSignals[sequenceNumberChangedIndex] =                       SIGNAL(sequenceNumberChanged(int));
    rgVisualItemSignals[isSimpleItemChangedIndex] =                         SIGNAL(isSimpleItemChanged(bool));
    rgVisualItemSignals[specifiesCoordinateChangedIndex] =                  SIGNAL(specifiesCoordinateChanged());
    rgVisualItemSignals[isStandaloneCoordinateChangedIndex] =               SIGNAL(isStandaloneCoordinateChanged());
    rgVisualItemSignals[specifiesAltitudeOnlyChangedIndex] =                SIGNAL(specifiesAltitudeOnlyChanged());
    rgVisualItemSignals[specifiedFlightSpeedChangedIndex] =                 SIGNAL(specifiedFlightSpeedChanged());
    rgVisualItemSignals[specifiedGimbalYawChangedIndex] =                   SIGNAL(specifiedGimbalYawChanged());
45
    rgVisualItemSignals[specifiedGimbalPitchChangedIndex] =                 SIGNAL(specifiedGimbalPitchChanged());
46 47 48 49 50 51 52 53 54 55
    rgVisualItemSignals[lastSequenceNumberChangedIndex] =                   SIGNAL(lastSequenceNumberChanged(int));
    rgVisualItemSignals[missionGimbalYawChangedIndex] =                     SIGNAL(missionGimbalYawChanged(double));
    rgVisualItemSignals[missionVehicleYawChangedIndex] =                    SIGNAL(missionVehicleYawChanged(double));
    rgVisualItemSignals[coordinateHasRelativeAltitudeChangedIndex] =        SIGNAL(coordinateHasRelativeAltitudeChanged(bool));
    rgVisualItemSignals[exitCoordinateHasRelativeAltitudeChangedIndex] =    SIGNAL(exitCoordinateHasRelativeAltitudeChanged(bool));
    rgVisualItemSignals[exitCoordinateSameAsEntryChangedIndex] =            SIGNAL(exitCoordinateSameAsEntryChanged(bool));
}

void VisualMissionItemTest::cleanup(void)
{
56
    _masterController->deleteLater();
57 58
    UnitTest::cleanup();
}
59 60 61

void VisualMissionItemTest::_createSpy(SimpleMissionItem* simpleItem, MultiSignalSpy** visualSpy)
{
62
    *visualSpy = nullptr;
63 64 65 66
    MultiSignalSpy* spy = new MultiSignalSpy();
    QCOMPARE(spy->init(simpleItem, rgVisualItemSignals, cVisualItemSignals), true);
    *visualSpy = spy;
}