mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 13:32:45 -05:00
Merge main into feat/scripts-export-for-screens
This commit is contained in:
commit
644a4e6b8c
359 files changed
+25364
-1598
No files matched your search
@@ -79,7 +79,7 @@ pub(crate) const DOM_ROOTS: [&str; 4] = ["app", "activeDocument", "documents", "
|
||||
// Document methods that write the file they are given, or files in the folder they are given:
|
||||
// https://ai-scripting.docsforadobe.dev/jsobjref/Document/ and
|
||||
// https://www.indesignjs.de/indesignapi/illustrator/Document.html (exportForScreens)
|
||||
pub(crate) const DOM_FILE_WRITES: &[&str] = &["exportFile", "exportVariables", "saveAs", "exportForScreens"];
|
||||
pub(crate) const DOM_FILE_WRITES: &[&str] = &["exportFile", "exportVariables", "imageCapture", "saveAs", "exportForScreens"];
|
||||
// Application methods that read the file they are given: https://ai-scripting.docsforadobe.dev/jsobjref/Application/
|
||||
pub(crate) const DOM_FILE_READS: &[&str] = &["open"];
|
||||
|
||||
|
||||
@@ -564,6 +564,21 @@ fn save_as_and_export_file_write_a_file() {
|
||||
assert_eq!(r.outside.iter().map(|o| (o.id, o.lines.as_slice())).collect::<Vec<_>>(), [("filesWritten", &[3, 4][..])]);
|
||||
}
|
||||
|
||||
/// A document's `imageCapture` writes the file it is given, with or without bounds and options, and
|
||||
/// called by its name in brackets; `rasterize` stays inside the document.
|
||||
#[test]
|
||||
fn image_capture_writes_a_file() {
|
||||
let r = report(concat!(
|
||||
"var f = new File(p);\n",
|
||||
"app.activeDocument.imageCapture(f);\n",
|
||||
"var d = app.activeDocument; d.imageCapture(f, [0, 0, 10, 10], new ImageCaptureOptions());\n",
|
||||
"d['imageCapture'](f);\n",
|
||||
"d.rasterize(d.pageItems[0]);\n",
|
||||
));
|
||||
assert_eq!(feature(&r, "file.write").map(|f| f.lines.as_slice()), Some(&[2, 3, 4][..]));
|
||||
assert_eq!(r.outside.iter().map(|o| (o.id, o.lines.as_slice())).collect::<Vec<_>>(), [("filesWritten", &[2, 3, 4][..])]);
|
||||
}
|
||||
|
||||
/// A document's `exportVariables` writes the file it is given; `importVariables` only reads one.
|
||||
#[test]
|
||||
fn export_variables_writes_a_file() {
|
||||
|
||||
Reference in new issue
Block a user