MissionControllerTest.h 2.49 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);

34 35 36
    void _testGimbalRecalc(void);

private:
Don Gagne's avatar
Don Gagne committed
37 38 39 40
    void _testEmptyVehicleAPM(void);
    void _testEmptyVehiclePX4(void);
    void _testAddWayppointAPM(void);
    void _testAddWayppointPX4(void);
Don Gagne's avatar
Don Gagne committed
41 42
    void _testOfflineToOnlineAPM(void);
    void _testOfflineToOnlinePX4(void);
43 44 45 46 47

private:
    void _initForFirmwareType(MAV_AUTOPILOT firmwareType);
    void _testEmptyVehicleWorker(MAV_AUTOPILOT firmwareType);
    void _testAddWaypointWorker(MAV_AUTOPILOT firmwareType);
Don Gagne's avatar
Don Gagne committed
48
    void _testOfflineToOnlineWorker(MAV_AUTOPILOT firmwareType);
Don Gagne's avatar
Don Gagne committed
49
    void _setupVisualItemSignals(VisualMissionItem* visualItem);
Don Gagne's avatar
Don Gagne committed
50

Don Gagne's avatar
Don Gagne committed
51 52 53 54
    // MissiomItems signals

    enum {
        coordinateChangedSignalIndex = 0,
Don Gagne's avatar
Don Gagne committed
55
        visualItemMaxSignalIndex
Don Gagne's avatar
Don Gagne committed
56 57 58
    };

    enum {
Don Gagne's avatar
Don Gagne committed
59 60
        coordinateChangedSignalMask =   1 << coordinateChangedSignalIndex,
        visualItemMaxSignalMask =       1 << visualItemMaxSignalIndex,
Don Gagne's avatar
Don Gagne committed
61 62 63
    };

    // MissionController signals
64 65

    enum {
66
        visualItemsChangedSignalIndex = 0,
67
        waypointLinesChangedSignalIndex,
Don Gagne's avatar
Don Gagne committed
68
        missionControllerMaxSignalIndex
69 70 71
    };

    enum {
72
        visualItemsChangedSignalMask =                 1 << visualItemsChangedSignalIndex,
Don Gagne's avatar
Don Gagne committed
73
        waypointLinesChangedSignalMask =                1 << waypointLinesChangedSignalIndex,
74 75
    };

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

    MultiSignalSpy*     _multiSpyMissionItem;
Don Gagne's avatar
Don Gagne committed
81 82
    static const size_t _cVisualItemSignals = visualItemMaxSignalIndex;
    const char*         _rgVisualItemSignals[_cVisualItemSignals];
83 84 85 86 87

    MissionController*  _missionController;
};

#endif