diff --git a/src/geometry/polygon_assembler.rs b/src/geometry/polygon_assembler.rs index 040fb9e2..295a1698 100644 --- a/src/geometry/polygon_assembler.rs +++ b/src/geometry/polygon_assembler.rs @@ -384,39 +384,6 @@ mod 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 pieces rather than leaving one polygon - /// with a hole. Mirrors `geometry_multipolygon/8` from `nimix/osm_conv_tests` - /// (2012, unlicensed, not vendored here -- we only inspected it to see - /// whether it had any test cases `osm-testdata`'s vendored `grid` - /// fixtures lack). `grid` covers a single-point inner/outer touch - /// (`7/754`-`7/758`) and touching along a shared line (`7/756`, - /// `7/757`), but not this two-point-touch-splits-the-outer-in-two - /// case, so this test closes that one gap directly in our own suite. - #[test] - fn inner_touching_outer_at_two_points_splits_it_into_two_pieces() { - let mut a = PolygonAssembler::new(); - // Outer: a rectangle with redundant midpoints on its top and - // bottom edges -- the exact points the inner ring below touches. - a.add_ring(&ring(&[ - (0.0, 0.0), - (2.0, 0.0), // bottom midpoint, shared with the inner ring - (4.0, 0.0), - (4.0, 2.0), - (2.0, 2.0), // top midpoint, shared with the inner ring - (0.0, 2.0), - ])); - // Inner: a diamond whose top and bottom vertices land exactly on - // the outer's midpoints above, touching but never crossing. - a.add_ring(&ring(&[(2.0, 2.0), (1.0, 1.0), (2.0, 0.0), (3.0, 1.0)])); - - match a.finish() { - Some(Geometry::MultiPolygon(mp)) => assert_eq!(mp.0.len(), 2), - other => panic!("expected the outer split into two pieces, got {other:?}"), - } - } - /// https://github.com/alltheplaces/osm-diffs/issues/532, mirroring /// grid fixture `7/790`: a ring added twice (the same OSM way listed /// twice as a member) must not cancel itself out under the even-odd diff --git a/tests/test_data/osm-testdata-grid/VENDORED.md b/tests/test_data/osm-testdata-grid/VENDORED.md index 9831cfa5..681b3036 100644 --- a/tests/test_data/osm-testdata-grid/VENDORED.md +++ b/tests/test_data/osm-testdata-grid/VENDORED.md @@ -1,7 +1,7 @@ Source: https://github.com/osmcode/osm-testdata Path: grid/data/ -Commit: ecfdeb0d5ffcfcb60939651d517d5d7d1bb041a3 -Vendored on: 2026-08-06 +Commit: 98a9b32aafe8798523d8b3819c33199eee6d5687 +Vendored on: 2026-08-29 License: Public domain (per upstream README: "All files are released into the public domain.") Used only for tests; not part of any shipped artifact. diff --git a/tests/test_data/osm-testdata-grid/data/7/769/data.osm b/tests/test_data/osm-testdata-grid/data/7/769/data.osm new file mode 100644 index 00000000..3a7f4952 --- /dev/null +++ b/tests/test_data/osm-testdata-grid/data/7/769/data.osm @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_data/osm-testdata-grid/data/7/769/nodes.wkt b/tests/test_data/osm-testdata-grid/data/7/769/nodes.wkt new file mode 100644 index 00000000..0bf93c8a --- /dev/null +++ b/tests/test_data/osm-testdata-grid/data/7/769/nodes.wkt @@ -0,0 +1,8 @@ +769000 POINT(7.92 1.62) +769001 POINT(7.95 1.62) +769002 POINT(7.98 1.62) +769003 POINT(7.98 1.68) +769004 POINT(7.95 1.68) +769005 POINT(7.92 1.68) +769006 POINT(7.93 1.65) +769007 POINT(7.97 1.65) diff --git a/tests/test_data/osm-testdata-grid/data/7/769/result b/tests/test_data/osm-testdata-grid/data/7/769/result new file mode 100644 index 00000000..1e2466df --- /dev/null +++ b/tests/test_data/osm-testdata-grid/data/7/769/result @@ -0,0 +1 @@ +valid diff --git a/tests/test_data/osm-testdata-grid/data/7/769/test.json b/tests/test_data/osm-testdata-grid/data/7/769/test.json new file mode 100644 index 00000000..cf8d49a4 --- /dev/null +++ b/tests/test_data/osm-testdata-grid/data/7/769/test.json @@ -0,0 +1,18 @@ +{ + "test_id": 769, + "description": "Multipolygon with one outer and one inner ring, inner touching outer in two nodes, splitting the outer into two components.", + "areas": { + "default": [ + { + "from_id": 769900, + "from_type": "relation", + "wkt": "MULTIPOLYGON(((7.92 1.62,7.95 1.62,7.93 1.65,7.95 1.68,7.92 1.68,7.92 1.62)),((7.95 1.62,7.98 1.62,7.98 1.68,7.95 1.68,7.97 1.65,7.95 1.62)))", + "tags": { + "landuse": "forest", + "test:section": "mp-geom", + "test:id": "769" + } + } + ] + } +} diff --git a/tests/test_data/osm-testdata-grid/data/7/769/ways.wkt b/tests/test_data/osm-testdata-grid/data/7/769/ways.wkt new file mode 100644 index 00000000..5f2addea --- /dev/null +++ b/tests/test_data/osm-testdata-grid/data/7/769/ways.wkt @@ -0,0 +1,2 @@ +769800 LINESTRING(7.92 1.62,7.95 1.62,7.98 1.62,7.98 1.68,7.95 1.68,7.92 1.68,7.92 1.62) +769801 LINESTRING(7.95 1.68,7.93 1.65,7.95 1.62,7.97 1.65,7.95 1.68) diff --git a/tests/test_data/osm-testdata-grid/data/all.osm b/tests/test_data/osm-testdata-grid/data/all.osm index 791b5943..8b23c507 100644 --- a/tests/test_data/osm-testdata-grid/data/all.osm +++ b/tests/test_data/osm-testdata-grid/data/all.osm @@ -613,6 +613,14 @@ + + + + + + + + @@ -2367,6 +2375,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -3755,6 +3783,14 @@ + + + + + + + + diff --git a/tests/test_data/osm-testdata-grid/data/tests.json b/tests/test_data/osm-testdata-grid/data/tests.json index 26381bb0..a7f86231 100644 --- a/tests/test_data/osm-testdata-grid/data/tests.json +++ b/tests/test_data/osm-testdata-grid/data/tests.json @@ -1204,6 +1204,24 @@ ] } }, + { + "test_id": 769, + "description": "Multipolygon with one outer and one inner ring, inner touching outer in two nodes, splitting the outer into two components.", + "areas": { + "default": [ + { + "from_id": 769900, + "from_type": "relation", + "wkt": "MULTIPOLYGON(((7.92 1.62,7.95 1.62,7.93 1.65,7.95 1.68,7.92 1.68,7.92 1.62)),((7.95 1.62,7.98 1.62,7.98 1.68,7.95 1.68,7.97 1.65,7.95 1.62)))", + "tags": { + "landuse": "forest", + "test:section": "mp-geom", + "test:id": "769" + } + } + ] + } + }, { "test_id": 770, "description": "Multipolygon with two outer rings touching in single node.",