mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-04 21:12:57 -05:00
New Document: the rows test follows main's rounding of rows
Cause of the CI failure on6308fefe2e: main's6ef6df3407made 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:
1 parent
6308fefe2e
commit
ea0768443a
1 file changed
+4
-4
@@ -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}");
|
||||
|
||||
Reference in new issue
Block a user