/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

function run_test() {
    var f = cal.createEvent();

    var str =
         ["BEGIN:VCALENDAR",
          "PRODID:-//RDU Software//NONSGML HandCal//EN",
          "VERSION:2.0",
          "BEGIN:VTIMEZONE",
          "TZID:America/New_York",
          "BEGIN:STANDARD",
          "DTSTART:19981025T020000",
          "TZOFFSETFROM:-0400",
          "TZOFFSETTO:-0500",
          "TZNAME:EST",
          "END:STANDARD",
          "BEGIN:DAYLIGHT",
          "DTSTART:19990404T020000",
          "TZOFFSETFROM:-0500",
          "TZOFFSETTO:-0400",
          "TZNAME:EDT",
          "END:DAYLIGHT",
          "END:VTIMEZONE",
          "BEGIN:VEVENT",
          "DTSTAMP:19980309T231000Z",
          "UID:guid-1.example.com",
          "ORGANIZER:mailto:mrbig@example.com",
          "ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:",
          " mailto:employee-A@example.com",
          "DESCRIPTION:Project XYZ Review Meeting",
          "CATEGORIES:MEETING",
          "CLASS:PUBLIC",
          "CREATED:19980309T130000Z",
          "SUMMARY:XYZ Project Review",
          "DTSTART;TZID=America/New_York:19980312T083000",
          "DTEND;TZID=America/New_York:19980312T093000",
          "LOCATION:1CP Conference Room 4350",
          "END:VEVENT",
          "END:VCALENDAR",].join("\r\n");

    var strTz =
         ["BEGIN:VTIMEZONE",
          "TZID:America/New_York",
          "BEGIN:STANDARD",
          "DTSTART:19981025T020000",
          "TZOFFSETFROM:-0400",
          "TZOFFSETTO:-0500",
          "TZNAME:EST",
          "END:STANDARD",
          "BEGIN:DAYLIGHT",
          "DTSTART:19990404T020000",
          "TZOFFSETFROM:-0500",
          "TZOFFSETTO:-0400",
          "TZNAME:EDT",
          "END:DAYLIGHT",
          "END:VTIMEZONE",].join("\r\n");

    let tzs = cal.getTimezoneService();

    f.icalString = str;

    let g = f.startDate;
    let h = f.endDate;

    g.timezone = tzs.getTimezone(g.timezone.tzid);
    h.timezone = tzs.getTimezone(h.timezone.tzid);
    notEqual(strTz,g.timezone.toString());
}

