1{{header}}
2{{include field.fragment}}
3% JS program to exexute
4{{object 16 0}} <<
5  {{streamlen}}
6>>
7stream
8{{include property_test_helpers.js}}
9function testProperties() {
10  try {
11    var field = this.getField("MyField");
12    var text = this.getField("MyField.MyText");
13    var button = this.getField("MyField.MyPushButton");
14    var radio = this.getField("MyField.MyRadio");
15    var list = this.getField("MyField.MyMultiSelect");
16    var check = this.getField("MyField.MyCheckBox");
17    var file = this.getField("MyField.MyFile");
18    app.alert('Testing properties under delay');
19    testRWProperty(field, "delay", false, true);
20    // TODO(tsepez): try this case, too.
21    app.alert('Testing properties under non-delay');
22    testRWProperty(field, "delay", true, false);
23    testFieldPropertiesCase(field);
24    testTextPropertiesCase(text);
25    testPushButtonPropertiesCase(button);
26    testRadioButtonPropertiesCase(radio);
27    testCheckBoxPropertiesCase(check);
28    testListBoxPropertiesCase(list);
29    testFileSelectPropertiesCase(file);
30  } catch (e) {
31    app.alert("Unexpected error: " + e);
32  }
33}
34
35function testFieldPropertiesCase(field) {
36  testROProperty(field, "name", "MyField");
37  // TODO(tsepez): this is rect of first child somehow.
38  testRWProperty(field, "rect", [200,221,220,201], [100,121,120,101]);
39 // Put it back to where it started.
40  testRWProperty(field, "rect", [100,121,120,101], [200,221,220,201]);
41}
42
43function testTextPropertiesCase(field) {
44  try {
45    // TODO(tsepez): devise tests and uncomment.
46    testRIProperty(field, "alignment", "left", "center");
47    testRWProperty(field, "borderStyle", "solid", "inset");
48    testRIProperty(field, "calcOrderIndex", -1, 100);
49    testRIProperty(field, "charLimit", 0, 100);
50    testRIProperty(field, "comb", false, true);
51    // testRIProperty(field, "commitOnSelChange", false, true);
52    // testROProperty(field, "currentValueIndices", "clams");
53    testXXProperty(field, "defaultStyle");
54    testRIProperty(field, "defaultValue", "grue", "clams");
55    testRIProperty(field, "doNotScroll", false, true);
56    testRIProperty(field, "doNotSpellCheck", false, true);
57    testRWProperty(field, "display", 2, 3);
58    testROProperty(field, "doc", "[object global]");
59    // testROProperty(field, "editable", "clams");
60    testRWProperty(field, "hidden", false, true);
61    testRIProperty(field, "fileSelect", false, true);
62    testRIProperty(field, "fillColor", "T", ["RGB", 0, 0, 0]);
63    testRWProperty(field, "lineWidth", 1, 4);
64    testRIProperty(field, "multiline", false, true);
65    // testROProperty(field, "multipleSelection", "clams");
66    testROProperty(field, "name", "MyField.MyText");
67    // testROProperty(field, "numItems", "clams");
68    testROProperty(field, "page", 0);
69    testRIProperty(field, "password", false, 42);
70    testRWProperty(field, "print", true, false);
71    testRIProperty(field, "readonly", false, true);
72    testROProperty(field, "rect", [200,221,220,201]);
73    // testROProperty(field, "required", "clams");
74    testRIProperty(field, "richText", false, true);
75    testRIProperty(field, "richValue", undefined, "clams");
76    testRIProperty(field, "rotation", 0, 42);
77    testRIProperty(field, "source", undefined, "clams");
78    testRIProperty(field, "strokeColor", "T", ["RGB", 0, 0, 0]);
79    testRIProperty(field, "submitName", undefined, "clams");
80    testRIProperty(field, "textColor", "T", ["RGB", 0, 0, 0]);
81    // testROProperty(field, "textFont", "clams");
82    testRIProperty(field, "textSize", 0, 32);
83    testROProperty(field, "type", "text");
84    testRIProperty(field, "userName", "");
85    testRWProperty(field, "value", "bleen", "clams");
86    testROProperty(field, "valueAsString", "clams");  // Set by previous line.
87  } catch (e) {
88    app.alert("Unexpected error: " + e);
89  }
90}
91
92function testPushButtonPropertiesCase(field) {
93  try {
94    testRIProperty(field, "buttonAlignX", 0, 50);
95    testRIProperty(field, "buttonAlignY", 0, 50);
96    testRIProperty(field, "buttonFitBounds", false);
97    testRIProperty(field, "buttonPosition", 0);
98    testRIProperty(field, "buttonScaleHow", 0);
99    testRIProperty(field, "buttonScaleWhen", 0);
100    testRIProperty(field, "highlight", "invert");
101    testROProperty(field, "type", "button");
102  } catch (e) {
103    app.alert("Unexpected error: " + e);
104  }
105}
106
107function testRadioButtonPropertiesCase(field) {
108  try {
109    testROProperty(field, "exportValues", "N");
110    testRIProperty(field, "radiosInUnison", false);
111    testRIProperty(field, "style", "check");
112    testROProperty(field, "type", "radiobutton");
113    testRIProperty(field, "value", "Off");
114    testROProperty(field, "valueAsString", "Off");
115  } catch (e) {
116    app.alert("Unexpected error: " + e);
117  }
118}
119
120function testCheckBoxPropertiesCase(field) {
121  try {
122    testROProperty(field, "exportValues", "N");
123    testRIProperty(field, "style", "check");
124    testROProperty(field, "type", "checkbox");
125    testRIProperty(field, "value", "Off");
126    testROProperty(field, "valueAsString", "Off");
127  } catch (e) {
128    app.alert("Unexpected error: " + e);
129  }
130}
131
132function testListBoxPropertiesCase(field) {
133  try {
134    testRWProperty(field, "currentValueIndices", 2, 1);
135  } catch (e) {
136    app.alert("Unexpected error: " + e);
137  }
138}
139
140function testFileSelectPropertiesCase(field) {
141  try {
142    testRIProperty(field, "fileSelect", true);
143  } catch (e) {
144    app.alert("Unexpected error: " + e);
145  }
146}
147
148testProperties();
149endstream
150endobj
151{{xref}}
152{{trailer}}
153{{startxref}}
154%%EOF
155