linesweeper: test the sweep position after every edit and with slow-asserts

`position_after_edits` checks the position of every segment on the sweep
line, and of each contour continuation's old segment, after each edit.
`scripts/test-pdf-backends.sh` runs the unit and regression tests a second
time with the `slow-asserts` feature.
This commit is contained in:
dotCooCoo committed 2026-11-17 17:48:17 -08:00
1 parent 9e4f76184a
commit 010483ed35
4 files changed
+11 -2

No files matched your search

+1
View File
@@ -19,4 +19,5 @@ cargo test --manifest-path "$test_root/hayro-syntax/Cargo.toml" --doc "${patches
cargo test --manifest-path "$test_root/hayro-syntax/Cargo.toml" --lib --no-default-features --features std "${patches[@]}"
cp -R "$root/vendor/linesweeper" "$test_root/linesweeper"
cargo test --manifest-path "$test_root/linesweeper/Cargo.toml" --locked --lib --test regression
cargo test --manifest-path "$test_root/linesweeper/Cargo.toml" --locked --lib --test regression --features slow-asserts
cargo test --manifest-path "$test_root/linesweeper/Cargo.toml" --locked --doc
+3 -1
View File
@@ -63,13 +63,15 @@ linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "<rev>" }
## Tests
`scripts/test-pdf-backends.sh` runs the package's unit, regression and doc tests. The `craft-prepress`
`scripts/test-pdf-backends.sh` runs the package's unit, regression and doc tests, and runs the unit
and regression tests again with the `slow-asserts` feature. The `craft-prepress`
tests with the `flatten` feature run against this copy. `pdf.yml`'s path filter lists this directory,
so a pull request that changes files here starts `pdf.yml`. No workflow runs clippy on this copy. Run
the tests and clippy from this directory:
```sh
cargo test --locked --lib --test regression
cargo test --locked --lib --test regression --features slow-asserts
cargo test --locked --doc
cargo clippy --locked --all-features --lib --test regression -- -D warnings
cargo clippy --locked --all-features --lib --profile test -- -D warnings
+1 -1
View File
@@ -72,7 +72,7 @@
{ "path": "src/sweep/snapshots/linesweeper__sweep__sweep_line__tests__square.snap", "source_sha256": "b35c3e6a38d5ecdd8acf315ba0b0bd6485cd8b40193fdd76bd446bdfdb6eda77", "source_git_blob": null, "sha256": "b35c3e6a38d5ecdd8acf315ba0b0bd6485cd8b40193fdd76bd446bdfdb6eda77" },
{ "path": "src/sweep/snapshots/linesweeper__sweep__sweep_line__tests__square_and_diamond.snap", "source_sha256": "3f01a76fb7ff4aef0fd55fd869602d4a2b69fff1bd65632f406b275b5d6af600", "source_git_blob": null, "sha256": "3f01a76fb7ff4aef0fd55fd869602d4a2b69fff1bd65632f406b275b5d6af600" },
{ "path": "src/sweep/snapshots/linesweeper__sweep__sweep_line__tests__two_squares.snap", "source_sha256": "79e3c95e563a66c0ce244125470a106a18dfe29f276b732defd305406c873c7e", "source_git_blob": null, "sha256": "79e3c95e563a66c0ce244125470a106a18dfe29f276b732defd305406c873c7e" },
{ "path": "src/sweep/sweep_line.rs", "source_sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3", "source_git_blob": null, "sha256": "207f6a6b71b48a50e8d5bba3a7c5610b086f6548cd8746dac1785b6f4d2e0038" },
{ "path": "src/sweep/sweep_line.rs", "source_sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3", "source_git_blob": null, "sha256": "b5b5e0751a93a7285bd9a8ed7dcd8a44e2ecab3749fcf902fcef6935eb001b41" },
{ "path": "src/topology.rs", "source_sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b", "source_git_blob": null, "sha256": "8729c2dd5941668f3d2805b6562d2d144d4e5156836b894b887394d9d2961aa7" },
{ "path": "src/treevec.rs", "source_sha256": "d88b9fbf02fa9f318560e1d483d465555f2b696ae12c00f8e4f5b71ea6779445", "source_git_blob": null, "sha256": "d88b9fbf02fa9f318560e1d483d465555f2b696ae12c00f8e4f5b71ea6779445" },
{ "path": "src/typed_vec.rs", "source_sha256": "3e9a2675b8a40d8fc4df0575bd9d0d16b5604d18e9b78638dd5a612b28fc4c30", "source_git_blob": null, "sha256": "3e9a2675b8a40d8fc4df0575bd9d0d16b5604d18e9b78638dd5a612b28fc4c30" },
+6
View File
@@ -2157,6 +2157,12 @@ mod tests {
_ => {}
}
check_positions(&line, 10);
for (i, entry) in line.segs.iter().enumerate() {
assert_eq!(line.position(entry.seg), Some(i));
if let Some(old_seg) = entry.old_seg {
assert_eq!(line.position(old_seg), Some(i));
}
}
}
check_positions(&line, next_seg);
}