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 TST_QGEOCODEREPLY_H |
30 | #define TST_QGEOCODEREPLY_H |
31 | |
32 | #include <QtCore/QString> |
33 | #include <QtTest/QtTest> |
34 | #include <QtCore/QCoreApplication> |
35 | #include <QMetaType> |
36 | #include <QSignalSpy> |
37 | |
38 | #include "../utils/qlocationtestutils_p.h" |
39 | |
40 | #include <qgeocodereply.h> |
41 | #include <qgeolocation.h> |
42 | #include <qgeoaddress.h> |
43 | #include <qgeocoordinate.h> |
44 | #include <QtPositioning/QGeoRectangle> |
45 | |
46 | QT_USE_NAMESPACE |
47 | class SubGeocodeReply : public QGeoCodeReply |
48 | { |
49 | Q_OBJECT |
50 | public: |
51 | SubGeocodeReply() : QGeoCodeReply() {} |
52 | |
53 | void callAddLocation ( const QGeoLocation & location ) {addLocation(location);} |
54 | void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);} |
55 | void callSetFinished ( bool finished ) {setFinished(finished);} |
56 | void callSetLimit ( int limit ) {setLimit(limit);} |
57 | void callSetOffset ( int offset ) {setOffset(offset);} |
58 | void callSetLocations ( const QList<QGeoLocation> & locations ) {setLocations(locations);} |
59 | void callSetViewport ( const QGeoShape &viewport ) {setViewport(viewport);} |
60 | |
61 | }; |
62 | |
63 | class tst_QGeoCodeReply :public QObject |
64 | { |
65 | Q_OBJECT |
66 | |
67 | public slots: |
68 | void initTestCase(); |
69 | void cleanupTestCase(); |
70 | void init(); |
71 | void cleanup(); |
72 | |
73 | //Start Unit Test for QGeoCodeReply |
74 | private slots: |
75 | void constructor(); |
76 | void constructor_error(); |
77 | void constructor_error_data(); |
78 | void destructor(); |
79 | void destructor_data(); |
80 | void abort(); |
81 | void error(); |
82 | void error_data(); |
83 | void finished(); |
84 | void limit(); |
85 | void offset(); |
86 | void locations(); |
87 | void viewport(); |
88 | |
89 | //End Unit Test for QGeoCodeReply |
90 | |
91 | |
92 | |
93 | private: |
94 | QSignalSpy *signalerror; |
95 | QSignalSpy *signalfinished; |
96 | SubGeocodeReply* reply; |
97 | QGeoLocation *qgeolocation; |
98 | QGeoRectangle *qgeoboundingbox; |
99 | }; |
100 | |
101 | Q_DECLARE_METATYPE(QList<double>); |
102 | Q_DECLARE_METATYPE(QGeoCodeReply::Error); |
103 | |
104 | #endif // TST_QGEOCODEREPLY_H |
105 | |
106 |