• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{{header}}
2{{include ../../xfa_catalog_1_0.fragment}}
3{{include ../../xfa_object_2_0.fragment}}
4{{include ../../xfa_preamble_3_0.fragment}}
5{{include ../../xfa_config_4_0.fragment}}
6{{object 5 0}} <<
7  {{streamlen}}
8>>
9stream
10<template>
11  <subform layout="tb" name="my_doc">
12    <pageSet id="page" relation="orderedOccurrence">
13      <occur initial="1" max="1" min="1"/>
14      <pageArea id="Page1" name="Page1">
15        <occur max="1" min="1"/>
16        <contentArea h="100mm" w="200mm" x="0.25in" y="0.25in"/>
17      </pageArea>
18      <pageArea id="Page2" name="Page2">
19        <occur max="1" min="1"/>
20        <contentArea h="100mm" w="200mm" x="0.25in" y="0.25in"/>
21      </pageArea>
22    </pageSet>
23    <event activity="docReady" ref="$host">
24      <script contentType="application/x-javascript">
25        {{include ../expect.js}}
26        {{include ../property_test_helpers.js}}
27        testROProperty(xfa.layout, "ready", true);
28
29        expectError("xfa.layout.absPage()");
30        expectError("xfa.layout.absPage(1, 2)");
31        expect("xfa.layout.absPage(1)", 0);
32
33        expect("xfa.layout.absPageCount()", 2);
34        expect("xfa.layout.absPageCount('args', [42], 'ignored')", 2);
35
36        expect("xfa.layout.absPageCountInBatch()", 0);
37        expect("xfa.layout.absPageCountInBatch('args', [42], 'ignored')", 0);
38
39        expectError("xfa.layout.absPageInBatch()");
40        expectError("xfa.layout.absPageInBatch(1, 2)");
41        expect("xfa.layout.absPageInBatch(1)", 0);
42
43        expectError("xfa.layout.absPageSpan()");
44        expectError("xfa.layout.absPageSpan(1, 2)");
45        expect("xfa.layout.absPageSpan(1)");
46
47        expectError("xfa.layout.h()");
48        expectError("xfa.layout.h(4, 'is', 'toomany', 'args')");
49        expectError("xfa.layout.h(my_doc, 'bogounits')", 0);
50        expect("xfa.layout.h(my_doc, 'cm')", 0);
51        expect("xfa.layout.h(my_doc, 'in', 2)", 0);
52
53        expectError("xfa.layout.page()");
54        expectError("xfa.layout.page(1, 2)");
55        expect("xfa.layout.page(my_doc)", 1);
56
57        expectError("xfa.layout.pageContent()");
58        expectError("xfa.layout.pageContent(4, 'is', 'too', 'many')");
59        expect("xfa.layout.pageContent(1)", "[object XFAObject]");
60        expect("xfa.layout.pageContent(1).length", 2);
61
62        expect("xfa.layout.pageCount()", 2);
63        expect("xfa.layout.pageCount('all', 'args', ['ignored'])", 2);
64
65        expectError("xfa.layout.pageSpan()");
66        expectError("xfa.layout.pageSpan(2, 'toomany')");
67        expect("xfa.layout.pageSpan(my_doc)", 1);
68
69        expect("xfa.layout.relayout()");
70        expect("xfa.layout.relayout('args', ['ignored'], 42)");
71
72        expect("xfa.layout.relayoutPageArea()");
73        expect("xfa.layout.relayoutPageArea('args', ['ignored'], 42)");
74
75        expectError("xfa.layout.sheet()");
76        expectError("xfa.layout.sheet(1, 2)");
77        expect("xfa.layout.sheet(my_doc)", 0);
78
79        expect("xfa.layout.sheetCount()", 2);
80        expect("xfa.layout.sheetCount('args', ['ignored'], 42)", 2);
81
82        expect("xfa.layout.sheetCountInBatch()", 0);
83        expect("xfa.layout.sheetCountInBatch('args', ['ignored'], 42)", 0);
84
85        expectError("xfa.layout.sheetInBatch()");
86        expectError("xfa.layout.sheetInBatch(2, 'toomany')");
87        expect("xfa.layout.sheetInBatch(1)", 0);
88
89        expectError("xfa.layout.w()");
90        expectError("xfa.layout.w(4, 'is', 'toomany', 'args')");
91        expectError("xfa.layout.w(my_doc, 'bogounits')", 0);
92        expect("xfa.layout.w(my_doc, 'cm')", 0);
93        expect("xfa.layout.w(my_doc, 'in', 2)", 0);
94
95        expectError("xfa.layout.x()");
96        expectError("xfa.layout.x(4, 'is', 'toomany', 'args')");
97        expectError("xfa.layout.x(my_doc, 'bogounits')", 0);
98        expect("xfa.layout.x(my_doc, 'cm')", 0);
99        expect("xfa.layout.x(my_doc, 'in', 2)", 0);
100
101        expectError("xfa.layout.y()");
102        expectError("xfa.layout.y(4, 'is', 'toomany', 'args')");
103        expectError("xfa.layout.y(my_doc, 'bogounits')", 0);
104        expect("xfa.layout.y(my_doc, 'cm')", 0);
105        expect("xfa.layout.y(my_doc, 'in', 2)", 0);
106
107        app.alert("finished testing methods");
108      </script>
109    </event>
110  </subform>
111</template>
112endstream
113endobj
114{{include ../../xfa_locale_6_0.fragment}}
115{{include ../../xfa_postamble_7_0.fragment}}
116{{include ../../xfa_pages_8_0.fragment}}
117{{xref}}
118{{trailer}}
119{{startxref}}
120%%EOF
121