pimappservices/calendar/tsrc/instance_iterator/tcal_fetchinstance.cpp
changeset 45 b6db4fd4947b
parent 0 f979ecb2b13e
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
   433 	CCalInstance* repeatingTodoInstance1 = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, instanceTime1);
   433 	CCalInstance* repeatingTodoInstance1 = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, instanceTime1);
   434 	CleanupStack::PushL(repeatingTodoInstance1);
   434 	CleanupStack::PushL(repeatingTodoInstance1);
   435 	test.Printf(_L("test the instance time"));
   435 	test.Printf(_L("test the instance time"));
   436 	test(repeatingTodoInstance1->Time().TimeLocalL() == instanceTime1.TimeLocalL());
   436 	test(repeatingTodoInstance1->Time().TimeLocalL() == instanceTime1.TimeLocalL());
   437 	test.Printf(_L("test the entry start and end times"));
   437 	test.Printf(_L("test the entry start and end times"));
   438 	test(repeatingTodoInstance1->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
   438 	
   439 	test(repeatingTodoInstance1->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
   439 	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
       
   440 	// end date = end date + duration of the entry. 
       
   441 	// Thus moving the time window based on DtStart date   
       
   442 	test(repeatingTodoInstance1->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
       
   443 	
       
   444 	TTime newEndTime(endTime.TimeLocalL());
       
   445 	TTimeIntervalMinutes deltaMinutes;
       
   446 	endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
       
   447 	newEndTime += deltaMinutes;
       
   448 	    
       
   449 	TTimeIntervalMicroSeconds deltaMicroSeconds = 
       
   450 	        endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
       
   451 	newEndTime += deltaMicroSeconds;
       
   452 	
       
   453 	test(repeatingTodoInstance1->Entry().EndTimeL().TimeLocalL() == newEndTime);
       
   454 	//Modified End<-
       
   455 	
   440 	test.Printf(_L("fetch the description"));
   456 	test.Printf(_L("fetch the description"));
   441 	test(repeatingTodoInstance1->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   457 	test(repeatingTodoInstance1->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   442 	CleanupStack::PopAndDestroy(repeatingTodoInstance1);
   458 	CleanupStack::PopAndDestroy(repeatingTodoInstance1);
   443 	
   459 	
   444 	TCalTime instanceTime2;
   460 	TCalTime instanceTime2;
   446 	CCalInstance* repeatingTodoInstance2 = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, instanceTime2);
   462 	CCalInstance* repeatingTodoInstance2 = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, instanceTime2);
   447 	CleanupStack::PushL(repeatingTodoInstance2);
   463 	CleanupStack::PushL(repeatingTodoInstance2);
   448 	test.Printf(_L("test the instance time"));
   464 	test.Printf(_L("test the instance time"));
   449 	test(repeatingTodoInstance2->Time().TimeLocalL() == instanceTime2.TimeLocalL());
   465 	test(repeatingTodoInstance2->Time().TimeLocalL() == instanceTime2.TimeLocalL());
   450 	test.Printf(_L("test the entry start and end times"));
   466 	test.Printf(_L("test the entry start and end times"));
   451 	test(repeatingTodoInstance2->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
   467 	
   452 	test(repeatingTodoInstance2->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
   468 	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
       
   469     // end date = end date + duration of the entry. 
       
   470     // Thus moving the time window based on DtStart date   
       
   471     test(repeatingTodoInstance2->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
       
   472     
       
   473     newEndTime = endTime.TimeLocalL();
       
   474     
       
   475     endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
       
   476     newEndTime += deltaMinutes;
       
   477         
       
   478     deltaMicroSeconds = 
       
   479             endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
       
   480     newEndTime += deltaMicroSeconds;
       
   481     
       
   482     test(repeatingTodoInstance2->Entry().EndTimeL().TimeLocalL() == newEndTime);
       
   483     //Modified End<-
       
   484     
   453 	test.Printf(_L("fetch the description"));
   485 	test.Printf(_L("fetch the description"));
   454 	test(repeatingTodoInstance2->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   486 	test(repeatingTodoInstance2->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   455 	CleanupStack::PopAndDestroy(repeatingTodoInstance2);
   487 	CleanupStack::PopAndDestroy(repeatingTodoInstance2);
   456 	
   488 	
   457 	TCalTime instanceTime3;
   489 	TCalTime instanceTime3;
   459 	CCalInstance* repeatingTodoInstance3 = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, instanceTime3);
   491 	CCalInstance* repeatingTodoInstance3 = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, instanceTime3);
   460 	CleanupStack::PushL(repeatingTodoInstance3);
   492 	CleanupStack::PushL(repeatingTodoInstance3);
   461 	test.Printf(_L("test the instance time"));
   493 	test.Printf(_L("test the instance time"));
   462 	test(repeatingTodoInstance3->Time().TimeLocalL() == instanceTime3.TimeLocalL());
   494 	test(repeatingTodoInstance3->Time().TimeLocalL() == instanceTime3.TimeLocalL());
   463 	test.Printf(_L("test the entry start and end times"));
   495 	test.Printf(_L("test the entry start and end times"));
   464 	test(repeatingTodoInstance3->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
   496 	
   465 	test(repeatingTodoInstance3->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
   497 	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
       
   498     // end date = end date + duration of the entry. 
       
   499     // Thus moving the time window based on DtStart date   
       
   500     test(repeatingTodoInstance3->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
       
   501     
       
   502     newEndTime = endTime.TimeLocalL();
       
   503     
       
   504     endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
       
   505     newEndTime += deltaMinutes;
       
   506         
       
   507     deltaMicroSeconds = 
       
   508             endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
       
   509     newEndTime += deltaMicroSeconds;
       
   510     
       
   511     test(repeatingTodoInstance3->Entry().EndTimeL().TimeLocalL() == newEndTime);
       
   512     //Modified End<-
       
   513     
   466 	test.Printf(_L("fetch the description"));
   514 	test.Printf(_L("fetch the description"));
   467 	test(repeatingTodoInstance3->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   515 	test(repeatingTodoInstance3->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   468 	CleanupStack::PopAndDestroy(repeatingTodoInstance3);
   516 	CleanupStack::PopAndDestroy(repeatingTodoInstance3);
   469 	
   517 	
   470 	TCalTime instanceTime4;
   518 	TCalTime instanceTime4;
   472 	CCalInstance* repeatingTodoInstance4 = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, instanceTime4);
   520 	CCalInstance* repeatingTodoInstance4 = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, instanceTime4);
   473 	CleanupStack::PushL(repeatingTodoInstance4);
   521 	CleanupStack::PushL(repeatingTodoInstance4);
   474 	test.Printf(_L("test the instance time"));
   522 	test.Printf(_L("test the instance time"));
   475 	test(repeatingTodoInstance4->Time().TimeLocalL() == instanceTime4.TimeLocalL());
   523 	test(repeatingTodoInstance4->Time().TimeLocalL() == instanceTime4.TimeLocalL());
   476 	test.Printf(_L("test the entry start and end times"));
   524 	test.Printf(_L("test the entry start and end times"));
   477 	test(repeatingTodoInstance4->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
   525 	
   478 	test(repeatingTodoInstance4->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
   526 	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
       
   527     // end date = end date + duration of the entry. 
       
   528     // Thus moving the time window based on DtStart date   
       
   529     test(repeatingTodoInstance4->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
       
   530     
       
   531     newEndTime = endTime.TimeLocalL();
       
   532     
       
   533     endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
       
   534     newEndTime += deltaMinutes;
       
   535         
       
   536     deltaMicroSeconds = 
       
   537             endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
       
   538     newEndTime += deltaMicroSeconds;
       
   539     
       
   540     test(repeatingTodoInstance4->Entry().EndTimeL().TimeLocalL() == newEndTime);
       
   541     //Modified End<-
       
   542     
   479 	test.Printf(_L("fetch the description"));
   543 	test.Printf(_L("fetch the description"));
   480 	test(repeatingTodoInstance4->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   544 	test(repeatingTodoInstance4->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   481 	CleanupStack::PopAndDestroy(repeatingTodoInstance4);
   545 	CleanupStack::PopAndDestroy(repeatingTodoInstance4);
   482 	
   546 	
   483 	// fetch the rDate
   547 	// fetch the rDate
   484 	CCalInstance* rDateInstance = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, rDateTime);
   548 	CCalInstance* rDateInstance = iTestLibrary->SynCGetInstanceViewL().FindInstanceL(localUid, rDateTime);
   485 	CleanupStack::PushL(rDateInstance);
   549 	CleanupStack::PushL(rDateInstance);
   486 	test.Printf(_L("test the instance time"));
   550 	test.Printf(_L("test the instance time"));
   487 	test(rDateInstance->Time().TimeLocalL() == rDateTime.TimeLocalL());
   551 	test(rDateInstance->Time().TimeLocalL() == rDateTime.TimeLocalL());
   488 	test.Printf(_L("test the entry start and end times"));
   552 	test.Printf(_L("test the entry start and end times"));
   489 	test(rDateInstance->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
   553 	
   490 	test(rDateInstance->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
   554 	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
       
   555     // end date = end date + duration of the entry. 
       
   556     // Thus moving the time window based on DtStart date   
       
   557     test(rDateInstance->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
       
   558     
       
   559     newEndTime = endTime.TimeLocalL();
       
   560     
       
   561     endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
       
   562     newEndTime += deltaMinutes;
       
   563         
       
   564     deltaMicroSeconds = 
       
   565             endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
       
   566     newEndTime += deltaMicroSeconds;
       
   567     
       
   568     test(rDateInstance->Entry().EndTimeL().TimeLocalL() == newEndTime);
       
   569     //Modified End<-
       
   570     
   491 	test.Printf(_L("fetch the description"));
   571 	test.Printf(_L("fetch the description"));
   492 	test(rDateInstance->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   572 	test(rDateInstance->Entry().DescriptionL().Compare(KEntryDescription) == 0);
   493 	CleanupStack::PopAndDestroy(rDateInstance);
   573 	CleanupStack::PopAndDestroy(rDateInstance);
   494 	
   574 	
   495 	test.Printf(_L("try to fetch the exDate (negative test)"));
   575 	test.Printf(_L("try to fetch the exDate (negative test)"));