• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{{header}}
2{{object 1 0}} <<
3  /Type /Catalog
4  /Pages 2 0 R
5  /OpenAction 10 0 R
6>>
7endobj
8{{object 2 0}} <<
9  /Type /Pages
10  /Count 1
11  /Kids [
12    3 0 R
13  ]
14>>
15endobj
16% Page number 0.
17{{object 3 0}} <<
18  /Type /Page
19  /Parent 2 0 R
20  /Resources <<
21    /Font <</F1 15 0 R>>
22  >>
23  /Contents [21 0 R]
24  /MediaBox [0 0 612 792]
25>>
26% OpenAction action
27{{object 10 0}} <<
28  /Type /Action
29  /S /JavaScript
30  /JS 11 0 R
31>>
32endobj
33% JS program to exexute
34{{object 11 0}} <<
35  {{streamlen}}
36>>
37stream
38function TestOneFormat(str, d) {
39  try {
40    app.alert(str + ": " + util.printd(str, d));
41  }
42  catch (e) {
43    app.alert(str + ": Caught error: " + e);
44  }
45}
46function TestOneXFAFormat(str, d, flag) {
47  try {
48    app.alert(str + ": " + util.printd(str, d, flag));
49  }
50  catch (e) {
51    app.alert(str + ": Caught error: " + e);
52  }
53}
54
55// Invalid arguments.
56try {
57  util.printd();
58} catch (e) {
59  app.alert('PASS: ' + e);
60}
61try {
62  util.printd('mm');
63} catch (e) {
64  app.alert('PASS: ' + e);
65}
66try {
67  util.printd('mm', new Date(undefined));
68} catch (e) {
69  app.alert('PASS: ' + e);
70}
71
72// July 4th, 2014 11:59:59 AM local time.
73var d1 = new Date(2014, 06, 04, 15, 59, 58);
74TestOneFormat("mm/dd/yyyy HH:MM:ss", d1);
75TestOneFormat(0, d1);
76TestOneFormat(1, d1);
77TestOneFormat(2, d1);
78TestOneFormat(3, d1);
79TestOneFormat("mmmm", d1);
80TestOneFormat("mmm", d1);
81TestOneFormat("mm", d1);
82TestOneFormat("m", d1);
83TestOneFormat("dddd", d1);
84TestOneFormat("ddd", d1);
85TestOneFormat("dd", d1);
86TestOneFormat("d", d1);
87TestOneFormat("yyyy", d1);
88TestOneFormat("yy", d1);
89TestOneFormat("HH", d1);
90TestOneFormat("H", d1);
91TestOneFormat("hh", d1);
92// "h" is inconsitent between platforms: " 3" vs. "3"
93TestOneFormat("MM", d1);
94TestOneFormat("M", d1);
95TestOneFormat("ss", d1);
96TestOneFormat("s", d1);
97// "tt" is inconsitent between platforms: "PM" vs, "pm" vs. "P"
98TestOneFormat("t", d1);
99TestOneFormat("abc.efg.i.kl.nopqr..uvwxyzABC.EFG.I.KL.NOPQR..UVWXYZ0123456780", d1);
100TestOneFormat("!@#$^&*()-_<>[];:~", d1);
101TestOneFormat("%z %d %%z %%d %%%z %%%d %%% hh:MM", d1);
102TestOneFormat("", d1);
103TestOneFormat("mm/dd/yyyy", d1);
104TestOneFormat("mm/dd/yyyy", new Date(1850, 0, 1));
105TestOneFormat("mm/dd/yyyy", new Date(2525, 11, 31));
106TestOneFormat("mm/dd/yyyy");
107TestOneFormat();
108TestOneFormat("mm/dd/yyyy", 42);
109TestOneFormat("mm/dd/yyyy", "clams");
110TestOneFormat("mm/dd/yyyy", {"clams": 3});
111TestOneFormat("mm/dd/yyyy", ["clams", 3]);
112TestOneFormat({"clams": 3}, d1);
113TestOneFormat(["clams", 3], d1);
114TestOneXFAFormat("mm", d1, false);
115TestOneXFAFormat("mm", d1, true);
116
117// Date with year 0.
118// TODO(thestig): Why is the output different from Acrobat?
119TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(0, 06, 04, 15, 59, 58));
120// Date with month 20.
121TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 20, 04, 15, 59, 58));
122// Date with day 100.
123TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 20, 100, 15, 59, 58));
124// Date with hour 50
125TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 50, 59, 58));
126// Date with minute 1234.
127TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, 1234, 58));
128// Date with second 65.
129TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, 59, 65));
130// Date with April 31th.
131TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 03, 31, 15, 59, 58));
132// Date with February 30th.
133TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 01, 30, 15, 59, 58));
134// Date with negative year.
135// Acrobat prints out "07/04/-001 15:59:58" but handling this rarely used case
136// outside of FXSYS_wcsftime() is a lot of work.
137TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(-1, 06, 04, 15, 59, 58));
138// Date with negative month.
139TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, -1, 30, 15, 59, 58));
140// Date with negative day.
141TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, -1, 15, 59, 58));
142// Date with negative hour.
143TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, -1, 59, 58));
144// Date with negative minute.
145TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, -1, 58));
146// Date with negative second.
147TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, 59, -1));
148endstream
149endobj
150{{xref}}
151{{trailer}}
152{{startxref}}
153%%EOF
154