TransectStyleComplexItemTest.h 3.84 KB
Newer Older
1 2
/****************************************************************************
 *
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9 10 11
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#pragma once

12
#include "TransectStyleComplexItemTestBase.h"
13 14
#include "MultiSignalSpy.h"
#include "CorridorScanComplexItem.h"
15
#include "PlanMasterController.h"
16 17 18

#include <QGeoCoordinate>

19
class TestTransectStyleItem;
20

21
class TransectStyleComplexItemTest : public TransectStyleComplexItemTestBase
22 23 24 25 26 27 28 29 30
{
    Q_OBJECT
    
public:
    TransectStyleComplexItemTest(void);

protected:
    void init(void) final;
    void cleanup(void) final;
31

32
private slots:
33 34 35 36
    void _testDirty             (void);
    void _testRebuildTransects  (void);
    void _testDistanceSignalling(void);
    void _testAltMode           (void);
37
    void _testFollowTerrain     (void);
38 39 40 41 42 43

private:
    enum {
        // These signals are from TransectStyleComplexItem
        cameraShotsChangedIndex = 0,
        timeBetweenShotsChangedIndex,
DonLakeFlyer's avatar
DonLakeFlyer committed
44
        visualTransectPointsChangedIndex,
45 46 47 48 49 50
        coveredAreaChangedIndex,
        // These signals are from ComplexItem
        dirtyChangedIndex,
        complexDistanceChangedIndex,
        greatestDistanceToChangedIndex,
        additionalTimeDelayChangedIndex,
51 52
        // These signals are from VisualMissionItem
        lastSequenceNumberChangedIndex,
53 54 55 56 57
        maxSignalIndex
    };

    enum {
        // These signals are from TransectStyleComplexItem
DonLakeFlyer's avatar
DonLakeFlyer committed
58 59 60 61
        cameraShotsChangedMask =                1 << cameraShotsChangedIndex,
        timeBetweenShotsChangedMask =           1 << timeBetweenShotsChangedIndex,
        visualTransectPointsChangedMask =       1 << visualTransectPointsChangedIndex,
        coveredAreaChangedMask =                1 << coveredAreaChangedIndex,
62
        // These signals are from ComplexItem
DonLakeFlyer's avatar
DonLakeFlyer committed
63 64 65 66
        dirtyChangedMask =                      1 << dirtyChangedIndex,
        complexDistanceChangedMask =            1 << complexDistanceChangedIndex,
        greatestDistanceToChangedMask =         1 << greatestDistanceToChangedIndex,
        additionalTimeDelayChangedMask =        1 << additionalTimeDelayChangedIndex,
67
        // These signals are from VisualMissionItem
DonLakeFlyer's avatar
DonLakeFlyer committed
68
        lastSequenceNumberChangedMask =         1 << lastSequenceNumberChangedIndex,
69 70 71 72 73
    };

    static const size_t _cSignals = maxSignalIndex;
    const char*         _rgSignals[_cSignals];

74 75
    MultiSignalSpy*         _multiSpy =             nullptr;
    TestTransectStyleItem*  _transectStyleItem =    nullptr;
76 77
};

78
class TestTransectStyleItem : public TransectStyleComplexItem
79 80 81 82
{
    Q_OBJECT

public:
83
    TestTransectStyleItem(PlanMasterController* masterController, QObject* parent = nullptr);
84 85

    // Overrides from ComplexMissionItem
86
    QString patternName         (void) const final { return QString(); }
87 88 89 90 91 92
    QString mapVisualQML        (void) const final { return QString(); }
    bool    load                (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) final { Q_UNUSED(complexObject); Q_UNUSED(sequenceNumber); Q_UNUSED(errorString); return false; }

    // Overrides from VisualMissionItem
    void    save                (QJsonArray&  missionItems) final { Q_UNUSED(missionItems); }
    bool    specifiesCoordinate (void) const final { return true; }
93
    double  additionalTimeDelay (void) const final { return 0; }
94

95
    bool rebuildTransectsPhase1Called;
96 97
    bool recalcComplexDistanceCalled;
    bool recalcCameraShotsCalled;
98 99 100 101
    void _adjustSurveAreaPolygon(void);
    QList<QList<CoordInfo_t>> transects() const {
        return _transects;
    }
102

103 104
private slots:
    // Overrides from TransectStyleComplexItem
105 106
    void _rebuildTransectsPhase1    (void) final;
    void _recalcCameraShots         (void) final;
107
};