From ea0768443aa83001cb64a085a0c060a8cc0db55c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 23:26:49 -0800 Subject: [PATCH] New Document: the rows test follows main's rounding of rows Cause of the CI failure on 6308fefe2e: main's 6ef6df34072 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. --- crates/ui-egui/src/dialogs/new_document.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/dialogs/new_document.rs b/crates/ui-egui/src/dialogs/new_document.rs index 22842c599b..e90bf7e09e 100644 --- a/crates/ui-egui/src/dialogs/new_document.rs +++ b/crates/ui-egui/src/dialogs/new_document.rs @@ -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}");