83
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Symbian Foundation License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: TimeZoneClient unit test class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
|
19 |
#include <QtTest/QtTest>
|
|
20 |
|
|
21 |
// User includes
|
|
22 |
#include "timezoneclient.h"
|
|
23 |
#include "clockdatatypes.h"
|
|
24 |
/*!
|
|
25 |
\class TestTimeZoneClient
|
|
26 |
|
|
27 |
This object has functions to test the public apis in the class
|
|
28 |
TimeZoneClient.
|
|
29 |
*/
|
|
30 |
class TestTimezoneClient: public QObject
|
|
31 |
{
|
|
32 |
Q_OBJECT
|
|
33 |
|
|
34 |
private slots:
|
|
35 |
// Test case setup.
|
|
36 |
void init();
|
|
37 |
void cleanup();
|
|
38 |
|
|
39 |
// Test cases.
|
|
40 |
void testGetLocations();
|
|
41 |
void testGetCurrentZoneInfoL();
|
|
42 |
void testSetAsCurrentLocation();
|
|
43 |
void testSetAsCurrentLocationWithDst();
|
|
44 |
void testIsDSTOnL();
|
|
45 |
void testGetStandardOffset();
|
|
46 |
void testTimeUpdateOn();
|
|
47 |
void testSetTimeUpdateOn();
|
|
48 |
void testSetDateTime();
|
|
49 |
void testGetAllTimeZoneOffsets();
|
|
50 |
void testGetCountriesForUTCOffset();
|
|
51 |
void testAddCity();
|
|
52 |
void testCheckForDstChange();
|
|
53 |
void testGetSavedLocations();
|
|
54 |
void testSaveLocations();
|
|
55 |
//void testGetLocationInfo();
|
|
56 |
//void testGetCityGroupIdByName();
|
|
57 |
//void testGetCityOffsetByNameAndId();
|
|
58 |
private:
|
|
59 |
void doCleanup();
|
|
60 |
private:
|
|
61 |
TimezoneClient *mTimezoneClient;
|
|
62 |
int mError;
|
|
63 |
};
|
|
64 |
|
|
65 |
/*!
|
|
66 |
This function will be called before each testfunction is executed.
|
|
67 |
*/
|
|
68 |
void TestTimezoneClient::init()
|
|
69 |
{
|
|
70 |
TRAPD(mError, mTimezoneClient = TimezoneClient::getInstance());
|
|
71 |
Q_UNUSED(mError)
|
|
72 |
|
|
73 |
Q_ASSERT(!mError);
|
|
74 |
Q_ASSERT(mTimezoneClient);
|
|
75 |
}
|
|
76 |
|
|
77 |
/*!
|
|
78 |
This function will be called after every testfunction.
|
|
79 |
*/
|
|
80 |
void TestTimezoneClient::cleanup()
|
|
81 |
{
|
|
82 |
if (!mTimezoneClient->isNull()) {
|
|
83 |
mTimezoneClient->deleteInstance();
|
|
84 |
}
|
|
85 |
}
|
|
86 |
|
|
87 |
/*!
|
|
88 |
Tests the api TimeZoneClient::getLocations
|
|
89 |
*/
|
|
90 |
void TestTimezoneClient::testGetLocations()
|
|
91 |
{
|
|
92 |
QList<LocationInfo> locationList = mTimezoneClient->getLocations();
|
|
93 |
QVERIFY(0 < locationList.count());
|
|
94 |
}
|
|
95 |
|
|
96 |
/*!
|
|
97 |
Tests the api TestTimezoneClient::getCurrentZoneInfoL
|
|
98 |
*/
|
|
99 |
void TestTimezoneClient::testGetCurrentZoneInfoL()
|
|
100 |
{
|
|
101 |
//LocationInfo testLocationInfo = {"Canada", "Toronto", "", -300, 1528, true};
|
|
102 |
|
|
103 |
LocationInfo testLocationInfo = {"India", "Chennai", "", 330, 1944, 45, false};
|
|
104 |
mTimezoneClient->setAsCurrentLocationL(testLocationInfo);
|
|
105 |
LocationInfo retrievedLocationInfo;
|
|
106 |
retrievedLocationInfo = mTimezoneClient->getCurrentZoneInfoL();
|
|
107 |
|
|
108 |
// Check the location info set with retrieved info.
|
|
109 |
QString temp = retrievedLocationInfo.countryName;
|
|
110 |
temp = retrievedLocationInfo.cityName;
|
|
111 |
QVERIFY(testLocationInfo.countryName == retrievedLocationInfo.countryName);
|
|
112 |
QVERIFY(testLocationInfo.cityName == retrievedLocationInfo.cityName);
|
|
113 |
QVERIFY(testLocationInfo.timezoneId == retrievedLocationInfo.timezoneId);
|
|
114 |
}
|
|
115 |
|
|
116 |
/*!
|
|
117 |
Tests the api TestTimezoneClient::setAsCurrentLocation.
|
|
118 |
*/
|
|
119 |
void TestTimezoneClient::testSetAsCurrentLocation()
|
|
120 |
{
|
|
121 |
LocationInfo testLocationInfo = {"India", "Kolkata", "", 330, 1944, false};
|
|
122 |
mTimezoneClient->setAsCurrentLocationL(testLocationInfo);
|
|
123 |
LocationInfo retrievedLocationInfo;
|
|
124 |
retrievedLocationInfo = mTimezoneClient->getCurrentZoneInfoL();
|
|
125 |
|
|
126 |
// Check the location info set with retrieved info.
|
|
127 |
QVERIFY(testLocationInfo.countryName == retrievedLocationInfo.countryName);
|
|
128 |
QVERIFY(testLocationInfo.cityName == retrievedLocationInfo.cityName);
|
|
129 |
QVERIFY(testLocationInfo.listImageName
|
|
130 |
== retrievedLocationInfo.listImageName);
|
|
131 |
QVERIFY(testLocationInfo.zoneOffset == retrievedLocationInfo.zoneOffset);
|
|
132 |
QVERIFY(testLocationInfo.timezoneId == retrievedLocationInfo.timezoneId);
|
|
133 |
QVERIFY(testLocationInfo.dstOn == retrievedLocationInfo.dstOn);
|
|
134 |
}
|
|
135 |
|
|
136 |
/*!
|
|
137 |
Tests the api TimeZoneClient::dstOn.
|
|
138 |
*/
|
|
139 |
void TestTimezoneClient::testSetAsCurrentLocationWithDst()
|
|
140 |
{
|
|
141 |
//QDateTime currentDateTime(QDate(2009, 05, 15), QTime(12, 30));
|
|
142 |
//QDateTime currentDateTime(QDate(2010, 03, 28), QTime(4, 0));
|
|
143 |
QDateTime currentDateTime(QDate(2010, 03, 31), QTime(8, 30));
|
|
144 |
mTimezoneClient->setDateTime(currentDateTime);
|
|
145 |
LocationInfo testLocationInfo = {"Finland", "Helsinki", "", 180, 2760, 33,
|
|
146 |
true};
|
|
147 |
mTimezoneClient->setAsCurrentLocationL(testLocationInfo);
|
|
148 |
LocationInfo retrievedLocationInfo;
|
|
149 |
retrievedLocationInfo = mTimezoneClient->getCurrentZoneInfoL();
|
|
150 |
|
|
151 |
// Check the location info set with retrieved info.
|
|
152 |
QVERIFY(testLocationInfo.countryName == retrievedLocationInfo.countryName);
|
|
153 |
QVERIFY(testLocationInfo.cityName == retrievedLocationInfo.cityName);
|
|
154 |
QVERIFY(testLocationInfo.listImageName
|
|
155 |
== retrievedLocationInfo.listImageName);
|
|
156 |
QVERIFY(testLocationInfo.zoneOffset == retrievedLocationInfo.zoneOffset);
|
|
157 |
QVERIFY(testLocationInfo.timezoneId == retrievedLocationInfo.timezoneId);
|
|
158 |
QVERIFY(testLocationInfo.dstOn == retrievedLocationInfo.dstOn);
|
|
159 |
}
|
|
160 |
|
|
161 |
/*!
|
|
162 |
Tests the api TestTimezoneClient::isDSTOnL
|
|
163 |
*/
|
|
164 |
void TestTimezoneClient::testIsDSTOnL()
|
|
165 |
{
|
|
166 |
LocationInfo testLocationInfo =
|
|
167 |
{"Finland", "Helsinki", "", 180, 2760, 33, true};
|
|
168 |
mTimezoneClient->setAsCurrentLocationL(testLocationInfo);
|
|
169 |
QDateTime dstOnDate(QDate(2010, 03, 31), QTime(8, 30));
|
|
170 |
mTimezoneClient->setDateTime(dstOnDate);
|
|
171 |
QVERIFY(true == mTimezoneClient->isDSTOnL(2760));
|
|
172 |
|
|
173 |
QDateTime dstOffDate(QDate(2010, 03, 27), QTime(8, 30));
|
|
174 |
mTimezoneClient->setDateTime(dstOffDate);
|
|
175 |
QVERIFY(false == mTimezoneClient->isDSTOnL(2760));
|
|
176 |
|
|
177 |
LocationInfo testLocationInfo1 = {"India", "Kolkata", "", 330, 1944, false};
|
|
178 |
mTimezoneClient->setAsCurrentLocationL(testLocationInfo1);
|
|
179 |
QVERIFY(false == mTimezoneClient->isDSTOnL(1944));
|
|
180 |
}
|
|
181 |
|
|
182 |
/*!
|
|
183 |
Tests the api TimeZoneClient::getStandardOffset
|
|
184 |
*/
|
|
185 |
void TestTimezoneClient::testGetStandardOffset()
|
|
186 |
{
|
|
187 |
// For India
|
|
188 |
int expectedOffset = 330;
|
|
189 |
int offset = mTimezoneClient->getStandardOffset(1944);
|
|
190 |
QVERIFY(expectedOffset == offset);
|
|
191 |
|
|
192 |
// For London
|
|
193 |
expectedOffset = 345;
|
|
194 |
offset = mTimezoneClient->getStandardOffset(1936);
|
|
195 |
QVERIFY(expectedOffset == offset);
|
|
196 |
}
|
|
197 |
|
|
198 |
/*!
|
|
199 |
Tests the api TimeZoneClient::timeUpdateOn
|
|
200 |
*/
|
|
201 |
void TestTimezoneClient::testTimeUpdateOn()
|
|
202 |
{
|
|
203 |
mTimezoneClient->setTimeUpdateOn(true);
|
|
204 |
QVERIFY(true == mTimezoneClient->timeUpdateOn());
|
|
205 |
mTimezoneClient->setTimeUpdateOn(false);
|
|
206 |
QVERIFY(false == mTimezoneClient->timeUpdateOn());
|
|
207 |
}
|
|
208 |
|
|
209 |
/*!
|
|
210 |
Tests the api TimeZoneClient::timeUpdateOn
|
|
211 |
*/
|
|
212 |
void TestTimezoneClient::testSetTimeUpdateOn()
|
|
213 |
{
|
|
214 |
bool timeUpdate = mTimezoneClient->timeUpdateOn();
|
|
215 |
mTimezoneClient->setTimeUpdateOn(!timeUpdate);
|
|
216 |
|
|
217 |
QVERIFY(timeUpdate != mTimezoneClient->timeUpdateOn());
|
|
218 |
}
|
|
219 |
|
|
220 |
/*!
|
|
221 |
Tests the api TimeZoneClient::setDateTime
|
|
222 |
*/
|
|
223 |
void TestTimezoneClient::testSetDateTime()
|
|
224 |
{
|
|
225 |
QDateTime currentDateTime = QDateTime::currentDateTime();
|
|
226 |
|
|
227 |
QDateTime expectedDateTime1 = currentDateTime.addDays(10).addSecs(3600);
|
|
228 |
mTimezoneClient->setDateTime(expectedDateTime1);
|
|
229 |
QVERIFY(currentDateTime.date() != QDate::currentDate());
|
|
230 |
QVERIFY(currentDateTime.time().toString("hh:mm ap") != QTime::currentTime().toString("hh:mm ap"));
|
|
231 |
QVERIFY(expectedDateTime1.date() == QDate::currentDate());
|
|
232 |
QVERIFY(expectedDateTime1.time().toString("hh:mm ap") == QTime::currentTime().toString("hh:mm ap"));
|
|
233 |
|
|
234 |
QDateTime expectedDateTime2 = currentDateTime.addDays(100).addSecs(7200);
|
|
235 |
|
|
236 |
mTimezoneClient->setDateTime(expectedDateTime2);
|
|
237 |
QVERIFY(expectedDateTime2.date() == QDate::currentDate());
|
|
238 |
QVERIFY(expectedDateTime2.time().toString("hh:mm ap") == QTime::currentTime().toString("hh:mm ap"));
|
|
239 |
}
|
|
240 |
|
|
241 |
/*!
|
|
242 |
Tests the api TimeZoneClient::getAllTimeZoneOffsets
|
|
243 |
*/
|
|
244 |
void TestTimezoneClient::testGetAllTimeZoneOffsets()
|
|
245 |
{
|
|
246 |
int indiaOffset = 330;
|
|
247 |
QList<int> offsetList = mTimezoneClient->getAllTimeZoneOffsets();
|
|
248 |
QVERIFY(offsetList.count());
|
|
249 |
QVERIFY(offsetList.contains(indiaOffset));
|
|
250 |
}
|
|
251 |
|
|
252 |
/*!
|
|
253 |
Tests the api TimeZoneClient::getCountriesForUTCOffset
|
|
254 |
*/
|
|
255 |
void TestTimezoneClient::testGetCountriesForUTCOffset()
|
|
256 |
{
|
|
257 |
int offset = 330;
|
|
258 |
QList<QString> expectedList;
|
|
259 |
expectedList.append("India");
|
|
260 |
expectedList.append("Sri Lanka");
|
|
261 |
QList<LocationInfo> countryList =
|
|
262 |
mTimezoneClient->getCountriesForUTCOffset(offset);
|
|
263 |
int count = countryList.count();
|
|
264 |
QVERIFY(expectedList.count() == count);
|
|
265 |
|
|
266 |
QList<QString> nameList;
|
|
267 |
for(int i = 0; i < count; i++) {
|
|
268 |
nameList.append(countryList[i].countryName);
|
|
269 |
}
|
|
270 |
for(int i = 0; i < count; i++) {
|
|
271 |
QVERIFY(nameList.contains(expectedList[i]));
|
|
272 |
}
|
|
273 |
|
|
274 |
// TODO: // Add negative
|
|
275 |
offset = -12;
|
|
276 |
countryList.clear();
|
|
277 |
countryList = mTimezoneClient->getCountriesForUTCOffset(offset);
|
|
278 |
QVERIFY(!countryList.count());
|
|
279 |
}
|
|
280 |
|
|
281 |
/*!
|
|
282 |
Tests the api TimeZoneClient::addCity
|
|
283 |
*/
|
|
284 |
void TestTimezoneClient::testAddCity()
|
|
285 |
{
|
|
286 |
QString cityName("Cochin");
|
|
287 |
LocationInfo newLocInfo;
|
|
288 |
TRAPD(err, newLocInfo = mTimezoneClient->addCity(1944, cityName, 45));
|
|
289 |
if(err == KErrAlreadyExists) {
|
|
290 |
// City is already existing.
|
|
291 |
}
|
|
292 |
QList<LocationInfo> &list = mTimezoneClient->getLocations();
|
|
293 |
QList<QString> nameList;
|
|
294 |
for(int i = 0; i < list.count(); i++) {
|
|
295 |
nameList.append(list[i].cityName);
|
|
296 |
}
|
|
297 |
QVERIFY(nameList.contains(cityName));
|
|
298 |
}
|
|
299 |
|
|
300 |
/*!
|
|
301 |
Tests the api TimeZoneClient::checkForDstChange
|
|
302 |
*/
|
|
303 |
void TestTimezoneClient::testCheckForDstChange()
|
|
304 |
{
|
|
305 |
LocationInfo testLocationInfo =
|
|
306 |
{"Finland", "Helsinki", "", 180, 2760, 33, true};
|
|
307 |
mTimezoneClient->setAsCurrentLocationL(testLocationInfo);
|
|
308 |
// Finland, Helsinki
|
|
309 |
// DST started on Sunday, 28 March 2010, 03:00 local standard time
|
|
310 |
// DST ends on Sunday, 31 October 2010, 04:00 local daylight time
|
|
311 |
QDateTime dstOnDate(QDate(2010, 10, 31), QTime(3, 45));
|
|
312 |
mTimezoneClient->setDateTime(dstOnDate);
|
|
313 |
mTimezoneClient->setAsCurrentLocationL(testLocationInfo);
|
|
314 |
|
|
315 |
AlarmInfo alarmDetails;
|
|
316 |
alarmDetails.origAlarmTime = QTime::currentTime().addSecs(3600);
|
|
317 |
alarmDetails.alarmDateTime = QDate::currentDate();
|
|
318 |
alarmDetails.repeatType = AlarmRepeatType(0);
|
|
319 |
alarmDetails.alarmDay = 1;
|
|
320 |
bool dstChange = mTimezoneClient->checkForDstChange(alarmDetails);
|
|
321 |
QVERIFY(dstChange == true);
|
|
322 |
|
|
323 |
QDateTime dstOffDate(QDate(2010, 10, 31), QTime(04, 01));
|
|
324 |
mTimezoneClient->setDateTime(dstOffDate);
|
|
325 |
AlarmInfo alarmDetails1;
|
|
326 |
alarmDetails1.origAlarmTime = QTime::currentTime().addSecs(3600);
|
|
327 |
alarmDetails1.alarmDateTime = QDate::currentDate();
|
|
328 |
alarmDetails1.repeatType = AlarmRepeatType(0);
|
|
329 |
alarmDetails1.alarmDay = 1;
|
|
330 |
dstChange = mTimezoneClient->checkForDstChange(alarmDetails1);
|
|
331 |
QVERIFY(dstChange == false);
|
|
332 |
|
|
333 |
LocationInfo testLocationInfo1 =
|
|
334 |
{"India", "Chennai", "", 330, 1944, 45, false};
|
|
335 |
mTimezoneClient->setAsCurrentLocationL(testLocationInfo1);
|
|
336 |
mTimezoneClient->setDateTime(dstOnDate);
|
|
337 |
mTimezoneClient->setAsCurrentLocationL(testLocationInfo1);
|
|
338 |
dstChange = mTimezoneClient->checkForDstChange(alarmDetails1);
|
|
339 |
QVERIFY(dstChange == false);
|
|
340 |
}
|
|
341 |
|
|
342 |
/*!
|
|
343 |
Tests the api TimeZoneClient::getSavedLocations
|
|
344 |
*/
|
|
345 |
void TestTimezoneClient::testGetSavedLocations()
|
|
346 |
{
|
|
347 |
doCleanup();
|
|
348 |
mTimezoneClient->setDateTime(QDateTime(QDate(2010, 8, 15), QTime(9,30)));
|
|
349 |
|
|
350 |
QList<LocationInfo> locationList = mTimezoneClient->getSavedLocations();
|
|
351 |
int firstcount = locationList.count();
|
|
352 |
LocationInfo testLocationInfo1 = {"Japan", "Tokyo", "", 540, 2192, 53,
|
|
353 |
false};
|
|
354 |
QList<LocationInfo> testList;
|
|
355 |
testList << testLocationInfo1;
|
|
356 |
mTimezoneClient->saveLocations(testList);
|
|
357 |
|
|
358 |
locationList.clear();
|
|
359 |
locationList = mTimezoneClient->getSavedLocations();
|
|
360 |
int cnt = locationList.count();
|
|
361 |
QVERIFY((firstcount + 1) == locationList.count());
|
|
362 |
|
|
363 |
QList<QString> nameList;
|
|
364 |
int index = 0;
|
|
365 |
for(int i = 0; i < locationList.count(); i++) {
|
|
366 |
if(testLocationInfo1.countryName == locationList[i].countryName) {
|
|
367 |
index = i;
|
|
368 |
}
|
|
369 |
}
|
|
370 |
QVERIFY(testLocationInfo1.countryName == locationList[index].countryName);
|
|
371 |
QVERIFY(testLocationInfo1.cityName == locationList[index].cityName);
|
|
372 |
QVERIFY(testLocationInfo1.listImageName
|
|
373 |
== locationList[index].listImageName);
|
|
374 |
QVERIFY(testLocationInfo1.zoneOffset == locationList[index].zoneOffset);
|
|
375 |
QVERIFY(testLocationInfo1.timezoneId == locationList[index].timezoneId);
|
|
376 |
QVERIFY(testLocationInfo1.dstOn == locationList[index].dstOn);
|
|
377 |
|
|
378 |
LocationInfo testLocationInfo2 = {"Singapore", "Singapore", "", 480, 2144, 87, false};
|
|
379 |
LocationInfo testLocationInfo3 = {"Finland", "Helsinki", "", 180, 2760, 33, true};
|
|
380 |
testList << testLocationInfo2
|
|
381 |
<< testLocationInfo3;
|
|
382 |
mTimezoneClient->saveLocations(testList);
|
|
383 |
locationList.clear();
|
|
384 |
locationList = mTimezoneClient->getSavedLocations();
|
|
385 |
QVERIFY((firstcount + 3) == locationList.count());
|
|
386 |
doCleanup();
|
|
387 |
|
|
388 |
}
|
|
389 |
|
|
390 |
/*!
|
|
391 |
Tests the api TimeZoneClient::saveLocations.
|
|
392 |
*/
|
|
393 |
void TestTimezoneClient::testSaveLocations()
|
|
394 |
{
|
|
395 |
doCleanup();
|
|
396 |
LocationInfo testLocationInfo = {"India", "Kolkata", "", 330, 1944, 45, false};
|
|
397 |
QList<LocationInfo> testList;
|
|
398 |
testList << testLocationInfo;
|
|
399 |
mTimezoneClient->saveLocations(testList);
|
|
400 |
QList<LocationInfo> resultantList = mTimezoneClient->getSavedLocations();
|
|
401 |
|
|
402 |
// Check the location info saved with retrieved info.
|
|
403 |
QVERIFY(resultantList.at(0).countryName == testList.at(0).countryName);
|
|
404 |
QVERIFY(resultantList.at(0).cityName == testList.at(0).cityName);
|
|
405 |
QVERIFY(resultantList.at(0).listImageName == testList.at(0).listImageName);
|
|
406 |
QVERIFY(resultantList.at(0).zoneOffset == testList.at(0).zoneOffset);
|
|
407 |
QVERIFY(resultantList.at(0).timezoneId == testList.at(0).timezoneId);
|
|
408 |
QVERIFY(resultantList.at(0).dstOn == testList.at(0).dstOn);
|
|
409 |
doCleanup();
|
|
410 |
}
|
|
411 |
void TestTimezoneClient::doCleanup()
|
|
412 |
{
|
|
413 |
// Cleanup
|
|
414 |
QString fileName("c:\\data\\clock\\cityInfo.dat");
|
|
415 |
QFile cityInfoFile(fileName);
|
|
416 |
cityInfoFile.remove();
|
|
417 |
}
|
|
418 |
/*
|
|
419 |
!
|
|
420 |
Tests the api TimeZoneClient::getLocationInfo.
|
|
421 |
|
|
422 |
void TestTimezoneClient::testGetLocationInfo()
|
|
423 |
{
|
|
424 |
LocationInfo gotInfo;
|
|
425 |
LocationInfo testInfo = {"India", "Mumbai", "", 330, 1624, false};
|
|
426 |
mTimezoneClient->getLocationInfo(45, 2, gotInfo);
|
|
427 |
|
|
428 |
// Check the location info got by specifying groupId and cityIndex
|
|
429 |
// with testInfo.
|
|
430 |
QVERIFY(testInfo.countryName == gotInfo.countryName);
|
|
431 |
QVERIFY(testInfo.cityName == gotInfo.cityName);
|
|
432 |
QVERIFY(testInfo.listImageName == gotInfo.listImageName);
|
|
433 |
QVERIFY(testInfo.zoneOffset == gotInfo.zoneOffset);
|
|
434 |
QVERIFY(testInfo.timezoneId == gotInfo.timezoneId);
|
|
435 |
QVERIFY(testInfo.dstOn == gotInfo.dstOn);
|
|
436 |
}
|
|
437 |
|
|
438 |
!
|
|
439 |
Test the api TimeZoneClient::testGetCityGroupIdByName.
|
|
440 |
|
|
441 |
void TestTimezoneClient::testGetCityGroupIdByName()
|
|
442 |
{
|
|
443 |
int retrievedGroupId = mTimezoneClient->getCityGroupIdByName("India");
|
|
444 |
mTimezoneClient->get
|
|
445 |
// Check the retrieved city group id with actual id.
|
|
446 |
QVERIFY(45 == retrievedGroupId);
|
|
447 |
}
|
|
448 |
|
|
449 |
!
|
|
450 |
Test the api TestTimezoneClient::getCityOffsetByNameAndId.
|
|
451 |
|
|
452 |
void TestTimezoneClient::testGetCityOffsetByNameAndId()
|
|
453 |
{
|
|
454 |
int retrievedCityOffset =
|
|
455 |
mTimezoneClient->getCityOffsetByNameAndId("Mumbai",1624);
|
|
456 |
|
|
457 |
// Check the retrieved city offset with actual offset.
|
|
458 |
QVERIFY(1 == retrievedCityOffset);
|
|
459 |
}
|
|
460 |
*/
|
|
461 |
|
|
462 |
QTEST_MAIN(TestTimezoneClient)
|
|
463 |
#include "unittest_timezoneclient.moc"
|
|
464 |
|
|
465 |
// End of file --Don't remove this.
|