| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the test suite of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 21 | ** included in the packaging of this file. Please review the following |
| 22 | ** information to ensure the GNU General Public License requirements will |
| 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 24 | ** |
| 25 | ** $QT_END_LICENSE$ |
| 26 | ** |
| 27 | ****************************************************************************/ |
| 28 | |
| 29 | #ifndef TESTQGEOSATELLITEINFOSOURCE_H |
| 30 | #define TESTQGEOSATELLITEINFOSOURCE_H |
| 31 | |
| 32 | #include <QTest> |
| 33 | #include <QObject> |
| 34 | |
| 35 | QT_BEGIN_NAMESPACE |
| 36 | class QGeoSatelliteInfoSource; |
| 37 | QT_END_NAMESPACE |
| 38 | |
| 39 | |
| 40 | class TestQGeoSatelliteInfoSource : public QObject |
| 41 | { |
| 42 | Q_OBJECT |
| 43 | |
| 44 | public: |
| 45 | TestQGeoSatelliteInfoSource(QObject *parent = 0); |
| 46 | |
| 47 | static TestQGeoSatelliteInfoSource *createDefaultSourceTest(); |
| 48 | |
| 49 | protected: |
| 50 | virtual QGeoSatelliteInfoSource *createTestSource() = 0; |
| 51 | |
| 52 | // MUST be called by subclasses if they override respective test slots |
| 53 | void base_initTestCase(); |
| 54 | void base_init(); |
| 55 | void base_cleanup(); |
| 56 | void base_cleanupTestCase(); |
| 57 | |
| 58 | public slots: |
| 59 | void test_slot1(); |
| 60 | void test_slot2(); |
| 61 | |
| 62 | private slots: |
| 63 | void initTestCase(); |
| 64 | void init(); |
| 65 | void cleanup(); |
| 66 | void cleanupTestCase(); |
| 67 | |
| 68 | void constructor_withParent(); |
| 69 | void constructor_noParent(); |
| 70 | |
| 71 | void updateInterval(); |
| 72 | |
| 73 | void setUpdateInterval(); |
| 74 | void setUpdateInterval_data(); |
| 75 | |
| 76 | void minimumUpdateInterval(); |
| 77 | |
| 78 | void createDefaultSource(); |
| 79 | void createDefaultSource_noParent(); |
| 80 | |
| 81 | void startUpdates_testIntervals(); |
| 82 | void startUpdates_testIntervalChangesWhileRunning(); |
| 83 | void startUpdates_testDefaultInterval(); |
| 84 | void startUpdates_testZeroInterval(); |
| 85 | void startUpdates_moreThanOnce(); |
| 86 | void stopUpdates(); |
| 87 | void stopUpdates_withoutStart(); |
| 88 | |
| 89 | void requestUpdate(); |
| 90 | void requestUpdate_data(); |
| 91 | |
| 92 | void requestUpdate_validTimeout(); |
| 93 | void requestUpdate_defaultTimeout(); |
| 94 | void requestUpdate_timeoutLessThanMinimumInterval(); |
| 95 | void requestUpdate_repeatedCalls(); |
| 96 | void requestUpdate_overlappingCalls(); |
| 97 | void requestUpdate_overlappingCallsWithTimeout(); |
| 98 | |
| 99 | void requestUpdateAfterStartUpdates_ZeroInterval(); |
| 100 | void requestUpdateAfterStartUpdates_SmallInterval(); |
| 101 | void requestUpdateBeforeStartUpdates_ZeroInterval(); |
| 102 | void requestUpdateBeforeStartUpdates_SmallInterval(); |
| 103 | |
| 104 | void removeSlotForRequestTimeout(); |
| 105 | void removeSlotForSatellitesInUseUpdated(); |
| 106 | void removeSlotForSatellitesInViewUpdated(); |
| 107 | |
| 108 | private: |
| 109 | QGeoSatelliteInfoSource *m_source; |
| 110 | bool m_testingDefaultSource; |
| 111 | bool m_testSlot2Called; |
| 112 | }; |
| 113 | |
| 114 | #endif // #ifndef TESTQGEOSATELLITEINFOSOURCE_H |
| 115 | |