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_QGEOROUTEREPLY_H 30 #define TST_QGEOROUTEREPLY_H 31 32 #include <QtCore/QString> 33 #include <QtTest/QtTest> 34 #include <QMetaType> 35 #include <QSignalSpy> 36 37 #include <qgeocoordinate.h> 38 #include <qgeorouterequest.h> 39 #include <qgeoroutereply.h> 40 #include <qgeoroute.h> 41 42 QT_USE_NAMESPACE 43 class SubRouteReply :public QGeoRouteReply 44 { 45 Q_OBJECT 46 public: SubRouteReply(QGeoRouteRequest request)47 SubRouteReply(QGeoRouteRequest request):QGeoRouteReply(request) {} callSetError(QGeoRouteReply::Error error,QString msg)48 void callSetError(QGeoRouteReply::Error error, QString msg) {setError(error,msg);} callSetFinished(bool finished)49 void callSetFinished(bool finished) {setFinished(finished);} callSetRoutes(const QList<QGeoRoute> & routes)50 void callSetRoutes(const QList<QGeoRoute> & routes ) {setRoutes(routes);} 51 }; 52 53 class tst_QGeoRouteReply :public QObject 54 { 55 Q_OBJECT 56 57 public slots: 58 void initTestCase(); 59 void cleanupTestCase(); 60 void init(); 61 void cleanup(); 62 63 //Start Unit Test for QGeoRouteReply 64 private slots: 65 void constructor(); 66 void constructor_error(); 67 void constructor_error_data(); 68 void destructor(); 69 void destructor_data(); 70 void routes(); 71 void finished(); 72 void abort(); 73 void error(); 74 void error_data(); 75 void request(); 76 //End Unit Test for QGeoRouteReply 77 78 79 private: 80 QGeoCoordinate *qgeocoordinate1; 81 QGeoCoordinate *qgeocoordinate2; 82 QGeoCoordinate *qgeocoordinate3; 83 QGeoRouteRequest *qgeorouterequest; 84 QSignalSpy *signalerror; 85 QSignalSpy *signalfinished; 86 QList<QGeoCoordinate> waypoints; 87 SubRouteReply* reply; 88 }; 89 90 Q_DECLARE_METATYPE( QList<QGeoRoute>); 91 Q_DECLARE_METATYPE( QList<QGeoCoordinate>); 92 Q_DECLARE_METATYPE( QList<double>); 93 Q_DECLARE_METATYPE( QGeoRouteReply::Error); 94 95 #endif // TST_QGEOROUTEREPLY_H 96 97