File indexing completed on 2024-04-28 04:42:40
0001 /* 0002 * SPDX-FileCopyrightText: 2020-2021 Han Young <hanyoung@protonmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #include "geotimezonetest.h" 0007 0008 #include <kweathercore/geotimezone.h> 0009 0010 #include <QNetworkAccessManager> 0011 #include <QStandardPaths> 0012 0013 using namespace KWeatherCore; 0014 0015 void GeoTimezoneTest::initTestCase() 0016 { 0017 QStandardPaths::setTestModeEnabled(true); 0018 } 0019 0020 void GeoTimezoneTest::testTimezone() 0021 { 0022 QNetworkAccessManager nam; 0023 GeoTimezone d{&nam, 50, 50}; 0024 QSignalSpy finished_spy{&d, &GeoTimezone::finished}; 0025 0026 // waiting for finished signal for 10 secs 0027 QVERIFY(finished_spy.wait(10000)); 0028 if (d.error() == GeoTimezone::NoError) { 0029 QCOMPARE(d.timezone(), QStringLiteral("Asia/Oral")); 0030 } 0031 } 0032 QTEST_MAIN(GeoTimezoneTest) 0033 0034 #include "moc_geotimezonetest.cpp"