New Document: the rows test follows main's rounding of rows

Cause of the CI failure on 6308fefe2e: main's 6ef6df3407 made file.new
round artboardLayout.rows and refuse only a value that rounds outside 1
to 1000, and the New Document dialog reads rows through the same parser.
This branch's the_dialog_reads_rows_as_file_new_does still expected 3.5
to be refused, so set() returned Ok and unwrap_err panicked. The test now
sets 3.6, expects 4, and checks that 0.4, 0 and 1001 are refused with the
rows left as they were.
This commit is contained in:
dotCooCoo committed 2026-11-29 23:26:49 -08:00
1 parent 6308fefe2e
commit ea0768443a
1 file changed
+4 -4
+4 -4
View File
@@ -1047,16 +1047,16 @@ mod tests {
})
}
/// The dialog reads rows as `file.new` does: a whole number from 1 to the artboard limit,
/// `4.0` included, and a fractional, zero or larger count is refused with nothing changed.
/// The dialog reads rows as `file.new` does: rounded to a whole number from 1 to the artboard
/// limit, and a count that rounds to 0 or is larger is refused with nothing changed.
#[test]
fn the_dialog_reads_rows_as_file_new_does() {
let mut app = app();
open(&mut app);
set(&app, "artboards", json!(5)).unwrap();
set(&app, "artboardLayout", json!({"layout": "gridByColumn", "rows": 4.0})).unwrap();
set(&app, "artboardLayout", json!({"layout": "gridByColumn", "rows": 3.6})).unwrap();
assert_eq!(fields(&app)["artboardLayout"]["rows"], json!(4));
for rows in [json!(3.5), json!(MAX_ARTBOARDS + 1), json!(0)] {
for rows in [json!(0.4), json!(MAX_ARTBOARDS + 1), json!(0)] {
let e = set(&app, "artboardLayout", json!({"layout": "gridByColumn", "rows": rows})).unwrap_err();
assert!(e.contains("can't take"), "{rows}: {e}");
assert_eq!(fields(&app)["artboardLayout"]["rows"], json!(4), "{rows}");