Skip to content

Add test for an inner ring touching the outer at two points - #643

Merged
brawer merged 1 commit into
mainfrom
add-inner-outer-two-point-touch-test
Aug 12, 2026
Merged

Add test for an inner ring touching the outer at two points#643
brawer merged 1 commit into
mainfrom
add-inner-outer-two-point-touch-test

Conversation

@brawer

@brawer brawer commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What

Adds inner_touching_outer_at_two_points_splits_it_into_two_pieces to PolygonAssembler's tests: an inner ring that touches the outer ring at exactly two points (not along an overlapping edge, not crossing), so removing it splits the outer into two disjoint polygons rather than leaving one polygon with a hole.

Why

While looking into #635, we checked whether the (2012, unlicensed, since-superseded) nimix/osm_conv_tests test suite had anything our vendored osm-testdata grid corpus doesn't. Everything distinctive in it turned out to already be covered — except this one case. grid has fixtures for single-point inner/outer touches (7/754-7/758), touching along a shared line (7/756, 7/757), and a single self-touching way resolving into two components (7/765, 7/766) — but not two separate simple rings where the inner touches the outer at exactly two points.

Also proposed upstream as osmcode/osm-testdata#11, so grid itself gains the coverage too — this test stands on its own regardless of whether that's accepted.

Testing

  • New test passes; verified it exercises the intended split-into-two-pieces path (Geometry::MultiPolygon with 2 elements).
  • All 86 geometry:: tests pass, clippy and fmt clean.

Covers a PolygonAssembler case not exercised elsewhere: an inner ring
that touches the outer ring at exactly two points (not along an
overlapping edge, not crossing), so removing it splits the outer into
two disjoint polygons rather than leaving one polygon with a hole.

Found while checking whether the (2012, unlicensed, since-superseded)
nimix/osm_conv_tests test suite had anything our vendored osm-testdata
grid corpus doesn't. This was the one case it had that grid didn't
(grid covers single-point and shared-line inner/outer touches, and a
single self-touching way resolving into two components, but not this
two-separate-rings, two-point-touch case) -- also proposed upstream as
osmcode/osm-testdata#11.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@brawer brawer left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LGTM

@brawer
brawer added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit b0cd679 Aug 12, 2026
4 checks passed
@brawer
brawer deleted the add-inner-outer-two-point-touch-test branch August 12, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant