diff --git a/crates/engine/src/cmd/fileio/tests_palette.rs b/crates/engine/src/cmd/fileio/tests_palette.rs index d27166e5da..1ef846806e 100644 --- a/crates/engine/src/cmd/fileio/tests_palette.rs +++ b/crates/engine/src/cmd/fileio/tests_palette.rs @@ -120,6 +120,10 @@ fn palette_exports_take_the_transparency_dither() { let dithered = file(json!({"transparencyDither": method})); let [left, right] = opaque_halves(&dithered); assert!((left - 0.25).abs() < 0.1 && (right - 0.75).abs() < 0.1, "{format} {method}: {left} {right}"); + if method == "pattern" { + // The ordered pattern keeps exactly one pixel of each 2x2 cell at 25% and three at 75%. + assert_eq!([left, right], [0.25, 0.75], "{format}"); + } assert_eq!(file(json!({"transparencyDither": method})), dithered, "{format} {method}: the same art gives the same file"); // Without transparency the dither does nothing. let opaque = file(json!({"transparencyDither": method, "transparency": false})); diff --git a/crates/engine/src/tests/large_edits.rs b/crates/engine/src/tests/large_edits.rs index 2806cdd925..19cbe75c56 100644 --- a/crates/engine/src/tests/large_edits.rs +++ b/crates/engine/src/tests/large_edits.rs @@ -435,7 +435,7 @@ fn alt_drag_of_30000_objects_takes_few_tree_walks() { assert_eq!(s.doc().unwrap().history.undo.last().map(|e| e.label.as_str()), Some("Copy")); // The squares stay; their copies move together. let moved = bounds(&s, copies[0]).origin() - square_at(0).origin(); - assert!(moved.x > 0.0, "{moved:?}"); + assert!((moved.x - 80.0).abs() < 1e-6 && moved.y.abs() < 1e-6, "the copies move by the drag: {moved:?}"); for (k, (id, copy)) in ids.iter().zip(&copies).enumerate() { assert_eq!(bounds(&s, *id), square_at(k)); assert_eq!(bounds(&s, *copy), square_at(k) + moved); diff --git a/crates/engine/src/tests/plugins.rs b/crates/engine/src/tests/plugins.rs index 836daf8b05..5fe28b4639 100644 --- a/crates/engine/src/tests/plugins.rs +++ b/crates/engine/src/tests/plugins.rs @@ -1545,10 +1545,10 @@ fn kept_art_follows_the_swatches_once_a_replaced_plugin_paints() { assert_eq!(draw(&s), (WHITE, RED), "without the swatch, the object as it is"); } -/// Whether `px` is within 40 levels of `want` on every channel. A blur leaves the middle of a -/// shape close to its color. +/// Whether `px` is within 2 levels of `want` on every channel. The samples sit well inside their +/// shapes, so a blur changes them only by rounding. fn near(px: [u8; 4], want: [u8; 4]) -> bool { - px.iter().zip(want).all(|(a, b)| a.abs_diff(b) <= 40) + px.iter().zip(want).all(|(a, b)| a.abs_diff(b) <= 2) } /// A kept raster of a blur over a painted effect is made again when a swatch its piece names diff --git a/crates/engine/src/tests/webexport.rs b/crates/engine/src/tests/webexport.rs index 0d1d6b50a8..656a5689f8 100644 --- a/crates/engine/src/tests/webexport.rs +++ b/crates/engine/src/tests/webexport.rs @@ -197,6 +197,10 @@ fn transparency_dither_keeps_a_share_of_partly_transparent_pixels() { let dithered = file(&mut s, p.clone()); let [left, right] = opaque_halves(&pixels(&dithered)); assert!((left - 0.25).abs() < 0.1 && (right - 0.75).abs() < 0.1, "{format} {method}: {left} {right}"); + if method == "pattern" { + // The ordered pattern keeps exactly one pixel of each 2x2 cell at 25% and three at 75%. + assert_eq!([left, right], [0.25, 0.75], "{format}"); + } if format == "gif" { assert_eq!(gif_transparent_index(&dithered), Some(0), "{method}"); }