Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/geom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,7 @@ mod tests {
assert_eq!(format_distance(-99_949.0), "-99.9 km");
assert_eq!(format_distance(-99_960.0), "-100 km");
assert_eq!(format_area(-0.3), "0 m²");
assert_eq!(format_area(-0.5), "0 m²");
assert_eq!(format_area(-0.0), "0 m²");
assert_eq!(format_area(-0.6), "-1 m²");
assert_eq!(format_area(-999_999.4), "-999999 m²");
Expand Down
2 changes: 1 addition & 1 deletion crates/geom/src/triangulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ mod tests {
assert!(!triangulate_reporting(&l, &[]).unwrap().1);
let inner = vec![vec![(1.0, 1.0), (2.0, 1.0), (2.0, 2.0), (1.0, 2.0)]];
assert!(!triangulate_reporting(&sq, &inner).unwrap().1);
// A hole that stays clear of the left side is fine.
// A hole touching the left side at points, without sharing an edge, is fine.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is wrong about the fixture (confidence: high). The hole (0,1), (2,2), (0,3) has its closing edge (0,3)→(0,1) on x = 0, which is the square's left side. So the hole shares a 2-unit segment with the outer ring; it does not touch "at points without sharing an edge". The assertion (not fanned) is pre-existing and unchanged, so the test still checks the shared-segment case. The PR body's stated purpose is the points-only case, which this fixture does not exercise. Suggested wording that matches what the test checks:

Suggested change
// A hole touching the left side at points, without sharing an edge, is fine.
// A hole sharing part of the left side, from (0,1) to (0,3), is not fanned.

If the points-only case is what you want covered, it needs a separate fixture whose hole vertices sit on x = 0 without a hole edge between them.

assert!(!triangulate_reporting(&sq, &[vec![(0.0, 1.0), (2.0, 2.0), (0.0, 3.0)]]).unwrap().1);
}

Expand Down
Loading