Commit Graph
104 Commits
Author SHA1 Message Date
dotCooCoo 92a2056a8b Scripts: page-item setters report a stale item before a bad value
The name, note, hidden, locked, opacity, blendingMode, position, left,
top, width and height setters checked the assigned value before the
item, so a bad value on a removed item reported the value error instead
of "Stale page item". Each setter now looks up its item first.
2026-11-29 10:26:04 -08:00
dotCooCoo 6ef6df3407 Scripts: round artboard rows as main's New Document test expects, and drop pathItems= from the host table
Cause of the CI failures on 212090fd7a:
- main's dialogs::new_document test a_presets_rows_reach_the_document_create_makes
  sets artboardLayout.rows to 3.6 and expects 4, but this branch refused a
  rows value that was not a whole number. rows now rounds like columns and is
  still refused outside 1 to 1000.
- script_host_vs_scriptcheck listed Document.prototype.pathItems=, the
  setter of main's placeholder. This branch makes pathItems a read-only
  collection, like pageItems, so the row goes.
2026-11-29 06:45:32 -08:00
dotCooCoo dd93247cbf Scripts: tests index page items topmost first and check the preset fallback
Cause of the script_dom and script_dom_paths failures: main's 9872e6b679
("page items report their own members, and lists start with the topmost
object") made pageItems, pathItems and the selection list art topmost first.
The branch's tests still indexed the objects bottom first, so pageItems[1]
and pathItems[0] named the other object. The tests now make the objects in
the order the lists read them, and index them topmost first.

The own-members test asked about rotate, which this branch makes available,
so it now asks about transform, which is not available yet.

The fallback test for addDocument relied on five 1,000,000 pt artboards not
fitting, but a new DocumentPreset puts them in one column. It now unsets the
layout so the built-in preset puts them in one row, and the test fails when
addDocument falls back to the saved preset of the same name.
2026-11-29 04:41:14 -08:00
dotCooCoo 4b7ac69692 Scripts: fix path handles after main's revert count and review findings on path edits
PathItem handles carry the document's revert count, as page item
handles on main do, so path members find their path again.

setEntirePath and the path point setters throw a RangeError for a point
off the canvas. Opening a path whose closing segment is selected keeps
the edit. pathItems.add() leaves new art's paint as it was with New Art
Has Basic Appearance off. addDocument reports settings the built-in
preset refuses. appearance.setNewArt refuses a swatch that is not a
name. Writing one path's points looks only at that path afterwards.
2026-11-29 00:42:20 -08:00
dotCooCoo 0bd735f53d Merge main into feat/scripts-doc-defaults 2026-11-28 23:20:21 -08:00
dotCooCoo 38dfb800e1 Scripts: leave getIsFileOpen's path comparison as main has it
The change to how getIsFileOpen compares paths on and off Windows goes in its own change, with
its test.
2026-11-28 20:03:45 -08:00
dotCooCoo 8c668944d1 Scripts: name app.undo and app.redo in script.run's help, and leave file.new's messages to their own change
script.run's params text now says what app.undo() and app.redo() do. The artboardLayout messages,
their test and their catalog rows go back to main's text; they belong to file.new rather than to
script history.
2026-11-28 19:51:50 -08:00
dotCooCoo ecf193cc06 Merge main into feat/scripts-app-undo-redo
# Conflicts:
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	docs/target-app-parity.md
2026-11-28 19:47:12 -08:00
dotCooCoo 0d5850f616 Scripts: build on main's optional item bounds and painting-tool check
main's item_rect now gives no bounds for an empty object, and the
Live Paint Bucket check became tool_paints for the fill and the
stroke. rotate and resize leave a path without bounds unchanged, and
appearance.setNewArt uses the same inheritance test as paint.rs.
2026-11-28 18:41:43 -08:00
dotCooCoo 6112616e13 Merge main into feat/scripts-app-undo-redo 2026-11-28 18:30:41 -08:00
dotCooCoo d471933b0d Merge main into feat/scripts-doc-defaults 2026-11-28 18:11:42 -08:00
dotCooCoo 44c89a7912 Merge main into feat/scripts-api-d4b-text-styles 2026-11-28 18:11:24 -08:00
dotCooCoo 1935494805 Merge main into fix/script-collection-numeric-names
# Conflicts:
#	crates/engine/src/tests/script_dom.rs
#	docs/target-app-parity.md
2026-11-28 17:18:25 -08:00
dotCooCoo fbb0f2d5ff Merge main into feat/scripts-api-d4b-text-styles 2026-11-28 16:57:12 -08:00
dotCooCoo 31844b57dd Merge feat/scripts-api-d4-text into feat/scripts-api-d4b-text-styles 2026-11-28 16:13:51 -08:00
dotCooCoo 3ce53dbb6c Merge main into fix/script-collection-numeric-names 2026-11-28 14:35:22 -08:00
dotCooCoo 5728ff39cd Merge main into feat/scripts-page-item-blending-mode
# Conflicts:
#	crates/engine/src/tests/script_dom.rs
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-28 14:17:28 -08:00
dotCooCoo a9fda9f97c Merge main into feat/scripts-app-redraw 2026-11-28 08:12:03 -08:00
dotCooCoo 88fb7a8128 Merge main into feat/scripts-document-views 2026-11-28 07:25:53 -08:00
dotCooCoo 441634a7b3 Merge main into feat/scripts-page-item-blending-mode 2026-11-28 07:15:42 -08:00
dotCooCoo 19cfcf8bbe Merge main into fix/script-collection-numeric-names 2026-11-28 05:09:44 -08:00
dotCooCoo 37be9d4372 Merge main into feat/scripts-app-redraw 2026-11-28 04:00:58 -08:00
dotCooCoo 9e069427f1 Scripts: keep the preset-total test's titles within the title limit
The merge of main brought a 4,096-byte limit on a DocumentPreset title
(8ff8dbefc6), and document_preset_settings_are_held_to_a_total set
64,000-character titles, so the setter threw "the title is too long"
before the 16 MiB total was reached. The test now uses 4,096-byte titles
on 5,000 presets to reach the total, and reassigns a 4,000-character
title 5,000 times to show a reassigned setting counts only its new value.
2026-11-28 02:21:18 -08:00
.CooCoo 87b3dd9a98 Merge pull request #9853 from dotCooCoo/fix/script-documents-strict-assign
Scripts: assigning documents throws in strict mode and is ignored otherwise
2026-11-28 01:24:23 -08:00
dotCooCoo 7d6abb1d23 Merge main into fix/script-documents-strict-assign 2026-11-28 00:29:51 -08:00
dotCooCoo eb4c8bdc81 Scripts: script code builds with main's revert test and command hook
main added a test named wrappers_go_stale_after_revert and passes the
command id to dom::before_command by reference.

- The revert test of this branch is renamed
  objects_read_before_a_revert_are_stale_and_ones_read_after_are_the_loaded_ones.
- command_value takes `id` as a &str, so the call passes it as it is,
  which clippy's needless_borrow check requires.
2026-11-28 00:09:25 -08:00
dotCooCoo e75b26cffc Merge main into feat/scripts-reflection 2026-11-27 23:38:58 -08:00
dotCooCoo 0a46b8e849 Scripts: script tests build with main's host classes and preset checks
main added HostClass initializers in host_tests.rs without the reflect
`info` field, a second test named
assigning_undefined_to_the_selection_throws_and_keeps_it, and type and
size checks on DocumentPreset settings.

- host_tests.rs: the six new HostClass initializers give `info`.
- The selection test for an index past the end of pageItems is renamed
  assigning_an_index_past_the_end_to_the_selection_throws_and_keeps_it.
- The preset heap tests used titles of 512 KiB and an array of 20,000
  booleans as a title, which the setter now refuses. They now reach the
  run's heap with 4,092-byte titles, and compare presets holding a
  four-number documentBleedOffsetRect with presets holding an eight-byte
  title, so each array element still counts.
2026-11-27 23:29:12 -08:00
dotCooCoo 5162f5db7b Merge main into feat/scripts-app-redraw 2026-11-27 22:26:34 -08:00
dotCooCoo 4dc01ead22 Merge main into feat/scripts-page-item-blending-mode 2026-11-27 22:25:45 -08:00
dotCooCoo d3fc73b14c Merge main into feat/scripts-app-undo-redo 2026-11-27 22:14:35 -08:00
dotCooCoo f7ccc194fc Merge main into feat/scripts-document-views 2026-11-27 22:14:06 -08:00
dotCooCoo f56fcd99f6 Merge main into feat/scripts-reflection 2026-11-27 22:13:50 -08:00
dotCooCoo 13c44353cf Merge main into feat/scripts-api-d4b-text-styles 2026-11-27 22:13:49 -08:00
dotCooCoo 1371fdab0d Merge main into fix/script-handles-after-revert 2026-11-27 22:12:29 -08:00
dotCooCoo 1583808eec Merge main into fix/script-documents-strict-assign
# Conflicts:
#	crates/engine/src/script/dom.rs
2026-11-27 22:10:35 -08:00
dotCooCoo dc67320681 Merge main into fix/script-collection-numeric-names 2026-11-27 22:08:45 -08:00
.CooCoo 82d9ff0182 Merge pull request #9867 from dotCooCoo/fix/script-prototype-write-test
Scripts: the prototype-write test fails when a write to PathItem.prototype succeeds
2026-11-27 21:54:33 -08:00
.CooCoo a95a52e06a Merge pull request #9866 from dotCooCoo/fix/script-preset-field-size
Scripts: DocumentPreset settings refuse a value of the wrong kind or size
2026-11-27 21:54:22 -08:00
dotCooCoo 5134c83a1c Scripts: the prototype-write test fails when a write to PathItem.prototype succeeds
prototype_changes_cannot_forge_a_page_item stored both caught error
messages in one variable, so when the second write stopped throwing, the
variable still held the first message and the assertion still passed.
Each try block now logs its own outcome.
2026-11-27 20:23:26 -08:00
dotCooCoo 8ff8dbefc6 Scripts: DocumentPreset settings refuse a value of the wrong kind or size
Assigning a DocumentPreset setting stored any value until the run ended,
and the value was checked only when addDocument read it. A script could
keep gigabytes of strings in presets that no addDocument would accept.

The setter now checks the value before storing it: a value of the
setting's enumeration, a finite number, a title of at most 4096 bytes,
true or false for documentBleedLink, or four finite numbers for
documentBleedOffsetRect. undefined unsets any setting, and the three
settings addDocument does not apply yet also take null. A value of
another kind throws a TypeError, a longer title throws a RangeError, and
the setting keeps its old value. addDocument still checks the ranges.
2026-11-27 20:16:03 -08:00
dotCooCoo 62f1abe5bd Scripts: collection reads look up names such as -1 and 1.5
The indexer hands a key that is the text of a number to the collection as
a number, so pageItems["-1"] and documents["1.5"] read as positions and gave
undefined, and "-1" in pageItems was false, even when getByName("-1") found
the object. pageItems and documents now take only array indices as
positions and look up any other number by its text as a name, giving
undefined when nothing has it. index(key) still takes a number as a
position.
2026-11-27 18:58:46 -08:00
dotCooCoo efb7911139 Scripts: assigning documents throws in strict mode and is ignored otherwise
The global `documents` has only a getter. The docs and the module and
test comments said only that assigning it keeps its value. They now say
that the assignment is ignored outside strict mode and throws a
TypeError in strict mode code or with `#strict on`, and the test also
checks the `#strict on` case.
2026-11-27 18:46:40 -08:00
dotCooCoo 55bf6604be Scripts: app.documents lists the active document first
A script's documents[0] was the first tab, not the active document, so
scripts that read app.documents[0] as the document in front acted on
another one. The scripting guide says documents[0] is always the active
document:
https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/

Each open document now records when it last became the current one.
documents lists the current document first and then the others from the
one current most recently to the one current longest ago (VectorCraft's
own rule). documents["name"] and getByName search in the same order. A
change a script makes to a document in the back switches to it and back,
and that switch no longer moves the document in the list.

Three tests that read documents[0] as the first tab with two documents
open now read documents[1].
2026-11-27 13:22:06 -08:00
dotCooCoo f9011cf8e2 Merge main into feat/scripts-api-d7b-tags-notes-uuid 2026-11-26 10:45:34 -08:00
dotCooCoo 88ce9d0e85 Merge main into feat/scripts-app-undo-redo 2026-11-26 10:35:19 -08:00
dotCooCoo 66724868b1 Merge main into fix/script-handles-after-revert 2026-11-26 10:24:41 -08:00
BFlat 626e2bb694 Merge pull request #9420 from dotCooCoo/test/script-file-open-path-quoting
Tests: quote script file paths as JavaScript strings
2026-11-27 00:50:48 +07:00
dotCooCoo 80a24bf8a6 Use each window's displayed zoom in script views 2026-11-26 09:36:45 -08:00
dotCooCoo 93a5d81d2e Merge main into feat/scripts-api-d7b-tags-notes-uuid 2026-11-26 09:34:56 -08:00