mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-30 02:07:10 +01:00
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.
This commit is contained in:
1 parent
212090fd7a
commit
6ef6df3407
5 files changed
+7
-6
No files matched your search
@@ -395,9 +395,10 @@ impl DocSettings {
|
||||
"rows" => {
|
||||
self.rows = v
|
||||
.as_f64()
|
||||
.filter(|r| r.fract() == 0.0 && (1.0..=MAX_ARTBOARDS as f64).contains(r))
|
||||
.map(f64::round)
|
||||
.filter(|r| (1.0..=MAX_ARTBOARDS as f64).contains(r))
|
||||
.map(|r| r as u32)
|
||||
.ok_or_else(|| bad(cmd, format!("artboardLayout.rows must be a whole number from 1 to {MAX_ARTBOARDS}")))?
|
||||
.ok_or_else(|| bad(cmd, format!("artboardLayout.rows must be from 1 to {MAX_ARTBOARDS}")))?
|
||||
}
|
||||
"spacing" => {
|
||||
self.spacing = v
|
||||
|
||||
@@ -161,7 +161,7 @@ fn ppi_overprint_preview_and_bad_params() {
|
||||
json!({"artboardLayout": {"layout": "spiral"}}),
|
||||
json!({"artboardLayout": {"columns": 0}}),
|
||||
json!({"artboardLayout": {"rows": 0}}),
|
||||
json!({"artboardLayout": {"layout": "gridByColumn", "rows": 1.5}}),
|
||||
json!({"artboardLayout": {"layout": "gridByColumn", "rows": 0.4}}),
|
||||
json!({"artboardLayout": {"layout": "gridByColumn", "rows": 1001}}),
|
||||
json!({"artboardLayout": {"tiles": 2}}),
|
||||
json!({"units": "furlongs"}),
|
||||
|
||||
@@ -1017,7 +1017,7 @@ fn file_new_takes_the_rows_of_a_grid_by_column() {
|
||||
let (plain, spaced) = (plain.with_params(&to_row, "file.new").unwrap(), spaced.with_params(&to_row, "file.new").unwrap());
|
||||
assert_eq!(plain.grid_columns(), spaced.grid_columns());
|
||||
let e = s.execute("file.new", &json!({"artboardLayout": {"layout": "gridByColumn", "rows": 0}})).unwrap_err().to_string();
|
||||
assert!(e.contains("rows must be a whole number from 1 to 1000"), "{e}");
|
||||
assert!(e.contains("rows must be from 1 to 1000"), "{e}");
|
||||
for layout in ["gridByRow", "row", "column"] {
|
||||
let e = s.execute("file.new", &json!({"artboardLayout": {"layout": layout, "rows": 2}})).unwrap_err().to_string();
|
||||
assert!(e.contains("rows needs the gridByColumn layout"), "{layout}: {e}");
|
||||
|
||||
@@ -113,7 +113,7 @@ const INSIDE: &[(&str, &str)] = &[
|
||||
defaultStrokeDashOffset= defaultStrokeDashes defaultStrokeDashes= defaultStrokeJoin defaultStrokeJoin= \
|
||||
defaultStrokeMiterLimit defaultStrokeMiterLimit= defaultStrokeOverprint defaultStrokeOverprint= \
|
||||
defaultStrokeWidth defaultStrokeWidth= defaultStroked defaultStroked= documentColorSpace groupItems \
|
||||
groupItems= height layers layers= name pageItems paragraphStyles parent pathItems pathItems= rulerOrigin \
|
||||
groupItems= height layers layers= name pageItems paragraphStyles parent pathItems rulerOrigin \
|
||||
rulerOrigin= rulerUnits saveAs saveAs= scaleFactor selection selection= stories swatches swatches= \
|
||||
symbols symbols= tags textFrames toString typename views width",
|
||||
),
|
||||
|
||||
+1
-1
@@ -10497,7 +10497,7 @@ and goes back to Document Setup, whose OK runs `document.setup`; its Cancel goes
|
||||
|
||||
`file.new` takes everything New Document sets: `preset` (a name from `file.newPresets`), `name`, `width`/`height`
|
||||
(points, or lengths such as `"210 mm"`), `units`, `orientation`, `artboards` with `artboardLayout {layout, columns,
|
||||
rows, spacing, rightToLeft}` (`rows`, a whole number from 1 to 1000, gives a `gridByColumn` layout that many rows, at most one for each artboard, in place of `columns`, and is
|
||||
rows, spacing, rightToLeft}` (`rows`, 1 to 1000 and rounded to a whole number, gives a `gridByColumn` layout that many rows, at most one for each artboard, in place of `columns`, and is
|
||||
an error with another layout; a preset keeps the rows, and `file.newPresets` lists them as set even when there are
|
||||
fewer artboards, until `columns` without `rows`, or another layout, is given; New Document's Columns shows the columns
|
||||
the rows give the current number of artboards, and New Document drops the rows when Columns or the layout changes),
|
||||
|
||||
Reference in new issue
Block a user