MissionControllerTest.h 2.65 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
    void _testGimbalRecalc(void);
36
    void _testLoadJsonSectionAvailable(void);
Don Gagne's avatar
Don Gagne committed
37 38 39 40
    void _testEmptyVehicleAPM(void);
    void _testEmptyVehiclePX4(void);
    void _testAddWayppointAPM(void);
    void _testAddWayppointPX4(void);
41 42

private:
43
#if 0
Don Gagne's avatar
Don Gagne committed
44 45
    void _testOfflineToOnlineAPM(void);
    void _testOfflineToOnlinePX4(void);
46
#endif
47 48 49 50 51

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

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

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

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

    // MissionController signals
70 71

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

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

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

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

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

#endif