MissionControllerTest.h 2.47 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 19

#ifndef MissionControllerTest_H
#define MissionControllerTest_H

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

#include <QGeoCoordinate>

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

private slots:
    void cleanup(void);

Don Gagne's avatar
Don Gagne committed
34 35 36 37
    void _testEmptyVehicleAPM(void);
    void _testEmptyVehiclePX4(void);
    void _testAddWayppointAPM(void);
    void _testAddWayppointPX4(void);
Don Gagne's avatar
Don Gagne committed
38 39
    void _testOfflineToOnlineAPM(void);
    void _testOfflineToOnlinePX4(void);
40 41 42 43 44

private:
    void _initForFirmwareType(MAV_AUTOPILOT firmwareType);
    void _testEmptyVehicleWorker(MAV_AUTOPILOT firmwareType);
    void _testAddWaypointWorker(MAV_AUTOPILOT firmwareType);
Don Gagne's avatar
Don Gagne committed
45
    void _testOfflineToOnlineWorker(MAV_AUTOPILOT firmwareType);
46
    void _setupMissionItemSignals(SimpleMissionItem* item);
Don Gagne's avatar
Don Gagne committed
47

Don Gagne's avatar
Don Gagne committed
48 49 50 51 52 53 54 55 56 57 58 59 60
    // MissiomItems signals

    enum {
        coordinateChangedSignalIndex = 0,
        missionItemMaxSignalIndex
    };

    enum {
        coordinateChangedSignalMask =           1 << coordinateChangedSignalIndex,
        missionItemMaxSignalMask =              1 << missionItemMaxSignalIndex,
    };

    // MissionController signals
61 62

    enum {
63
        visualItemsChangedSignalIndex = 0,
64
        waypointLinesChangedSignalIndex,
Don Gagne's avatar
Don Gagne committed
65
        missionControllerMaxSignalIndex
66 67 68
    };

    enum {
69
        visualItemsChangedSignalMask =                 1 << visualItemsChangedSignalIndex,
Don Gagne's avatar
Don Gagne committed
70
        waypointLinesChangedSignalMask =                1 << waypointLinesChangedSignalIndex,
71 72
    };

Don Gagne's avatar
Don Gagne committed
73 74 75 76 77 78 79
    MultiSignalSpy*     _multiSpyMissionController;
    static const size_t _cMissionControllerSignals = missionControllerMaxSignalIndex;
    const char*         _rgMissionControllerSignals[_cMissionControllerSignals];

    MultiSignalSpy*     _multiSpyMissionItem;
    static const size_t _cMissionItemSignals = missionItemMaxSignalIndex;
    const char*         _rgMissionItemSignals[_cMissionItemSignals];
80 81 82 83 84

    MissionController*  _missionController;
};

#endif