MissionControllerTest.h 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (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.
 *
 ****************************************************************************/

10 11 12 13 14 15 16 17 18

#ifndef MissionControllerTest_H
#define MissionControllerTest_H

#include "UnitTest.h"
#include "MockLink.h"
#include "MissionManager.h"
#include "MultiSignalSpy.h"
#include "MissionControllerManagerTest.h"
19
#include "PlanMasterController.h"
20
#include "MissionController.h"
21
#include "SimpleMissionItem.h"
22 23 24 25 26 27 28 29 30 31 32 33 34

#include <QGeoCoordinate>

class MissionControllerTest : public MissionControllerManagerTest
{
    Q_OBJECT
    
public:
    MissionControllerTest(void);

private slots:
    void cleanup(void);

35 36 37
    void _testGimbalRecalc(void);

private:
Don Gagne's avatar
Don Gagne committed
38 39 40 41
    void _testEmptyVehicleAPM(void);
    void _testEmptyVehiclePX4(void);
    void _testAddWayppointAPM(void);
    void _testAddWayppointPX4(void);
42
#if 0
Don Gagne's avatar
Don Gagne committed
43 44
    void _testOfflineToOnlineAPM(void);
    void _testOfflineToOnlinePX4(void);
45
#endif
46 47 48 49 50

private:
    void _initForFirmwareType(MAV_AUTOPILOT firmwareType);
    void _testEmptyVehicleWorker(MAV_AUTOPILOT firmwareType);
    void _testAddWaypointWorker(MAV_AUTOPILOT firmwareType);
51
#if 0
Don Gagne's avatar
Don Gagne committed
52
    void _testOfflineToOnlineWorker(MAV_AUTOPILOT firmwareType);
53
#endif
Don Gagne's avatar
Don Gagne committed
54
    void _setupVisualItemSignals(VisualMissionItem* visualItem);
Don Gagne's avatar
Don Gagne committed
55

Don Gagne's avatar
Don Gagne committed
56 57 58 59
    // MissiomItems signals

    enum {
        coordinateChangedSignalIndex = 0,
Don Gagne's avatar
Don Gagne committed
60
        visualItemMaxSignalIndex
Don Gagne's avatar
Don Gagne committed
61 62 63
    };

    enum {
Don Gagne's avatar
Don Gagne committed
64 65
        coordinateChangedSignalMask =   1 << coordinateChangedSignalIndex,
        visualItemMaxSignalMask =       1 << visualItemMaxSignalIndex,
Don Gagne's avatar
Don Gagne committed
66 67 68
    };

    // MissionController signals
69 70

    enum {
71
        visualItemsChangedSignalIndex = 0,
72
        waypointLinesChangedSignalIndex,
Don Gagne's avatar
Don Gagne committed
73
        missionControllerMaxSignalIndex
74 75 76
    };

    enum {
77
        visualItemsChangedSignalMask =                 1 << visualItemsChangedSignalIndex,
Don Gagne's avatar
Don Gagne committed
78
        waypointLinesChangedSignalMask =                1 << waypointLinesChangedSignalIndex,
79 80
    };

Don Gagne's avatar
Don Gagne committed
81 82 83 84 85
    MultiSignalSpy*     _multiSpyMissionController;
    static const size_t _cMissionControllerSignals = missionControllerMaxSignalIndex;
    const char*         _rgMissionControllerSignals[_cMissionControllerSignals];

    MultiSignalSpy*     _multiSpyMissionItem;
Don Gagne's avatar
Don Gagne committed
86 87
    static const size_t _cVisualItemSignals = visualItemMaxSignalIndex;
    const char*         _rgVisualItemSignals[_cVisualItemSignals];
88

89 90
    PlanMasterController*   _masterController;
    MissionController*      _missionController;
91 92 93
};

#endif