772 __UHEAP_MARKEND; |
779 __UHEAP_MARKEND; |
773 |
780 |
774 return result; |
781 return result; |
775 |
782 |
776 } |
783 } |
|
784 |
|
785 TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithGlobalIdL(CStifItemParser &aItem ) |
|
786 { |
|
787 |
|
788 |
|
789 TInt result = KErrNone; |
|
790 |
|
791 __UHEAP_MARK; |
|
792 |
|
793 CCalendarService* service = CCalendarService::NewL(); |
|
794 |
|
795 RemoveCalendarFile( service, KTestCal1File ); |
|
796 AddCalendarFile( service, KTestCal1File ); |
|
797 |
|
798 RPointerArray<TUIDSet> arruids(5); |
|
799 |
|
800 TUIDSet* uids = NULL; |
|
801 |
|
802 if(AddAppointmentWithAttendees(service, KTestCal1File, uids) == KErrNone && uids) |
|
803 { |
|
804 arruids.Append(uids); |
|
805 uids = NULL; |
|
806 } |
|
807 |
|
808 if ( arruids.Count() > 0 ) |
|
809 { |
|
810 RPointerArray<CCalEntry> entryArray; |
|
811 |
|
812 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
813 |
|
814 TTime stTime(TDateTime(2007, EAugust, 8, 11, 0, 0, 0)); |
|
815 entryObj->SetStartTimeL(stTime); |
|
816 |
|
817 TTime endTime(TDateTime(2007, EAugust, 8, 12, 0, 0, 0)); |
|
818 entryObj->SetEndTimeL(endTime); |
|
819 |
|
820 |
|
821 CCalAlarm* alarm = CCalAlarm::NewL(); |
|
822 TTime alarmTime(TDateTime(2007,EAugust, 8, 10, 30, 0, 0)); |
|
823 entryObj->SetAlarm(alarmTime); |
|
824 delete alarm; |
|
825 |
|
826 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
827 |
|
828 if( entryArray.Count() == 1 ) |
|
829 { |
|
830 entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); |
|
831 } |
|
832 |
|
833 TUIDSet* newuids = NULL; |
|
834 entryArray.ResetAndDestroy(); |
|
835 TRAPD( err, service->AddL(KTestCal1File,entryObj,newuids) ); |
|
836 delete newuids; |
|
837 if ( err == KErrNone ) |
|
838 { |
|
839 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
840 if( entryArray.Count() == 1 ) |
|
841 { |
|
842 CCalAlarm* entryalarm = entryArray[0]->AlarmL(); |
|
843 if( !(entryArray[0]->StartTimeL().TimeUtcL() == stTime && |
|
844 entryArray[0]->EndTimeL().TimeUtcL() == endTime && |
|
845 entryalarm->TimeOffset() == TTimeIntervalMinutes(30) )) |
|
846 { |
|
847 result = KErrGeneral; |
|
848 delete entryalarm; |
|
849 } |
|
850 else |
|
851 delete entryalarm; |
|
852 } |
|
853 } |
|
854 else |
|
855 { |
|
856 result = KErrGeneral; |
|
857 } |
|
858 entryArray.ResetAndDestroy(); |
|
859 arruids.ResetAndDestroy(); |
|
860 delete entryObj; |
|
861 } |
|
862 else |
|
863 result = KErrGeneral; |
|
864 |
|
865 RemoveCalendarFile( service, KTestCal1File ); |
|
866 |
|
867 delete service; |
|
868 |
|
869 __UHEAP_MARKEND; |
|
870 |
|
871 return result; |
|
872 |
|
873 } |
|
874 |
|
875 TInt CTCalendarUpdateTest::UpdateTodoEntryWithGlobalIdL(CStifItemParser &aItem ) |
|
876 { |
|
877 |
|
878 TInt result = KErrNone; |
|
879 |
|
880 __UHEAP_MARK; |
|
881 |
|
882 CCalendarService* service = CCalendarService::NewL(); |
|
883 |
|
884 RemoveCalendarFile( service, KTestCal1File ); |
|
885 AddCalendarFile( service, KTestCal1File ); |
|
886 |
|
887 RPointerArray<TUIDSet> arruids(5); |
|
888 |
|
889 TUIDSet* uids = NULL; |
|
890 |
|
891 if(AddToDo(service, KTestCal1File, uids) == KErrNone && uids) |
|
892 { |
|
893 arruids.Append(uids); |
|
894 uids = NULL; |
|
895 } |
|
896 |
|
897 if ( arruids.Count() > 0 ) |
|
898 { |
|
899 RPointerArray<CCalEntry> entryArray; |
|
900 |
|
901 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
902 |
|
903 TTime endTime(TDateTime(2007, EAugust, 22, 0, 0, 0, 0)); |
|
904 entryObj->SetEndTimeL(endTime); |
|
905 |
|
906 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
907 |
|
908 if( entryArray.Count() == 1 ) |
|
909 { |
|
910 entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); |
|
911 } |
|
912 |
|
913 TCalLocalUid modifiedEntryId; |
|
914 TUIDSet* entryUids = NULL; |
|
915 TRAPD( err, service->AddL(KTestCal1File,entryObj,entryUids) ); |
|
916 delete entryUids; |
|
917 entryArray.ResetAndDestroy(); |
|
918 if ( err == KErrNone ) |
|
919 { |
|
920 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
921 if( entryArray.Count() == 1 ) |
|
922 { |
|
923 if( !(entryArray[0]->EndTimeL().TimeUtcL() == endTime )) |
|
924 { |
|
925 result = KErrGeneral; |
|
926 } |
|
927 } |
|
928 } |
|
929 else |
|
930 { |
|
931 result = KErrGeneral; |
|
932 } |
|
933 entryArray.ResetAndDestroy(); |
|
934 arruids.ResetAndDestroy(); |
|
935 delete entryObj; |
|
936 } |
|
937 else |
|
938 result = KErrGeneral; |
|
939 |
|
940 RemoveCalendarFile( service, KTestCal1File ); |
|
941 |
|
942 delete service; |
|
943 |
|
944 __UHEAP_MARKEND; |
|
945 |
|
946 return result; |
|
947 |
|
948 |
|
949 } |
|
950 |
|
951 TInt CTCalendarUpdateTest::UpdateAnniversaryWithGlobalIdL(CStifItemParser &aItem )//try |
|
952 { |
|
953 |
|
954 TInt result = KErrNone; |
|
955 |
|
956 __UHEAP_MARK; |
|
957 |
|
958 CCalendarService* service = CCalendarService::NewL(); |
|
959 |
|
960 RemoveCalendarFile( service, KTestCal1File ); |
|
961 AddCalendarFile( service, KTestCal1File ); |
|
962 |
|
963 RPointerArray<TUIDSet> arruids(5); |
|
964 |
|
965 TUIDSet* uids = NULL; |
|
966 |
|
967 if(AddAnny(service, KTestCal1File, uids) == KErrNone && uids) |
|
968 { |
|
969 arruids.Append(uids); |
|
970 uids = NULL; |
|
971 } |
|
972 |
|
973 if ( arruids.Count() > 0 ) |
|
974 { |
|
975 RPointerArray<CCalEntry> entryArray; |
|
976 |
|
977 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
978 TCalTime stTime; |
|
979 stTime.SetTimeLocalFloatingL(TTime(TDateTime(2007, EDecember, 28, 0, 0, 0, 0))); |
|
980 TTime startTime(TDateTime(2007, EDecember, 28, 0, 0, 0, 0)); |
|
981 entryObj->SetStartTimeL(startTime); |
|
982 |
|
983 /*TCalRRule rrule(TCalRRule::EYearly); |
|
984 rrule.SetDtStart(stTime); |
|
985 rrule.SetInterval(1); |
|
986 |
|
987 TCalTime uTime; |
|
988 uTime.SetTimeLocalFloatingL(TCalTime::MaxTime()); |
|
989 rrule.SetUntil(uTime); |
|
990 |
|
991 entryObj->SetRepeatRule(rrule); */ |
|
992 |
|
993 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
994 |
|
995 if( entryArray.Count() == 1 ) |
|
996 { |
|
997 entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); |
|
998 } |
|
999 |
|
1000 TUIDSet* uids = NULL; |
|
1001 entryArray.ResetAndDestroy(); |
|
1002 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
1003 delete uids; |
|
1004 if ( err == KErrNone ) |
|
1005 { |
|
1006 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
1007 if( entryArray.Count() == 1 ) |
|
1008 { |
|
1009 TCalRRule rRule; |
|
1010 entryArray[0]->GetRRuleL( rRule ); |
|
1011 TCalTime utTime; |
|
1012 utTime.SetTimeLocalFloatingL(TTime(TDateTime(2100, EDecember, 28, 0, 0, 0, 0))); |
|
1013 if( !( entryArray[0]->StartTimeL().TimeLocalL() == stTime.TimeLocalL() ) && rRule.Until().TimeLocalL() == utTime.TimeLocalL()) |
|
1014 { |
|
1015 result = KErrGeneral; |
|
1016 } |
|
1017 } |
|
1018 } |
|
1019 else |
|
1020 { |
|
1021 result = KErrGeneral; |
|
1022 } |
|
1023 entryArray.ResetAndDestroy(); |
|
1024 arruids.ResetAndDestroy(); |
|
1025 delete entryObj; |
|
1026 } |
|
1027 else |
|
1028 result = KErrGeneral; |
|
1029 |
|
1030 RemoveCalendarFile( service, KTestCal1File ); |
|
1031 |
|
1032 delete service; |
|
1033 |
|
1034 __UHEAP_MARKEND; |
|
1035 |
|
1036 return result; |
|
1037 |
|
1038 } |
|
1039 |
|
1040 TInt CTCalendarUpdateTest::UpdateDayEventWithGlobalIdL(CStifItemParser &aItem )//try |
|
1041 { |
|
1042 TInt result = KErrNone; |
|
1043 |
|
1044 __UHEAP_MARK; |
|
1045 |
|
1046 CCalendarService* service = CCalendarService::NewL(); |
|
1047 |
|
1048 RemoveCalendarFile( service, KTestCal1File ); |
|
1049 AddCalendarFile( service, KTestCal1File ); |
|
1050 |
|
1051 RPointerArray<TUIDSet> arruids(5); |
|
1052 |
|
1053 TUIDSet* uids = NULL; |
|
1054 |
|
1055 if(AddEvent(service, KTestCal1File, uids) == KErrNone && uids) |
|
1056 { |
|
1057 arruids.Append(uids); |
|
1058 uids = NULL; |
|
1059 } |
|
1060 |
|
1061 if ( arruids.Count() > 0 ) |
|
1062 { |
|
1063 RPointerArray<CCalEntry> entryArray; |
|
1064 |
|
1065 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
1066 |
|
1067 entryObj->SetDescriptionL(_L("Day event modified")); |
|
1068 entryObj->SetPriority(2); |
|
1069 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
1070 |
|
1071 if( entryArray.Count() == 1 ) |
|
1072 { |
|
1073 entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); |
|
1074 } |
|
1075 |
|
1076 TUIDSet* uids = NULL; |
|
1077 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
1078 delete uids; |
|
1079 entryArray.ResetAndDestroy(); |
|
1080 if ( err == KErrNone ) |
|
1081 { |
|
1082 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
1083 if( entryArray.Count() == 1 ) |
|
1084 { |
|
1085 if( !( entryArray[0]->DescriptionL().CompareF(_L("Day event modified")) == 0 && entryArray[0]->PriorityL() == 2 ) ) |
|
1086 { |
|
1087 result = KErrGeneral; |
|
1088 } |
|
1089 } |
|
1090 } |
|
1091 else |
|
1092 { |
|
1093 result = KErrGeneral; |
|
1094 } |
|
1095 entryArray.ResetAndDestroy(); |
|
1096 arruids.ResetAndDestroy(); |
|
1097 delete entryObj; |
|
1098 } |
|
1099 else |
|
1100 result = KErrGeneral; |
|
1101 |
|
1102 RemoveCalendarFile( service, KTestCal1File ); |
|
1103 |
|
1104 delete service; |
|
1105 |
|
1106 __UHEAP_MARKEND; |
|
1107 |
|
1108 return result; |
|
1109 |
|
1110 } |
|
1111 |
|
1112 TInt CTCalendarUpdateTest::UpdateReminderWithGlobalIdL(CStifItemParser &aItem ) |
|
1113 { |
|
1114 TInt result = KErrNone; |
|
1115 |
|
1116 __UHEAP_MARK; |
|
1117 |
|
1118 CCalendarService* service = CCalendarService::NewL(); |
|
1119 |
|
1120 RemoveCalendarFile( service, KTestCal1File ); |
|
1121 AddCalendarFile( service, KTestCal1File ); |
|
1122 |
|
1123 RPointerArray<TUIDSet> arruids(5); |
|
1124 |
|
1125 TUIDSet* uids = NULL; |
|
1126 |
|
1127 if(AddReminder(service, KTestCal1File, uids) == KErrNone && uids) |
|
1128 { |
|
1129 arruids.Append(uids); |
|
1130 uids = NULL; |
|
1131 } |
|
1132 |
|
1133 if ( arruids.Count() > 0 ) |
|
1134 { |
|
1135 RPointerArray<CCalEntry> entryArray; |
|
1136 |
|
1137 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
1138 entryObj->SetSummaryL(KString1); |
|
1139 TTime stTime(TDateTime(2007, EJuly, 23, 11, 30, 0, 0)); |
|
1140 entryObj->SetStartTimeL(stTime); |
|
1141 |
|
1142 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
1143 |
|
1144 if( entryArray.Count() == 1 ) |
|
1145 { |
|
1146 entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); |
|
1147 } |
|
1148 |
|
1149 TUIDSet* uids = NULL; |
|
1150 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
1151 delete uids; |
|
1152 entryArray.ResetAndDestroy(); |
|
1153 if ( err == KErrNone ) |
|
1154 { |
|
1155 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
1156 if( entryArray.Count() == 1 ) |
|
1157 { |
|
1158 if( !( entryArray[0]->SummaryL().CompareF( KString1 ) == 0 && entryArray[0]->StartTimeL().TimeUtcL() == stTime)) |
|
1159 { |
|
1160 result = KErrGeneral; |
|
1161 } |
|
1162 } |
|
1163 } |
|
1164 else |
|
1165 { |
|
1166 result = KErrGeneral; |
|
1167 } |
|
1168 entryArray.ResetAndDestroy(); |
|
1169 arruids.ResetAndDestroy(); |
|
1170 delete entryObj; |
|
1171 } |
|
1172 else |
|
1173 result = KErrGeneral; |
|
1174 |
|
1175 RemoveCalendarFile( service, KTestCal1File ); |
|
1176 |
|
1177 delete service; |
|
1178 |
|
1179 __UHEAP_MARKEND; |
|
1180 |
|
1181 return result; |
|
1182 |
|
1183 } |
|
1184 TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndGlobalIdL(CStifItemParser &aItem ) |
|
1185 { |
|
1186 TInt result = KErrNone; |
|
1187 |
|
1188 __UHEAP_MARK; |
|
1189 |
|
1190 CCalendarService* service = CCalendarService::NewL(); |
|
1191 |
|
1192 RemoveCalendarFile( service, KTestCal1File ); |
|
1193 AddCalendarFile( service, KTestCal1File ); |
|
1194 |
|
1195 RPointerArray<TUIDSet> arruids(5); |
|
1196 |
|
1197 TUIDSet* uids = NULL; |
|
1198 |
|
1199 if(AddRepeatingAppointmentEntryL(service, KTestCal1File, uids) == KErrNone && uids) |
|
1200 { |
|
1201 arruids.Append(uids); |
|
1202 uids = NULL; |
|
1203 } |
|
1204 |
|
1205 if ( arruids.Count() > 0 ) |
|
1206 { |
|
1207 RPointerArray<CCalEntry> entryArray; |
|
1208 |
|
1209 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
1210 |
|
1211 |
|
1212 TTime stTime(TDateTime(2007, ESeptember, 17, 9, 0, 0, 0)); |
|
1213 entryObj->SetInstanceStartTimeL(stTime); |
|
1214 TTime startTime(TDateTime(2007, ESeptember, 17, 14, 0, 0, 0)); |
|
1215 entryObj->SetStartTimeL(startTime); |
|
1216 TTime endTime(TDateTime(2007, ESeptember, 17, 17, 30, 0, 0)); |
|
1217 entryObj->SetEndTimeL(endTime); |
|
1218 |
|
1219 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
1220 |
|
1221 if( entryArray.Count() == 1 ) |
|
1222 { |
|
1223 entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); |
|
1224 } |
|
1225 |
|
1226 TUIDSet* uids = NULL; |
|
1227 TCalLocalUid modifiedEntryId; |
|
1228 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
1229 //modifiedEntryId = uids->iLocalUID; |
|
1230 // modifiedEntryId = uids->iGlobalUID; |
|
1231 delete uids; |
|
1232 entryArray.ResetAndDestroy(); |
|
1233 if ( err == KErrNone ) |
|
1234 { |
|
1235 service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); |
|
1236 if( entryArray.Count() == 1 ) |
|
1237 { |
|
1238 if( !( entryArray[0]->StartTimeL().TimeUtcL() == startTime && |
|
1239 entryArray[0]->EndTimeL().TimeUtcL() == endTime )) |
|
1240 { |
|
1241 result = KErrGeneral; |
|
1242 } |
|
1243 } |
|
1244 |
|
1245 } |
|
1246 else |
|
1247 { |
|
1248 result = KErrGeneral; |
|
1249 } |
|
1250 entryArray.ResetAndDestroy(); |
|
1251 arruids.ResetAndDestroy(); |
|
1252 delete entryObj; |
|
1253 } |
|
1254 else |
|
1255 result = KErrGeneral; |
|
1256 |
|
1257 RemoveCalendarFile( service, KTestCal1File ); |
|
1258 |
|
1259 delete service; |
|
1260 |
|
1261 __UHEAP_MARKEND; |
|
1262 |
|
1263 return result; |
|
1264 |
|
1265 } |
|
1266 |
|
1267 |
|
1268 |
777 #if 0 |
1269 #if 0 |
778 |
1270 |
779 TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndAttendeesL(CStifItemParser &aItem ) |
1271 TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndAttendeesL(CStifItemParser &aItem ) |
780 { |
1272 { |
781 |
1273 |