46 void testRunChangeToAgendaView(); |
49 void testRunChangeToAgendaView(); |
47 void testRunLunarData(); |
50 void testRunLunarData(); |
48 void testRunNewMeeting(); |
51 void testRunNewMeeting(); |
49 void testRunGoToToday(); |
52 void testRunGoToToday(); |
50 void testChangeView(); |
53 void testChangeView(); |
|
54 void testOnLocaleChanged(); |
|
55 void testGetCurrentDate(); |
|
56 void testIsDateValid(); |
51 |
57 |
52 |
58 |
53 private: |
59 private: |
54 CalenDayView *mView; |
60 CalenDayView *mView; |
55 MCalenServices mServices; |
61 MCalenServices mServices; |
264 mView->changeView(ECalenAgendaView); |
271 mView->changeView(ECalenAgendaView); |
265 |
272 |
266 QVERIFY(mServices.lastCommand() == ECalenAgendaView); |
273 QVERIFY(mServices.lastCommand() == ECalenAgendaView); |
267 } |
274 } |
268 |
275 |
|
276 /*! |
|
277 Test function for onLocaleChanged |
|
278 1)Test if after system time change date change also |
|
279 2)Test if after midnight crosover date change also |
|
280 3)In above also check i locale change run in scroll area, should no |
|
281 4)Check if locale change run in scroll area after set EChangeLocale |
|
282 */ |
|
283 void TestCalenDayView::testOnLocaleChanged() |
|
284 { |
|
285 #ifndef __WINSCW__ |
|
286 QDateTime testDate = QDateTime(QDate(2000, 10, 10)); |
|
287 //1) |
|
288 mServices.Context().setFocusDateAndTime(testDate); |
|
289 mView->getCurrentDate(); |
|
290 QCOMPARE(mView->mDate,testDate); |
|
291 mView->onLocaleChanged(EChangesSystemTime); |
|
292 QCOMPARE(mView->mDate,CalenDateUtils::today()); |
|
293 |
|
294 //2) |
|
295 mServices.Context().setFocusDateAndTime(testDate); |
|
296 mView->getCurrentDate(); |
|
297 QCOMPARE(mView->mDate,testDate); |
|
298 mView->onLocaleChanged(EChangesMidnightCrossover); |
|
299 QCOMPARE(mView->mDate,CalenDateUtils::today()); |
|
300 |
|
301 //3) |
|
302 mServices.Context().setFocusDateAndTime(testDate); |
|
303 mView->getCurrentDate(); |
|
304 mView->onLocaleChanged(EChangesSystemTime); |
|
305 QCOMPARE(mView->mDate,CalenDateUtils::today()); |
|
306 |
|
307 //1) |
|
308 mServices.Context().setFocusDateAndTime(testDate); |
|
309 mView->getCurrentDate(); |
|
310 mView->onLocaleChanged(EChangesLocale); |
|
311 QCOMPARE(LOCALE_CHANGED,1); |
|
312 #endif /*__WINSCW__*/ |
|
313 } |
|
314 |
|
315 /*! |
|
316 Test function for getCurrentDate. |
|
317 |
|
318 Check if date given by context is good |
|
319 */ |
|
320 void TestCalenDayView::testGetCurrentDate() |
|
321 { |
|
322 #ifndef __WINSCW__ |
|
323 QDateTime testDate = QDateTime(QDate(2000, 10, 10), QTime(0, 0)); |
|
324 mServices.Context().setFocusDateAndTime(testDate); |
|
325 mView->getCurrentDate(); |
|
326 QCOMPARE(mView->mDate,testDate); |
|
327 #endif /*__WINSCW__*/ |
|
328 } |
|
329 |
|
330 /*! |
|
331 Test function for checkDate helper function. |
|
332 |
|
333 1) date supported |
|
334 2) lowest supported date |
|
335 3) highest supported date |
|
336 */ |
|
337 void TestCalenDayView::testIsDateValid() |
|
338 { |
|
339 #ifndef __WINSCW__ |
|
340 //1) |
|
341 mView->mDate = QDateTime(QDate(2010, 9, 22), QTime(0, 0)); |
|
342 mView->isDateValid(); |
|
343 QCOMPARE(gDisallowedDirection, ECalenScrollNoDayChange); |
|
344 |
|
345 //2) |
|
346 mView->mDate = QDateTime(QDate(1900, 1, 1), QTime(0, 0)); |
|
347 mView->isDateValid(); |
|
348 QCOMPARE(gDisallowedDirection, ECalenScrollToPrev); |
|
349 |
|
350 //3) |
|
351 mView->mDate = QDateTime(QDate(2100, 12, 30), QTime(0, 0)); |
|
352 mView->isDateValid(); |
|
353 QCOMPARE(gDisallowedDirection, ECalenScrollToNext); |
|
354 #endif /*__WINSCW__*/ |
|
355 } |
|
356 |
269 QTEST_MAIN(TestCalenDayView); |
357 QTEST_MAIN(TestCalenDayView); |
270 |
358 |
271 #include "unittest_calendayview.moc" |
359 #include "unittest_calendayview.moc" |