Scripts: print on a document from documents.index counts as a file write

The script checker now treats documents.index() and app.documents.index()
as chains that give a document, so print on one records file.write and
filesWritten like the other document chains.
This commit is contained in:
dotCooCoo committed 2026-11-22 02:16:48 -08:00
1 parent 141dc48e1a
commit 048d55f1f5
2 files changed
+6 -2

No files matched your search

+3 -1
View File
@@ -84,7 +84,7 @@ pub(crate) const DOM_PRINT: &str = "print";
// The member chains that give a document, whole and as the chains are written (`[]` for an index,
// `()` for a call): https://ai-scripting.docsforadobe.dev/jsobjref/Application/ (`activeDocument`,
// `documents`, `open`) and https://ai-scripting.docsforadobe.dev/jsobjref/Documents/ (`add`, `addDocument`,
// `addDocumentNoUI`, `getByName`).
// `addDocumentNoUI`, `getByName`, `index`).
pub(crate) const DOM_DOCUMENTS: &[&str] = &[
"activeDocument",
"app.activeDocument",
@@ -98,6 +98,8 @@ pub(crate) const DOM_DOCUMENTS: &[&str] = &[
"app.documents.addDocumentNoUI()",
"documents.getByName()",
"app.documents.getByName()",
"documents.index()",
"app.documents.index()",
"app.open()",
];
+3 -1
View File
@@ -579,8 +579,10 @@ fn print_writes_a_file() {
"app.documents.addDocument('Print', s, false).print(o);\n",
"documents.addDocumentNoUI('Print').print(o);\n",
"app.documents.addDocumentNoUI('Print').print(o);\n",
"documents.index(0).print(o);\n",
"app.documents.index('Untitled-1').print(o);\n",
));
let lines = &[2, 3, 5, 9, 10, 11, 12, 13, 14][..];
let lines = &[2, 3, 5, 9, 10, 11, 12, 13, 14, 15, 16][..];
assert_eq!(feature(&r, "file.write").map(|f| f.lines.as_slice()), Some(lines));
assert_eq!(r.outside.iter().map(|o| (o.id, o.lines.as_slice())).collect::<Vec<_>>(), [("filesWritten", lines)]);
}