xref: /aosp_15_r20/external/pdfium/testing/resources/javascript/annot_properties.in (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1{{header}}
2{{object 1 0}} <<
3  /Type /Catalog
4  /Pages 2 0 R
5  /OpenAction 20 0 R
6>>
7endobj
8{{object 2 0}} <<
9  /Type /Pages
10  /Count 1
11  /Kids [10 0 R]
12>>
13endobj
14{{object 10 0}} <<
15  /Type /Page
16  /Parent 2 0 R
17  /MediaBox [0 0 612 792]
18  /Annots [22 0 R]
19  /Tabs /R
20>>
21endobj
22{{object 20 0}} <<
23  /Type /Action
24  /S /JavaScript
25  /JS 21 0 R
26>>
27endobj
28{{object 21 0}} <<
29  {{streamlen}}
30>>
31stream
32app.alert("Test that non-existent annot fetch gives error");
33try {
34  var nonesuch = this.getAnnot(0, "nonesuch");
35  app.alert("nonesuch: " + typeof nonesuch);
36} catch (e) {
37  app.alert("SUCCESS: " + e);
38}
39app.alert("Test initial cases");
40try {
41  var annot = this.getAnnot(0, "Annot-1");
42  app.alert("annot: " + typeof annot);
43  app.alert("hidden: " + annot.hidden);
44  app.alert("name: " + annot.name);
45  app.alert("type: " + annot.type);
46
47  annot.hidden = true;
48  app.alert("hidden now: " + annot.hidden);
49  annot.hidden = false;
50  app.alert("hidden now: " + annot.hidden);
51
52  annot.name = "nonesuch";
53  app.alert("name now: " + annot.name);
54} catch (e) {
55  app.alert("ERROR: " + e);
56}
57app.alert("Test assigment to read-only property gives error");
58try {
59  annot.type = 42;
60} catch (e) {
61  app.alert("SUCCESS: " + e);
62}
63app.alert("Test lookup after name change gives error");
64try {
65  annot = this.getAnnot(0, "Annot-1");
66  app.alert("annot after name change: " + typeof annot);
67} catch (e) {
68  app.alert("SUCCESS: " + e);
69}
70app.alert("Test lookup under changed name");
71try {
72  nonesuch = this.getAnnot(0, "nonesuch");
73  app.alert("nonesuch after name change: " + typeof nonesuch);
74} catch (e) {
75  app.alert("ERROR: " + e);
76}
77app.alert("Test setting empty name under changed name");
78try {
79  var annot = this.getAnnot(0, "nonesuch");
80  annot.name = "";
81  app.alert("name after empty name change: " + annot.name);
82} catch (e) {
83  app.alert("ERROR: " + e);
84}
85
86endstream
87endobj
88{{object 22 0}} <<
89  /Type /Annot
90  /Subtype /Highlight
91  /Rect [475 681 512 690]
92  /NM (Annot-1)
93  /F 2
94  /QuadPoints [475 688 512 688 475 679 512 679]
95  /C [0.0001108646 0.001760244 0.9982184]
96  /Contents ()
97>>
98endobj
99{{xref}}
100{{trailer}}
101{{startxref}}
102%%EOF
103