File indexing completed on 2024-04-28 16:01:12

0001 /*
0002  * SPDX-FileCopyrightText: 2020-2021 Han Young <hanyoung@protonmail.com>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 #include "pendingweatherforecasttest.h"
0007 
0008 void PendingWeatherForecastTest::initTestCase()
0009 {
0010     p = d.requestData(50, 50);
0011 
0012     finished_spy = new QSignalSpy(p, &PendingWeatherForecast::finished);
0013     networkError_spy = new QSignalSpy(p, &PendingWeatherForecast::networkError);
0014 }
0015 
0016 void PendingWeatherForecastTest::testFetch()
0017 {
0018     auto ret = finished_spy->wait(30000);
0019 
0020     if (ret) {
0021         QVERIFY(p->value()->dailyWeatherForecast().size() > 0);
0022     } else {
0023         QVERIFY(networkError_spy->size() > 0);
0024     }
0025 }
0026 QTEST_MAIN(PendingWeatherForecastTest)