1 //
2 // simple test bits
3 //
4
5
6 const eventContractID = "@mozilla.org/calendar/event;1";
7 const eventIID = Components.interfaces.calIEvent;
8
9 dump ("Creating mutable event...\n");
10 var me = Components.classes[eventContractID].createInstance(eventIID);
11
12 me.title = "Test Title";
13 dump ("Title is: " + me.title + " (jsobj: " + me.wrappedJSObject.mTitle + ")\n");
14 if (me.title != "Test Title") {
15 throw("FAILED! Title on mutable event contained unexpected value.");
16 }
17
18 dump ("Setting event-to be non-mutable...\n");
19 me.makeImmutable();
20
21 dump ("Trying to set title (should fail)\n");
22 try {
23 // this should cause an exception
24 me.title = "Fail";
25
26 // so we'll only get here if something is wrong, and there's no exception
27 dump("FAILED\n!");
28 } catch (ex) {
29 }
30
31 if (me.title != "Test Title") {
32 throw("FAILED! Title on immutable event contained unexpected value: "
33 + me.title);
34 }