File indexing completed on 2024-05-05 04:20:55

0001 /*
0002  * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa <vhanda@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 
0007 #include <QDebug>
0008 #include <QSignalSpy>
0009 #include <QTest>
0010 
0011 #include <QCoreApplication>
0012 #include <QTime>
0013 
0014 #include "reversegeocoder.h"
0015 
0016 class ReverseGeoCoderTest : public QObject
0017 {
0018     Q_OBJECT
0019 
0020 private slots:
0021     void testSimple();
0022 };
0023 
0024 using namespace Koko;
0025 
0026 void ReverseGeoCoderTest::testSimple()
0027 {
0028     QCoreApplication::instance()->setApplicationName("koko");
0029 
0030     ReverseGeoCoder coder;
0031     QCOMPARE(coder.initialized(), false);
0032     coder.init();
0033     QCOMPARE(coder.initialized(), true);
0034 
0035     double lat = 52.54877605;
0036     double lon = -1.81627023283164;
0037 
0038     QVariantMap data = coder.lookup(lat, lon);
0039     QCOMPARE(data.value("country").toString(), QString("United Kingdom"));
0040     QCOMPARE(data.value("admin1").toString(), QString("England"));
0041     QCOMPARE(data.value("admin2").toString(), QString("City and Borough of Birmingham"));
0042 }
0043 
0044 QTEST_MAIN(ReverseGeoCoderTest)
0045 
0046 #include "reversegeocodertest.moc"