2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * This file contains the implementation of test calendar class.
19 * @author Lukasz Marek (l.marek@samsung.com)
23 var TYPE_MISMATCH_ERR = 17;
24 var INVALID_VALUES_ERR = 22;
25 var NOT_FOUND_ERR = 8;
34 expectedErrorCode: null,
36 createTestEvent: function (response)
38 return TestCalendar.calendar.createEvent({description:'Test Event 1',
39 summary:'Event created to test event creation',
40 startTime: new Date(2009, 3, 30, 10, 0),
46 onSuccessNonExpected: function(response)
48 TestEngine.test("non expected successCallback invoked", false);
51 onErrorExpected: function(response)
53 TestEngine.test("expected errorCallback invoked", true);
54 TestEngine.testPresence("error code", response.code);
55 TestEngine.test("Error number", response.code == TestCalendar.expectedErrorCode);
58 onSuccess: function(response)
60 TestEngine.test("Callback success", true);
63 onErrorCb: function(response)
65 TestEngine.logErr("errorCallback invoked [" + response.code + ']');
69 test_modulePresence: function()
71 TestEngine.test("Calendar manager presence", deviceapis.pim.calendar);
74 test_calendarManagerConstants: function()
76 TestEngine.test("test property SIM_CALENDAR", deviceapis.pim.calendar.SIM_CALENDAR === 0);
77 TestEngine.test("test property DEVICE_CALENDAR", deviceapis.pim.calendar.DEVICE_CALENDAR === 1);
78 TestEngine.test("test property NO RECURRENCE", deviceapis.pim.calendar.NO_RECURRENCE === 0);
79 TestEngine.test("test property DAILY RECURENCE", deviceapis.pim.calendar.DAILY_RECURRENCE === 1);
80 TestEngine.test("test property WEEKLY RECURRENCE", deviceapis.pim.calendar.WEEKLY_RECURRENCE === 2);
81 TestEngine.test("test property MONTHLY RECURRENCE", deviceapis.pim.calendar.MONTHLY_RECURRENCE === 3);
82 TestEngine.test("test property YEARLY_RECURRENCE", deviceapis.pim.calendar.YEARLY_RECURRENCE === 4);
83 TestEngine.test("test property TENTATIVE_STATUS", deviceapis.pim.calendar.TENTATIVE_STATUS === 0);
84 TestEngine.test("test property CONFIRMED STATUS", deviceapis.pim.calendar.CONFIRMED_STATUS === 1);
85 TestEngine.test("test property CANCELED STATUS", deviceapis.pim.calendar.CANCELLED_STATUS === 2);
86 TestEngine.test("test property ALARM", deviceapis.pim.calendar.NO_ALARM === 0);
87 TestEngine.test("test property SILENT_ALARM", deviceapis.pim.calendar.SILENT_ALARM === 1);
88 TestEngine.test("test property SOUND_ALARM", deviceapis.pim.calendar.SOUND_ALARM === 2);
92 test_getCalendar: function()
94 function onSuccessGetCalendar(response)
96 TestEngine.test("Found calendars", response.length > 0);
97 TestCalendar.calendar=response[0];
99 function onErrorCb(response)
101 TestEngine.test("getCalendars error callback", false);
102 TestEngine.log("error callback invoked with code " +response.code);
105 var cbObj = TestEngine.registerCallback("getCalendars",
106 onSuccessGetCalendar,
108 deviceapis.pim.calendar.getCalendars(cbObj.successCallback, cbObj.errorCallback);
112 test_getCalendarNoCallbacks: function()
114 testNoExceptionWithMessage("getCalendars() missing error callback",
117 deviceapis.pim.calendar.getCalendars(null);
120 testNoExceptionWithMessage("getCalendars() missing error callback",
123 deviceapis.pim.calendar.getCalendars(undefined);
126 testNoExceptionWithMessage("getCalendars() missing error callback",
129 deviceapis.pim.calendar.getCalendars(null, null);
132 testNoExceptionWithMessage("getCalendars() missing error callback",
135 deviceapis.pim.calendar.getCalendars(undefined, undefined);
138 testNoExceptionWithMessage("getCalendars() missing error callback",
141 deviceapis.pim.calendar.getCalendars(null, undefined);
144 testNoExceptionWithMessage("getCalendars() missing error callback",
147 deviceapis.pim.calendar.getCalendars(undefined, null);
153 test_getCalendarInvalidCallbacks: function()
155 function onError(error)
157 TestEngine.test("getCalendars()", (error.code == INVALID_VALUES_ERR));
159 function onUnexpectedCallback()
161 TestEngine.test("getCalendars() unexpected callback", false);
164 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, deviceapis.pim.calendar, "getCalendars");
166 var cbObj = TestEngine.registerCallback("getCalendars", null, onError);
167 deviceapis.pim.calendar.getCalendars(null, cbObj.errorCallback);
169 cbObj = TestEngine.registerCallback("getCalendars", null, onError);
170 deviceapis.pim.calendar.getCalendars(undefined, cbObj.errorCallback);
172 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, deviceapis.pim.calendar, "getCalendars", onUnexpectedCallback, 2);
173 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, deviceapis.pim.calendar, "getCalendars", onUnexpectedCallback, "test2");
174 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, deviceapis.pim.calendar, "getCalendars", 2, onUnexpectedCallback);
175 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, deviceapis.pim.calendar, "getCalendars", "test2", onUnexpectedCallback);
176 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, deviceapis.pim.calendar, "getCalendars", 2, null);
177 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, deviceapis.pim.calendar, "getCalendars", "test2", undefined);
178 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, deviceapis.pim.calendar, "getCalendars", 2);
179 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, deviceapis.pim.calendar, "getCalendars", "test2");
183 test_calendarMethodsPresence: function()
185 TestEngine.testPresence("calendar.createEvent presence", TestCalendar.calendar.createEvent);
186 TestEngine.testPresence("calendar.addEvent presence", TestCalendar.calendar.addEvent);
187 TestEngine.testPresence("calendar.updateEvent presence", TestCalendar.calendar.updateEvent);
188 TestEngine.testPresence("calendar.deleteEvent presence", TestCalendar.calendar.deleteEvent);
189 TestEngine.testPresence("calendar.findEvents presence", TestCalendar.calendar.findEvents);
193 test_getCalendarName: function()
195 var cName = TestCalendar.calendar.name;
196 TestEngine.test("test getName", isString(cName) && cName.length > 0);
197 TestEngine.log("calendar name: " + cName);
201 test_getCalendarType: function ()
203 var cType = TestCalendar.calendar.type;
204 TestEngine.test("test getType", cType === deviceapis.pim.calendar.SIM_CALENDAR ||
205 cType === deviceapis.pim.calendar.DEVICE_CALENDAR);
206 TestEngine.log("calendar type: " + cType);
211 test_createEmptyEvent: function()
213 var event = TestCalendar.calendar.createEvent();
214 TestEngine.test("event created", isObject(event));
218 test_eventAttributes: function()
220 var event = TestCalendar.calendar.createEvent();
221 TestEngine.test("test attribute id", isString(event.id) || isNull(event.id) || isUndefineD(event.id));
222 var oldId = event.id;
223 event.id = "test" + oldId;
224 TestEngine.test("attribute id is read only", event.id === oldId);
225 TestEngine.test("test attribute description", isString(event.description));
226 TestEngine.test("test attribute summary", isString(event.summary));
227 TestEngine.test("test attribute startTime", isDate(event.startTime));
228 TestEngine.test("test attribute duration", isNumber(event.duration));
229 TestEngine.test("test attribute location", isString(event.location));
230 TestEngine.test("test attribute categories", isObject(event.categories) && event.categories.length == 0);
231 TestEngine.test("test attribute recurrence", isNumber(event.recurrence) && event.recurrence === deviceapis.pim.calendar.NO_RECURRENCE);
232 TestEngine.test("test attribute expires", event.expires === null);
233 TestEngine.test("test attribute interval", isNumber(event.interval));
234 TestEngine.test("test attribute status", isNumber(event.status) && event.status === deviceapis.pim.calendar.CONFIRMED_STATUS);
235 TestEngine.test("test attribute alarmTrigger", isNumber(event.alarmTrigger) && event.alarmTrigger === 0);
236 TestEngine.test("test attribute alarmType", isNumber(event.alarmType) && event.alarmType === deviceapis.pim.calendar.NO_ALARM);
240 test_createEvent: function()
243 description: 'Event created to test event creation',
244 summary: 'Test Event 1',
245 startTime: new Date(2009, 3, 30, 10, 0),
248 categories: ["SPRC"],
249 recurrence: deviceapis.pim.calendar.DAILY_RECURRENCE,
250 expires: new Date(2009, 4, 30, 10, 0),
252 status: deviceapis.pim.calendar.CANCELLED_STATUS,
254 alarmType: deviceapis.pim.calendar.SILENT_ALARM
257 var newEvent = TestCalendar.calendar.createEvent(eventProp);
259 TestEngine.test("event with param created ", newEvent);
260 TestEngine.test("correct description", newEvent.description === eventProp.description);
261 TestEngine.test("correct summary", newEvent.summary === eventProp.summary);
262 TestEngine.test("correct startTime", newEvent.startTime.toString() === eventProp.startTime.toString());
263 TestEngine.test("correct duration", newEvent.duration === eventProp.duration);
264 TestEngine.test("correct location", newEvent.location === eventProp.location);
265 TestEngine.test("correct categories", newEvent.categories.length === eventProp.categories.length &&
266 newEvent.categories[0] === eventProp.categories[0]);
267 TestEngine.test("correct recurrence", newEvent.recurrence === eventProp.recurrence);
268 TestEngine.test("correct expires", newEvent.expires.toString() === eventProp.expires.toString());
269 TestEngine.test("correct interval", newEvent.interval === eventProp.interval);
270 TestEngine.test("correct status", newEvent.status === eventProp.status);
271 TestEngine.test("correct alarmTrigger", newEvent.alarmTrigger === eventProp.alarmTrigger);
272 TestEngine.test("correct alarmType", newEvent.alarmType === eventProp.alarmType);
276 //this function is called from test_addEvent1, test_addEvent2 ...
277 addEvent: function(newEvent)
279 var event = newEvent;
282 function onErrorCb(response)
284 TestEngine.logErr("errorCallback invoked [" + response.code + ']');
285 TestEngine.test("add event", false);
288 function onSuccessAddEventCountAfter(response)
290 TestEngine.log("There is " + response.length +" events");
291 TestEngine.log("added event's id " + event.id);
292 TestEngine.test("Number of events increased", num_events + 1 == response.length);
293 var eventValidated = false;
294 for (var i in response) {
295 if (event.id != response[i].id) {
298 TestEngine.test("description the same", response[i].description === event.description);
299 TestEngine.test("summary the same", response[i].summary === event.summary);
300 TestEngine.test("startTime the same", response[i].startTime.toString() === event.startTime.toString());
301 TestEngine.test("duration the same", response[i].duration === event.duration);
302 TestEngine.test("location the same", response[i].location === event.location);
303 TestEngine.test("categories the same", response[i].categories.length === event.categories.length);
304 TestEngine.test("recurrence the same", response[i].recurrence === event.recurrence);
305 TestEngine.test("expires the same", isNull(event.expires) ||
306 response[i].expires.toString() === event.expires.toString());
307 TestEngine.test("interval the same", response[i].interval === event.interval);
308 TestEngine.test("status the same", response[i].status === event.status);
309 TestEngine.test("alarmTrigger the same, " + response[i].alarmTrigger, response[i].alarmTrigger === event.alarmTrigger);
310 TestEngine.test("alarmType the same", response[i].alarmType === event.alarmType);
311 eventValidated = true;
313 TestEngine.test("Event has been validated", eventValidated)
317 function onSuccessAddEventAdd(response)
319 TestEngine.log("event added");
320 //count the number of events
321 TestEngine.log("counting existing events");
322 var objCb = TestEngine.registerCallback("onSuccessAddEventAdd",
323 onSuccessAddEventCountAfter, onErrorCb);
324 TestCalendar.calendar.findEvents(objCb.successCallback,
325 objCb.errorCallback);
328 function onSuccessAddEventCountBefore(response)
330 TestEngine.log("events counted");
331 //save current number of events
332 num_events = response.length;
333 TestEngine.log("There is " + num_events +" events");
334 TestEngine.log("adding new event");
336 var objCb = TestEngine.registerCallback("onSuccessAddEventCountBefore",
337 onSuccessAddEventAdd, onErrorCb);
338 TestCalendar.calendar.addEvent(objCb.successCallback,
343 //save current number of events
344 TestEngine.log("counting existing events");
345 var objCb = TestEngine.registerCallback("findEvents",
346 onSuccessAddEventCountBefore,
348 TestCalendar.calendar.findEvents(objCb.successCallback, objCb.errorCallback);
349 //rest of test in callbacks...
353 test_addEvent1: function()
355 TestEngine.log("creating new event");
356 var event = TestCalendar.calendar.createEvent();
357 TestEngine.log("new event created");
358 TestCalendar.addEvent(event);
362 test_addEvent2: function()
364 TestEngine.log("creating new event");
365 var event = TestCalendar.calendar.createEvent({
366 description:'Event created to test event creation',
367 summary:'Test Event 2',
368 startTime: new Date(2010, 11, 30, 10, 0),
371 categories: ["SPRC"],
372 recurrence: deviceapis.pim.calendar.DAILY_RECURRENCE,
375 status: deviceapis.pim.calendar.TENTATIVE_STATUS,
377 alarmType: deviceapis.pim.calendar.SILENT_ALARM
379 TestEngine.log("new event created");
380 TestCalendar.addEvent(event);
384 test_addEvent3: function()
386 TestEngine.log("creating new event");
387 var event = TestCalendar.calendar.createEvent({
388 description:'Event created to test event creation',
389 summary:'Test Event 3',
390 startTime: new Date(2010, 11, 30, 10, 0),
393 categories: ["SPRC"],
394 recurrence: deviceapis.pim.calendar.WEEKLY_RECURRENCE,
395 expires: new Date(2011, 11, 30, 10, 0),
397 status: deviceapis.pim.calendar.CANCELLED_STATUS,
399 alarmType: deviceapis.pim.calendar.SOUND_ALARM
401 TestEngine.log("new event created");
402 TestCalendar.addEvent(event);
406 test_addEvent4: function()
408 var event = TestCalendar.calendar.createEvent({
409 description:'Event created to test event creation',
410 summary:'Test Event 4',
411 startTime: new Date(2010, 11, 30, 10, 0),
414 categories: ["SPRC"],
415 recurrence: deviceapis.pim.calendar.NO_RECURRENCE,
418 status: deviceapis.pim.calendar.CONFIRMED_STATUS,
420 alarmType: deviceapis.pim.calendar.NO_ALARM
422 TestCalendar.addEvent(event);
426 test_addEvent5: function()
428 var event = TestCalendar.calendar.createEvent({
429 description:'Event created to test event creation',
430 summary:'Test Event 5',
431 startTime: new Date(2010, 11, 30, 10, 0),
434 categories: ["SPRC"],
435 recurrence: deviceapis.pim.calendar.MONTHLY_RECURRENCE,
438 status: deviceapis.pim.calendar.CONFIRMED_STATUS,
440 alarmType: deviceapis.pim.calendar.NO_ALARM
442 TestCalendar.addEvent(event);
446 test_addEvent6: function()
448 var event = TestCalendar.calendar.createEvent({
449 description:'Event created to test event creation',
450 summary:'Test Event 6',
451 startTime: new Date(2010, 11, 30, 10, 0),
454 categories: ["SPRC"],
455 recurrence: deviceapis.pim.calendar.YEARLY_RECURRENCE,
458 status: deviceapis.pim.calendar.CONFIRMED_STATUS,
460 alarmType: deviceapis.pim.calendar.NO_ALARM
462 TestCalendar.addEvent(event);
466 test_addEventNoParams: function()
468 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent");
472 test_addEventInvalidCallbacksParams: function()
474 function onError(error)
476 TestEngine.test("addEvent()", (error.code == INVALID_VALUES_ERR));
478 function onUnexpectedCallback()
480 TestEngine.test("addEvent() unexpected callback", false);
483 var event = TestCalendar.createTestEvent();
485 testNoExceptionWithMessage("addEvent()", function() {
486 TestCalendar.calendar.addEvent(undefined, undefined, event);
488 testNoExceptionWithMessage("addEvent()", function() {
489 TestCalendar.calendar.addEvent(null, undefined, event);
491 testNoExceptionWithMessage("addEvent()", function() {
492 TestCalendar.calendar.addEvent(undefined, null, event);
494 testNoExceptionWithMessage("addEvent()", function() {
495 TestCalendar.calendar.addEvent(null, null, event);
498 var cbObj = TestEngine.registerCallback("addEvent()", null, onError);
499 deviceapis.pim.calendar.getCalendars(null, cbObj.errorCallback, event);
501 cbObj = TestEngine.registerCallback("addEvent()", null, onError);
502 deviceapis.pim.calendar.getCalendars(undefined, cbObj.errorCallback, event);
504 testNoExceptionWithMessage("addEvent()", function() {
505 TestCalendar.calendar.addEvent(undefined, undefined, null);
507 testNoExceptionWithMessage("addEvent()", function() {
508 TestCalendar.calendar.addEvent(undefined, undefined, undefined);
511 testNoExceptionWithMessage("addEvent()", function() {
512 TestCalendar.calendar.addEvent(null, null, null);
514 testNoExceptionWithMessage("addEvent()", function() {
515 TestCalendar.calendar.addEvent(null, null, undefined);
518 testNoExceptionWithMessage("addEvent()", function() {
519 TestCalendar.calendar.addEvent(null, undefined, null);
521 testNoExceptionWithMessage("addEvent()", function() {
522 TestCalendar.calendar.addEvent(null, undefined, undefined);
525 testNoExceptionWithMessage("addEvent()", function() {
526 TestCalendar.calendar.addEvent(undefined, null, null);
528 testNoExceptionWithMessage("addEvent()", function() {
529 TestCalendar.calendar.addEvent(undefined, null, undefined);
532 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent", 1, 1, null);
533 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent", "test", "test", null);
534 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent", 1, 1, undefined);
535 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent", "test", "test", undefined);
536 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent", 1, 1, event);
537 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent", "test", "test", event);
541 test_addEventWrongEventParam: function()
543 function onError(error)
545 TestEngine.test("addEvent()", (error.code == INVALID_VALUES_ERR));
548 function onSuccessNonExpected()
550 TestEngine.test("addEvent() non expected successCallback invoked", false);
553 function onUnexpectedCallback()
555 TestEngine.test("addEvent() unexpected callback", false);
558 var cbObj = TestEngine.registerCallback("addEvent()", onSuccessNonExpected, onError);
559 TestCalendar.calendar.addEvent(cbObj.successCallback, cbObj.errorCallback, null);
561 cbObj = TestEngine.registerCallback("addEvent()", onSuccessNonExpected, onError);
562 TestCalendar.calendar.addEvent(cbObj.successCallback, cbObj.errorCallback, undefined);
564 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent",
565 onUnexpectedCallback, onUnexpectedCallback, 22);
566 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent",
567 onUnexpectedCallback, onUnexpectedCallback, "test");
568 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent",
569 onUnexpectedCallback, onUnexpectedCallback);
570 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "addEvent",
571 onUnexpectedCallback, onUnexpectedCallback, new Date());
575 test_findAllEvents: function()
577 function onSuccessFindAllEvents(response)
579 TestEngine.test("Find all events", response.length > 0);
584 TestEngine.test("Find all events", false);
587 var objCb = TestEngine.registerCallback("findEvents",
588 onSuccessFindAllEvents,
590 TestCalendar.calendar.findEvents(objCb.successCallback,
591 objCb.errorCallback);
594 //function called by following tests
595 test_FindEventsWithFilterSomeResults: function(filterEval)
597 function onSuccessFindAllEvents(response)
599 function onSuccessFindEventWithFilterSomeResults(response)
601 TestEngine.log("found events: " + response.length);
602 TestEngine.test("FindEvents with filter found results", response.length > 0);
607 TestEngine.test("FindEvents error callback", false);
610 TestEngine.test("Found any event for tests", response.length > 0);
611 if (response.length > 0) {
614 for(var i in filter) {
615 TestEngine.log(" Filter: " + i + " : " + filter[i]);
618 var objCb = TestEngine.registerCallback("findEvents",
619 onSuccessFindEventWithFilterSomeResults,
621 TestCalendar.calendar.findEvents(objCb.successCallback,
629 TestEngine.test("Find all events", false);
632 var objCb = TestEngine.registerCallback("findEvents",
633 onSuccessFindAllEvents,
635 TestCalendar.calendar.findEvents(objCb.successCallback,
636 objCb.errorCallback);
640 test_findEventsId: function()
642 TestCalendar.test_FindEventsWithFilterSomeResults(
643 "var filter = {id: response[0].id}");
647 test_findEventsSummary: function()
649 TestCalendar.test_FindEventsWithFilterSomeResults(
650 "var filter = {summary: response[0].summary}");
654 test_findEventsDescription: function()
656 TestCalendar.test_FindEventsWithFilterSomeResults(
657 "var filter = {description: response[0].description}");
661 test_findEventsLocation: function()
663 TestCalendar.test_FindEventsWithFilterSomeResults(
664 "var filter = {location: response[0].location}");
668 test_findEventsCategory: function()
670 TestCalendar.test_FindEventsWithFilterSomeResults(
671 "var filter = {category: 'SPRC'}");
675 test_findEventsStatus: function()
677 TestCalendar.test_FindEventsWithFilterSomeResults(
678 "var filter = {status: [response[0].status]}");
682 test_findEventsFullStartTime: function()
684 TestCalendar.test_FindEventsWithFilterSomeResults(
685 "var filter = {initialStartDate: response[0].startTime, endStartDate: response[0].startTime}");
689 test_findEventsInitialStartDate: function()
691 TestCalendar.test_FindEventsWithFilterSomeResults(
692 "var filter = {initialStartDate: response[0].startTime, endStartDate: null}");
696 test_findEventsEndStartDate: function()
698 TestCalendar.test_FindEventsWithFilterSomeResults(
699 "var filter = {initialStartDate: null, endStartDate: response[0].startTime}");
703 test_findEventsEmptyFilter: function()
705 TestCalendar.test_FindEventsWithFilterSomeResults("var filter = {}");
708 //function called by following tests
709 test_FindEventsWithFilterNoResults: function(filter)
711 function onSuccessFindEventWithFilterNoResults(response)
713 TestEngine.test("FindEvents with filter not found results", response.length == 0);
718 TestEngine.test("FindEvents error callback", false);
722 for(var i in filter) {
723 TestEngine.log(" Filter: " + i + " : " + filter[i]);
726 var objCb = TestEngine.registerCallback("findEvents",
727 onSuccessFindEventWithFilterNoResults,
729 TestCalendar.calendar.findEvents(objCb.successCallback,
735 test_findEventsFullStartTimeNoResults: function()
737 TestCalendar.test_FindEventsWithFilterNoResults(
738 {initialStartDate: new Date(1980, 11, 30, 1, 0),
739 endStartDate: new Date(1980, 11, 30, 23, 0)});
743 test_findEventsLocationNoResults: function()
745 TestCalendar.test_FindEventsWithFilterNoResults(
746 {location:"non existing location"});
750 test_findEventsSummaryNoResults: function()
752 TestCalendar.test_FindEventsWithFilterNoResults(
753 {summary:'non existing summary'});
757 test_findEventsDescriptionNoResults: function()
759 TestCalendar.test_FindEventsWithFilterNoResults(
760 {description:'non existing description'});
764 test_findEventsIdNoResults: function()
766 TestCalendar.test_FindEventsWithFilterNoResults(
771 test_findEventsCategoryNoResults: function()
773 TestCalendar.test_FindEventsWithFilterNoResults(
774 {category:'non existing category'});
778 test_findEventsNoParams: function()
780 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "findEvents");
784 test_findEventsNoCallbacksParams: function()
786 testNoExceptionWithMessage("findEvents() null callbacks",
789 TestCalendar.calendar.findEvents(null, null);
792 testNoExceptionWithMessage("findEvents() undefined callbacks",
795 TestCalendar.calendar.findEvents(undefined, undefined);
798 testNoExceptionWithMessage("findEvents() undefined success callback, null error callback",
801 TestCalendar.calendar.findEvents(undefined, null);
804 testNoExceptionWithMessage("findEvents() null success callback, undefined error callback",
807 TestCalendar.calendar.findEvents(null, undefined);
810 testNoExceptionWithMessage("findEvents() undefined success callback, missing error callback",
813 TestCalendar.calendar.findEvents(undefined);
816 testNoExceptionWithMessage("findEvents() null success callback, missing error callback",
819 TestCalendar.calendar.findEvents(null);
822 testNoExceptionWithMessage("findEvents() null callbacks, empty filter",
825 TestCalendar.calendar.findEvents(null, null, {});
828 testNoExceptionWithMessage("findEvents() undefined callbacks, empty filter",
831 TestCalendar.calendar.findEvents(undefined, undefined, {});
837 test_findEventsWrongFilterParam: function()
839 function onSuccess(response)
841 TestEngine.test("findEvents() success callback invoked", true);
844 function onError(response)
846 TestEngine.test("findEvents() error callback invoked", false);
849 var objCb = TestEngine.registerCallback("Find events with undefined filter param",
852 TestCalendar.calendar.findEvents(objCb.successCallback,
853 objCb.errorCallback, null);
855 objCb = TestEngine.registerCallback("Find events with undefined filter param",
858 TestCalendar.calendar.findEvents(objCb.successCallback,
859 objCb.errorCallback, undefined);
862 //this function is called by following tests
863 updateEvent: function(newValues)
867 TestEngine.test("Find all events", false);
870 function onSuccessFindAllEvents(response)
872 TestEngine.test("Find all events", response.length > 0);
873 if (response.length > 0) {
874 var event = response[0];
875 function onSuccessUpdateEvent1(response)
877 TestEngine.log("updateEvent() success callback entered entered");
879 function onSuccessUpdateEvent2(response)
881 TestEngine.test("found updated event", response.length > 0);
882 if (response.length > 0) {
884 for (var i in response) {
886 for (var j in newValues) {
887 if (isDate(newValues[j])) {
888 if (response[i][j].toString() != newValues[j].toString()) {
893 else if (isArray(newValues[j]))
895 if (response[i][j].length != newValues[j].length ||
896 response[i][j][0] != newValues[j][0]) {
902 if (response[i][j] !== newValues[j]) {
903 if (j == "expires" && newValues[j] == null) {
904 //expires date with null should not be checked
905 TestEngine.log("dupa " + j);
917 TestEngine.test("Updated event validated successfully", f_flag == 1);
920 TestEngine.test("Updated events found", false);
925 var objCb = TestEngine.registerCallback("findEvents",
926 onSuccessUpdateEvent2,
928 TestCalendar.calendar.findEvents(objCb.successCallback,
929 objCb.errorCallback, {id: event.id});
931 for (var i in newValues) {
932 TestEngine.log("update property: " + i + ", new value: " + newValues[i]);
933 event[i] = newValues[i];
935 var objCb = TestEngine.registerCallback("updateEvent",
936 onSuccessUpdateEvent1,
938 TestCalendar.calendar.updateEvent(objCb.successCallback,
944 var objCb = TestEngine.registerCallback("findEvents",
945 onSuccessFindAllEvents,
947 TestCalendar.calendar.findEvents(objCb.successCallback,
948 objCb.errorCallback);
952 test_updateEvent1: function()
955 description:'updated description 1',
956 summary:'Updated Test Event 1',
957 startTime: new Date(2011, 01, 01, 01, 01),
960 categories: ["SPRC 1"],
961 recurrence: deviceapis.pim.calendar.NO_RECURRENCE,
964 status: deviceapis.pim.calendar.TENTATIVE_STATUS,
966 alarmType: deviceapis.pim.calendar.NO_ALARM
968 TestCalendar.updateEvent(newValues)
972 test_updateEvent2: function()
975 description:'updated description 2',
976 summary:'Updated Test Event 2',
977 startTime: new Date(2012, 02, 02, 02, 02),
980 categories: ["SPRC 2"],
981 recurrence: deviceapis.pim.calendar.DAILY_RECURRENCE,
984 status: deviceapis.pim.calendar.CONFIRMED_STATUS,
986 alarmType: deviceapis.pim.calendar.SILENT_ALARM
988 TestCalendar.updateEvent(newValues)
992 test_updateEvent3: function()
995 description:'updated description 3',
996 summary:'Updated Test Event 3',
997 startTime: new Date(2013, 03, 03, 03, 03),
1001 recurrence: deviceapis.pim.calendar.WEEKLY_RECURRENCE,
1004 status: deviceapis.pim.calendar.CANCELLED_STATUS,
1006 alarmType: deviceapis.pim.calendar.SOUND_ALARM
1008 TestCalendar.updateEvent(newValues)
1012 test_updateEvent4: function()
1015 description:'updated description 4',
1016 summary:'Updated Test Event 4',
1017 startTime: new Date(2014, 04, 04, 04, 04),
1019 location:'London 4',
1020 categories: ["SPRC 4"],
1021 recurrence: deviceapis.pim.calendar.MONTHLY_RECURRENCE,
1022 expires: new Date(2015, 03, 03, 03, 03),
1024 status: deviceapis.pim.calendar.CANCELLED_STATUS,
1026 alarmType: deviceapis.pim.calendar.SOUND_ALARM
1028 TestCalendar.updateEvent(newValues)
1032 test_updateEvent5: function()
1035 description:'updated description 5',
1036 summary:'Updated Test Event 5',
1037 startTime: new Date(2015, 05, 05, 05, 05),
1039 location:'London 5',
1040 categories: ["SPRC 5"],
1041 recurrence: deviceapis.pim.calendar.YEARLY_RECURRENCE,
1042 expires: new Date(2016, 03, 03, 03, 03),
1044 status: deviceapis.pim.calendar.CANCELLED_STATUS,
1046 alarmType: deviceapis.pim.calendar.SOUND_ALARM
1048 TestCalendar.updateEvent(newValues)
1052 test_updateEventNoParams: function()
1054 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "updateEvent");
1058 test_updateEventNullCallbacksParams: function()
1060 var event = TestCalendar.createTestEvent();
1061 testNoExceptionWithMessage("updateEvent() null callbacks",
1064 TestCalendar.calendar.updateEvent(null, null, event);
1067 testNoExceptionWithMessage("updateEvent() undefined callbacks",
1070 TestCalendar.calendar.updateEvent(undefined, undefined, event);
1073 testNoExceptionWithMessage("updateEvent() undefined success callback, null error callback",
1076 TestCalendar.calendar.updateEvent(undefined, null, event);
1079 testNoExceptionWithMessage("updateEvent() null success callback, undefined error callback",
1082 TestCalendar.calendar.updateEvent(null, undefined, event);
1085 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "updateEvent", 1, undefined, event);
1086 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "updateEvent", "test", undefined, event);
1087 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "updateEvent", undefined, 1, event);
1088 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "updateEvent", undefined, "test", event);
1092 test_updateEventWrongEventParam: function()
1094 function onUnexpectedCallback()
1096 TestEngine.test("updateEvent() unexpected callback", false);
1098 function onSuccess()
1100 TestEngine.test("updateEvent() unexpected success callback invoked", false);
1103 function onError(response)
1105 TestEngine.test("updateEvent() error callback invoked", response.code == INVALID_VALUES_ERR);
1108 var objCb = TestEngine.registerCallback("Update event with undefined filter param",
1111 TestCalendar.calendar.updateEvent(objCb.successCallback,
1112 objCb.errorCallback, null);
1114 objCb = TestEngine.registerCallback("Update event with undefined filter param",
1117 TestCalendar.calendar.updateEvent(objCb.successCallback,
1118 objCb.errorCallback, undefined);
1120 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "updateEvent",
1121 onUnexpectedCallback, onUnexpectedCallback, 22);
1122 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "updateEvent",
1123 onUnexpectedCallback, onUnexpectedCallback, "test");
1124 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "updateEvent",
1125 onUnexpectedCallback, onUnexpectedCallback);
1126 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "updateEvent",
1127 onUnexpectedCallback, onUnexpectedCallback, new Date());
1131 test_deleteEvent: function()
1133 var foundEventsFlag = 0;
1137 TestEngine.test("deleteEvent() error callback invoked", false);
1140 function onSuccessDeleteEvent()
1142 TestEngine.test("deleteEvent() success callback invoked", true);
1146 function onSuccessFindEvents(response)
1148 TestEngine.log("deleteEvent() callback entered");
1149 if (foundEventsFlag == 0) {
1150 //this validation is only for the first call
1151 TestEngine.test("Events for delete found", response.length > 0);
1153 foundEventsFlag = 1;
1154 if (response.length > 0) {
1155 var objCb = TestEngine.registerCallback("deleteEvents",
1156 onSuccessDeleteEvent,
1158 TestCalendar.calendar.deleteEvent(objCb.successCallback,
1159 objCb.errorCallback, response[0].id);
1162 TestEngine.test("All events deleted", true);
1166 function findEvents()
1169 var objCb = TestEngine.registerCallback("deleteEvent",
1170 onSuccessFindEvents,
1172 TestCalendar.calendar.findEvents(objCb.successCallback,
1173 objCb.errorCallback);
1175 //recursively delete all events
1180 test_deleteEventNoParams: function()
1182 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "deleteEvent");
1186 test_deleteEventNullCallbacksParams: function()
1188 testNoExceptionWithMessage("deleteEvent() null callbacks",
1191 TestCalendar.calendar.deleteEvent(null, null, "1");
1194 testNoExceptionWithMessage("deleteEvent() undefined callbacks",
1197 TestCalendar.calendar.deleteEvent(undefined, undefined, event);
1200 testNoExceptionWithMessage("deleteEvent() undefined success callback, null error callback",
1203 TestCalendar.calendar.deleteEvent(undefined, null, event);
1206 testNoExceptionWithMessage("deleteEvent() null success callback, undefined error callback",
1209 TestCalendar.calendar.deleteEvent(null, undefined, event);
1212 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "deleteEvent", 1, undefined, "1");
1213 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "deleteEvent", "test", undefined, "1");
1214 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "deleteEvent", undefined, 1, "1");
1215 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "deleteEvent", undefined, "test", "1");
1219 test_deleteEventWrongEventParam: function()
1221 function onUnexpectedCallback()
1223 TestEngine.test("deleteEvent() unexpected callback", false);
1225 function onSuccess()
1227 TestEngine.test("deleteEvent() unexpected success callback invoked", false);
1230 function onError(response)
1232 TestEngine.test("deleteEvent() error callback invoked", response.code == NOT_FOUND_ERR);
1235 var objCb = TestEngine.registerCallback("Delete event with null filter param",
1238 TestCalendar.calendar.deleteEvent(objCb.successCallback,
1239 objCb.errorCallback, null);
1241 objCb = TestEngine.registerCallback("Delete event with undefined filter param",
1244 TestCalendar.calendar.deleteEvent(objCb.successCallback,
1245 objCb.errorCallback, undefined);
1247 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "deleteEvent",
1248 onUnexpectedCallback, onUnexpectedCallback, 22);
1249 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "deleteEvent",
1250 onUnexpectedCallback, onUnexpectedCallback);
1251 TestEngine.catchErrorType("code", TYPE_MISMATCH_ERR, TestCalendar.calendar, "deleteEvent",
1252 onUnexpectedCallback, onUnexpectedCallback, new Date());
1255 test_concatCategoryArray: function()
1257 var category1 = "SPRC category";
1258 var category2 = "test";
1259 var category3 = "test2";
1260 var category4 = "test aaa";
1261 var event = TestCalendar.createTestEvent();
1262 TestEngine.test("category array is empty", event.categories.length === 0);
1263 event.categories[0] = category1;
1264 TestEngine.test("category array has one element", event.categories.length === 1);
1265 TestEngine.test("category array has proper value", event.categories[0] === category1);
1266 var concatArray = event.categories.concat([category2, category3]);
1267 TestEngine.test("concatenated category array has three elements", concatArray.length === 3);
1268 TestEngine.test("concatenated category array has proper value [0]", concatArray[0] === category1);
1269 TestEngine.test("concatenated category array has proper value [1]", concatArray[1] === category2);
1270 TestEngine.test("concatenated category array has proper value [2]", concatArray[2] === category3);
1271 concatArray = event.categories.concat([category2, category3], [category4]);
1272 TestEngine.test("concatenated category array has four elements", concatArray.length === 4);
1273 TestEngine.test("concatenated category array has proper value [0]", concatArray[0] === category1);
1274 TestEngine.test("concatenated category array has proper value [1]", concatArray[1] === category2);
1275 TestEngine.test("concatenated category array has proper value [2]", concatArray[2] === category3);
1276 TestEngine.test("concatenated category array has proper value [3]", concatArray[3] === category4);
1277 TestEngine.test("category array still has one element", event.categories.length === 1);
1280 test_joinCategoryArray: function()
1282 var category1 = "category0";
1283 var category2 = "category1";
1284 var category3 = "category2";
1285 var event = TestCalendar.createTestEvent();
1286 TestEngine.test("category array is empty", event.categories.length === 0);
1287 event.categories[0] = category1;
1288 event.categories[1] = category2;
1289 event.categories[2] = category3;
1290 TestEngine.test("category array has three elements", event.categories.length === 3);
1291 TestEngine.test("joining with default separator", event.categories.join() === category1 + "," + category2 + "," + category3);
1292 TestEngine.test("joining with space separator", event.categories.join(" ") === category1 + " " + category2 + " " + category3);
1293 TestEngine.test("joining with longer string separator", event.categories.join(" how about ") === category1 + " how about " + category2 + " how about " + category3);
1294 TestEngine.test("category array still has three elements", event.categories.length === 3);
1297 test_popCategoryArray: function()
1299 var category1 = "category0";
1300 var category2 = "category1";
1301 var category3 = "category2";
1302 var event = TestCalendar.createTestEvent();
1303 TestEngine.test("category array is empty", event.categories.length === 0);
1304 event.categories[0] = category1;
1305 event.categories[1] = category2;
1306 event.categories[2] = category3;
1307 TestEngine.test("category array has three elements", event.categories.length === 3);
1308 TestEngine.test("poped element has correct value", event.categories.pop() === category3);
1309 TestEngine.test("category array has three elements", event.categories.length === 2);
1310 TestEngine.test("poped element has correct value", event.categories.pop() === category2);
1311 TestEngine.test("category array has three elements", event.categories.length === 1);
1312 TestEngine.test("poped element has correct value", event.categories.pop() === category1);
1313 TestEngine.test("category array has three elements", event.categories.length === 0);
1314 TestEngine.test("poped element has correct value", event.categories.pop() === undefined);
1315 TestEngine.test("poped element has correct value", event.categories.pop() === undefined);
1318 test_pushCategoryArray: function()
1320 var category1 = "category0";
1321 var category2 = "category1";
1322 var category3 = "category2";
1323 var event = TestCalendar.createTestEvent();
1324 TestEngine.test("category array is empty", event.categories.length === 0);
1325 event.categories.push(category1);
1326 event.categories.push(category2);
1327 event.categories.push(category3);
1328 TestEngine.test("category array has three elements", event.categories.length === 3);
1329 TestEngine.test("array element [0] has correct value", event.categories[0] === category1);
1330 TestEngine.test("array element [1] has correct value", event.categories[1] === category2);
1331 TestEngine.test("array element [2] has correct value", event.categories[2] === category3);
1334 test_reverseCategoryArray: function()
1336 var category1 = "category0";
1337 var category2 = "category1";
1338 var category3 = "category2";
1339 var category4 = "category3";
1340 var event = TestCalendar.createTestEvent();
1341 TestEngine.test("category array is empty", event.categories.length === 0);
1342 event.categories.push(category1);
1343 event.categories.push(category2);
1344 event.categories.push(category3);
1345 event.categories.push(category4);
1346 event.categories.reverse();
1347 TestEngine.test("category array has four elements", event.categories.length === 4);
1348 TestEngine.test("array element [0] has correct value", event.categories[0] === category4);
1349 TestEngine.test("array element [1] has correct value", event.categories[1] === category3);
1350 TestEngine.test("array element [2] has correct value", event.categories[2] === category2);
1351 TestEngine.test("array element [3] has correct value", event.categories[3] === category1);
1354 test_shiftCategoryArray: function()
1356 var category1 = "category0";
1357 var category2 = "category1";
1358 var category3 = "category2";
1359 var event = TestCalendar.createTestEvent();
1360 TestEngine.test("category array is empty", event.categories.length === 0);
1361 event.categories[0] = category1;
1362 event.categories[1] = category2;
1363 event.categories[2] = category3;
1364 TestEngine.test("category array has three elements", event.categories.length === 3);
1365 TestEngine.test("shifted element has correct value", event.categories.shift() === category1);
1366 TestEngine.test("category array has three elements", event.categories.length === 2);
1367 TestEngine.test("shifted element has correct value", event.categories.shift() === category2);
1368 TestEngine.test("category array has three elements", event.categories.length === 1);
1369 TestEngine.test("shifted element has correct value", event.categories.shift() === category3);
1370 TestEngine.test("category array has three elements", event.categories.length === 0);
1371 TestEngine.test("shifted element has correct value", event.categories.shift() === undefined);
1372 TestEngine.test("shifted element has correct value", event.categories.shift() === undefined);
1375 test_sliceCategoryArray: function()
1377 var category1 = "category0";
1378 var category2 = "category1";
1379 var category3 = "category2";
1380 var event = TestCalendar.createTestEvent();
1381 TestEngine.test("category array is empty", event.categories.length === 0);
1382 event.categories[0] = category1;
1383 event.categories[1] = category2;
1384 event.categories[2] = category3;
1385 TestEngine.test("category array has three elements", event.categories.length === 3);
1386 var slice = event.categories.slice(0, 2);
1387 TestEngine.test("slice array has correct number of elements", slice.length === 3);
1388 slice = event.categories.slice(0, 1);
1389 TestEngine.test("slice array has correct number of elements", slice.length === 2);
1390 slice = event.categories.slice(0, 0);
1391 TestEngine.test("slice array has correct number of elements", slice.length === 1);
1392 slice = event.categories.slice(0);
1393 TestEngine.test("slice array has correct number of elements", slice.length === 3);
1394 slice = event.categories.slice(1);
1395 TestEngine.test("slice array has correct number of elements", slice.length === 2);
1396 slice = event.categories.slice(2);
1397 TestEngine.test("slice array has correct number of elements", slice.length === 1);
1398 slice = event.categories.slice(3);
1399 TestEngine.test("slice array has correct number of elements", slice.length === 0);
1402 test_sortCategoryArray: function()
1404 var category1 = "category0";
1405 var category2 = "category1";
1406 var category3 = "category2";
1407 var event = TestCalendar.createTestEvent();
1408 TestEngine.test("category array is empty", event.categories.length === 0);
1409 event.categories[0] = category3;
1410 event.categories[1] = category2;
1411 event.categories[2] = category1;
1412 TestEngine.test("category array has three elements", event.categories.length === 3);
1413 event.categories.sort();
1414 TestEngine.test("category array has three elements", event.categories.length === 3);
1415 TestEngine.test("array element [0] has correct value", event.categories[0] === category1);
1416 TestEngine.test("array element [1] has correct value", event.categories[1] === category2);
1417 TestEngine.test("array element [2] has correct value", event.categories[2] === category3);
1420 test_toStringCategoryArray: function()
1422 var category1 = "category0";
1423 var category2 = "category1";
1424 var category3 = "category2";
1425 var event = TestCalendar.createTestEvent();
1426 TestEngine.test("category array is empty", event.categories.length === 0);
1427 event.categories[0] = category1;
1428 event.categories[1] = category2;
1429 event.categories[2] = category3;
1430 TestEngine.test("category array has three elements", event.categories.length === 3);
1431 TestEngine.test("toString return correct value", event.categories.join() === category1 + "," + category2 + "," + category3);
1434 //=============================================================================
1435 TestEngine.setTestSuiteName("[WAC2.0][Calendar]");
1437 //TestEngine.addTest(true,TestCalendar.test_modulePresence, "[WAC2.0][Calendar] Test calendar module presence");
1439 //TestEngine.addTest(true,TestCalendar.test_calendarManagerConstants, "[WAC2.0][Calendar] Calendar manager constants");
1441 TestEngine.addTest(true,TestCalendar.test_getCalendar, "[WAC2.0][Calendar] Get calendar");
1443 //TestEngine.addTest(true,TestCalendar.test_getCalendarNoCallbacks, "[WAC2.0][Calendar] Get calendar with no callbacks");
1445 //TestEngine.addTest(true,TestCalendar.test_getCalendarInvalidCallbacks, "[WAC2.0][Calendar] Get calendar with invalid callbacks");
1447 //TestEngine.addTest(true,TestCalendar.test_calendarMethodsPresence, "[WAC2.0][Calendar] Calendar methods presence");
1449 //TestEngine.addTest(true,TestCalendar.test_getCalendarName, "[WAC2.0][Calendar] Get calendar name");
1451 //TestEngine.addTest(true,TestCalendar.test_getCalendarType, "[WAC2.0][Calendar] Get calendar type");
1453 //TestEngine.addTest(true,TestCalendar.test_createEmptyEvent, "[WAC2.0][Calendar] Create empty event");
1455 //TestEngine.addTest(true,TestCalendar.test_eventAttributes, "[WAC2.0][Calendar] event attributes");
1457 //TestEngine.addTest(true,TestCalendar.test_createEvent, "[WAC2.0][Calendar] Create event");
1460 //TestEngine.addTest(true,TestCalendar.test_addEvent1, "[WAC2.0][Calendar] Add event 1");
1462 //TestEngine.addTest(true,TestCalendar.test_addEvent2, "[WAC2.0][Calendar] Add event 2");
1464 //TestEngine.addTest(true,TestCalendar.test_addEvent3, "[WAC2.0][Calendar] Add event 3");
1466 //TestEngine.addTest(true,TestCalendar.test_addEvent4, "[WAC2.0][Calendar] Add event 4");
1468 //TestEngine.addTest(true,TestCalendar.test_addEvent5, "[WAC2.0][Calendar] Add event 5");
1470 //TestEngine.addTest(true,TestCalendar.test_addEvent6, "[WAC2.0][Calendar] Add event 6");
1472 //TestEngine.addTest(true,TestCalendar.test_addEventNoParams, "[WAC2.0][Calendar] Add event with no params");
1474 //TestEngine.addTest(true,TestCalendar.test_addEventInvalidCallbacksParams, "[WAC2.0][Calendar] Add event with wrong callbacks");
1476 //TestEngine.addTest(true,TestCalendar.test_addEventWrongEventParam, "[WAC2.0][Calendar] Add event with wrong event param");
1479 //TestEngine.addTest(true,TestCalendar.test_findAllEvents, "[WAC2.0][Calendar] Find all events");
1481 //TestEngine.addTest(true,TestCalendar.test_findEventsId, "[WAC2.0][Calendar] Find events, filter: id");
1483 //TestEngine.addTest(true,TestCalendar.test_findEventsSummary, "[WAC2.0][Calendar] Find events, filter: summary");
1485 //TestEngine.addTest(true,TestCalendar.test_findEventsDescription, "[WAC2.0][Calendar] Find events, filter: description");
1487 //TestEngine.addTest(true,TestCalendar.test_findEventsLocation, "[WAC2.0][Calendar] Find events, filter: location");
1489 //TestEngine.addTest(true,TestCalendar.test_findEventsCategory, "[WAC2.0][Calendar] Find events, filter: category");
1491 //TestEngine.addTest(true,TestCalendar.test_findEventsStatus, "[WAC2.0][Calendar] Find events, filter: status");
1493 //TestEngine.addTest(true,TestCalendar.test_findEventsFullStartTime, "[WAC2.0][Calendar] Find events, filter: initialStartDate and endStartDate");
1495 //TestEngine.addTest(true,TestCalendar.test_findEventsInitialStartDate, "[WAC2.0][Calendar] Find events, filter: initialStartDate");
1497 //TestEngine.addTest(true,TestCalendar.test_findEventsEndStartDate, "[WAC2.0][Calendar] Find events, filter: endStartDate");
1499 //TestEngine.addTest(true,TestCalendar.test_findEventsEmptyFilter, "[WAC2.0][Calendar] Find events, filter: empty filter");
1501 //TestEngine.addTest(true,TestCalendar.test_findEventsFullStartTimeNoResults, "[WAC2.0][Calendar] Find events, no results, filter: initialStartDate and endStartDate");
1503 //TestEngine.addTest(true,TestCalendar.test_findEventsLocationNoResults, "[WAC2.0][Calendar] Find events, no results, filter: location");
1505 //TestEngine.addTest(true,TestCalendar.test_findEventsSummaryNoResults, "[WAC2.0][Calendar] Find events, no results, filter: summary");
1507 //TestEngine.addTest(true,TestCalendar.test_findEventsDescriptionNoResults, "[WAC2.0][Calendar] Find events, no results, filter: description");
1509 //TestEngine.addTest(true,TestCalendar.test_findEventsIdNoResults, "[WAC2.0][Calendar] Find events, no results, filter: id");
1511 //TestEngine.addTest(true,TestCalendar.test_findEventsCategoryNoResults, "[WAC2.0][Calendar] Find events, no results, filter: category");
1513 //TestEngine.addTest(true,TestCalendar.test_findEventsNoParams, "[WAC2.0][Calendar] Find events with no params");
1515 //TestEngine.addTest(true,TestCalendar.test_findEventsNoCallbacksParams, "[WAC2.0][Calendar] Find events with no callbacks");
1517 //TestEngine.addTest(true,TestCalendar.test_findEventsWrongFilterParam, "[WAC2.0][Calendar] Find events with wrong filter param");
1520 //TestEngine.addTest(true,TestCalendar.test_updateEvent1, "[WAC2.0][Calendar] Update event 1");
1522 //TestEngine.addTest(true,TestCalendar.test_updateEvent2, "[WAC2.0][Calendar] Update event 2");
1524 //TestEngine.addTest(true,TestCalendar.test_updateEvent3, "[WAC2.0][Calendar] Update event 3");
1526 //TestEngine.addTest(true,TestCalendar.test_updateEvent4, "[WAC2.0][Calendar] Update event 4");
1528 //TestEngine.addTest(true,TestCalendar.test_updateEvent5, "[WAC2.0][Calendar] Update event 5");
1530 //TestEngine.addTest(true,TestCalendar.test_updateEventNoParams, "[WAC2.0][Calendar] Update event with no params");
1532 //TestEngine.addTest(true,TestCalendar.test_updateEventNullCallbacksParams, "[WAC2.0][Calendar] Update event with wrong callbacks");
1534 //TestEngine.addTest(true,TestCalendar.test_updateEventWrongEventParam, "[WAC2.0][Calendar] Update event with wrong event param");
1537 //TestEngine.addTest(true,TestCalendar.test_deleteEvent, "[WAC2.0][Calendar] Delete event");
1539 //TestEngine.addTest(true,TestCalendar.test_deleteEventNoParams, "[WAC2.0][Calendar] Delete event with no params");
1541 //TestEngine.addTest(true,TestCalendar.test_deleteEventNullCallbacksParams, "[WAC2.0][Calendar] Delete event with wrong callbacks");
1543 //TestEngine.addTest(true,TestCalendar.test_deleteEventWrongEventParam, "[WAC2.0][Calendar] Delete event with wrong event param");
1546 //TestEngine.addTest(true,TestCalendar.test_concatCategoryArray, "[WAC2.0][Calendar] Concat category array");
1548 //TestEngine.addTest(true,TestCalendar.test_joinCategoryArray, "[WAC2.0][Calendar] Join category array");
1550 //TestEngine.addTest(true,TestCalendar.test_popCategoryArray, "[WAC2.0][Calendar] Pop category array");
1552 //TestEngine.addTest(true,TestCalendar.test_pushCategoryArray, "[WAC2.0][Calendar] Push category array");
1554 //TestEngine.addTest(true,TestCalendar.test_reverseCategoryArray, "[WAC2.0][Calendar] Reverse category array");
1556 //TestEngine.addTest(true,TestCalendar.test_shiftCategoryArray, "[WAC2.0][Calendar] Shift category array");
1558 //TestEngine.addTest(true,TestCalendar.test_sliceCategoryArray, "[WAC2.0][Calendar] Slice category array");
1560 //TestEngine.addTest(true,TestCalendar.test_sortCategoryArray, "[WAC2.0][Calendar] Sort category array");
1562 //TestEngine.addTest(true,TestCalendar.test_toStringCategoryArray, "[WAC2.0][Calendar] toString category array");
1564 //=============================================================================
1566 function testNoExceptionWithMessage(message, fun) {
1567 var testResult = true;
1576 TestEngine.test(message, testResult);