xref: /aosp_15_r20/external/pdfium/testing/resources/javascript/util_printx.in (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
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>>
26endobj
27% OpenAction action
28{{object 10 0}} <<
29  /Type /Action
30  /S /JavaScript
31  /JS 11 0 R
32>>
33endobj
34% JS program to execute
35{{object 11 0}} <<
36  {{streamlen}}
37>>
38stream
39function TestOneFormat(fmt, src) {
40  var title = "('" + fmt + "', '" + src + "')";
41  try {
42    app.alert(title +  " => '" + util.printx(fmt, src) + "'");
43  }
44  catch (e) {
45    app.alert(title + ": Caught error: " + e);
46  }
47}
48
49// Error cases
50try {
51  util.printx();
52} catch (e) {
53  app.alert('PASS: ' + e);
54}
55try {
56  util.printx("99");
57} catch (e) {
58  app.alert('PASS: ' + e);
59}
60
61TestOneFormat("", "");
62TestOneFormat("", "123");
63TestOneFormat("??", "");
64TestOneFormat("??", "f2");
65TestOneFormat("??", "f27");
66TestOneFormat("XXX", "");
67TestOneFormat("XXX", "1afp3.");
68TestOneFormat("XXX", "-1Afp3.d33F$");
69TestOneFormat("AAA", "");
70TestOneFormat("AAA", "-1Afp3.");
71TestOneFormat("AAA", "-1Afp3.d33F$");
72TestOneFormat("999", "");
73TestOneFormat("999", "-1Afp3.");
74TestOneFormat("999", "-1Afp3.d33F$");
75TestOneFormat("9*9", "");
76TestOneFormat("9*9", "-1Afp3.");
77TestOneFormat("[*]X", "-1Afp3.");
78TestOneFormat("<*", "-1Afp3.d33F$");
79TestOneFormat(">*", "-1Afp3.d33F$");
80TestOneFormat("<[AAAAAAAAAAA]", "-1Afp3.d33F$");
81TestOneFormat(">[AAAAAAAAAAA]", "-1Afp3.d33F$");
82TestOneFormat("<[XXXXXXXXXXX]", "-1Afp3.d33F$");
83TestOneFormat(">[XXXXXXXXXXX]", "-1Afp3.d33F$");
84TestOneFormat("<[XXXXXXXXXXX]", "-1Afp3.d33F$");
85TestOneFormat(">[???????????]", "-1Afp3.d33F$");
86TestOneFormat("<[???????????]", "-1Afp3.d33F$");
87TestOneFormat("\\>[\\**]", "-1Afp3.d33F$");
88TestOneFormat("\\>[\\\\**]", "-1Afp3.d33F$");
89TestOneFormat("=*", "-1Afp3.d33F$");
90TestOneFormat("<??????=*", "-1Afp3.d33F$");
91TestOneFormat(">??????=*", "-1Afp3.d33F$");
92TestOneFormat(">??????<*", "-1Afp3.d33F$");
93TestOneFormat("clams", "-1Afp3.d33F$");
94TestOneFormat("cl9ms", "-1Afp3.d33F$");
95TestOneFormat("cl\\9ms", "-1Afp3.d33F$");
96endstream
97endobj
98{{xref}}
99{{trailer}}
100{{startxref}}
101%%EOF
102