blob: aebbf716dd068dc4a1b7070cf2af26706ab880d4 [file] [log] [blame]
{{header}}
{{include field.fragment}}
% JS program to exexute
{{object 16 0}} <<
{{streamlen}}
>>
stream
{{include expect.js}}
function testGetField() {
try {
var field = this.getField("MyField");
app.alert("field is " + field.name);
var button = this.getField("MyField.MyPushButton");
app.alert("button is " + button.name);
var nonesuch = this.getField("MyField.nonesuch");
app.alert("nonesuch is " + nonesuch);
} catch (e) {
app.alert("Unexpected error: " + e);
}
}
function testGetArray() {
try {
var subs = this.getField("MyField").getArray();
app.alert("found " + subs.length + " sub-fields:");
for (i = 0; i < subs.length; ++i) {
app.alert(subs[i].name);
}
} catch (e) {
app.alert("Unexpected error: " + e);
}
}
testGetField();
testGetArray();
expect("this.getField('MyField.MyPushButton').buttonGetCaption()", "");
expect("this.getField('MyField.MyPushButton').buttonGetIcon()", "[object Object]");
expect("this.getField('MyField.MyPushButton').buttonImportIcon()", undefined);
expectError("this.getField('MyField').checkThisBox()");
expectError("this.getField('MyField').checkThisBox({})");
expectError("this.getField('MyField').defaultIsChecked()");
expect("this.getField('MyField').defaultIsChecked(0)", false);
expectError("this.getField('MyField').isBoxChecked()");
expectError("this.getField('MyField').isBoxChecked(20)");
expect("this.getField('MyField').isBoxChecked(0)", false);
expectError("this.getField('MyField').isDefaultChecked()", false);
expectError("this.getField('MyField').isDefaultChecked(20)", false);
expect("this.getField('MyField').isDefaultChecked(0)", false);
expect("this.getField('MyField').setFocus()", undefined);
// TODO(tsepez): these need a different kind of object to pass
expectError("this.getField('MyField.MyText').browseForFileToSubmit()");
expectError("this.getField('MyField').checkThisBox(0, true)");
expectError("this.getField('MyField').getItemAt(0)");
app.alert("These always succeed without actually doing anything:");
expect("this.getField('MyField').clearItems()", undefined);
expect("this.getField('MyField').deleteItemAt()", undefined);
expect("this.getField('MyField').insertItemAt()", undefined);
expect("this.getField('MyField').setAction()", undefined);
expect("this.getField('MyField').setItems()");
app.alert("These always throw operation not supported errors:");
expectError("this.getField('MyField').buttonSetCaption()");
expectError("this.getField('MyField').buttonSetIcon()");
expectError("this.getField('MyField').getLock()");
expectError("this.getField('MyField').setLock()");
expectError("this.getField('MyField').signatureGetModifications()");
expectError("this.getField('MyField').signatureGetSeedValue()");
expectError("this.getField('MyField').signatureInfo()");
expectError("this.getField('MyField').signatureSetSeedValue()");
expectError("this.getField('MyField').signatureSign()");
expectError("this.getField('MyField').signatureValidate()");
endstream
endobj
{{xref}}
{{trailer}}
{{startxref}}
%%EOF