MissionControllerTest.h 3.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/*=====================================================================
 
 QGroundControl Open Source Ground Control Station
 
 (c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 
 This file is part of the QGROUNDCONTROL project
 
 QGROUNDCONTROL is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 QGROUNDCONTROL is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
 
 ======================================================================*/

#ifndef MissionControllerTest_H
#define MissionControllerTest_H

#include "UnitTest.h"
#include "MockLink.h"
#include "MissionManager.h"
#include "MultiSignalSpy.h"
#include "MissionControllerManagerTest.h"
#include "MissionController.h"
33
#include "SimpleMissionItem.h"
34 35 36 37 38 39 40 41 42 43 44 45 46

#include <QGeoCoordinate>

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

private slots:
    void cleanup(void);

Don Gagne's avatar
Don Gagne committed
47 48 49 50
    void _testEmptyVehicleAPM(void);
    void _testEmptyVehiclePX4(void);
    void _testAddWayppointAPM(void);
    void _testAddWayppointPX4(void);
Don Gagne's avatar
Don Gagne committed
51 52
    void _testOfflineToOnlineAPM(void);
    void _testOfflineToOnlinePX4(void);
53 54 55 56 57

private:
    void _initForFirmwareType(MAV_AUTOPILOT firmwareType);
    void _testEmptyVehicleWorker(MAV_AUTOPILOT firmwareType);
    void _testAddWaypointWorker(MAV_AUTOPILOT firmwareType);
Don Gagne's avatar
Don Gagne committed
58
    void _testOfflineToOnlineWorker(MAV_AUTOPILOT firmwareType);
59
    void _setupMissionItemSignals(SimpleMissionItem* item);
Don Gagne's avatar
Don Gagne committed
60

Don Gagne's avatar
Don Gagne committed
61 62 63 64 65 66 67 68 69 70 71 72 73
    // MissiomItems signals

    enum {
        coordinateChangedSignalIndex = 0,
        missionItemMaxSignalIndex
    };

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

    // MissionController signals
74 75

    enum {
76
        visualItemsChangedSignalIndex = 0,
77
        waypointLinesChangedSignalIndex,
Don Gagne's avatar
Don Gagne committed
78
        missionControllerMaxSignalIndex
79 80 81
    };

    enum {
82
        visualItemsChangedSignalMask =                 1 << visualItemsChangedSignalIndex,
Don Gagne's avatar
Don Gagne committed
83
        waypointLinesChangedSignalMask =                1 << waypointLinesChangedSignalIndex,
84 85
    };

Don Gagne's avatar
Don Gagne committed
86 87 88 89 90 91 92
    MultiSignalSpy*     _multiSpyMissionController;
    static const size_t _cMissionControllerSignals = missionControllerMaxSignalIndex;
    const char*         _rgMissionControllerSignals[_cMissionControllerSignals];

    MultiSignalSpy*     _multiSpyMissionItem;
    static const size_t _cMissionItemSignals = missionItemMaxSignalIndex;
    const char*         _rgMissionItemSignals[_cMissionItemSignals];
93 94 95 96 97

    MissionController*  _missionController;
};

#endif