Skip to content

Commit 5ddb8d1

Browse files
committed
Tests: Add test for check_geometry_overlaps() helper function
1 parent 0fbd9a2 commit 5ddb8d1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

sectionproperties/tests/test_sections.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,3 +394,24 @@ def test_round_polygon_vertices():
394394
test_shape_rounded.wkt
395395
== "POLYGON ((0 200, 200 200, 200 0, 0 0, 0 200), (10 50, 10 10, 50 10, 50 50, 10 50), (170 170, 120 170, 120 120, 170 120, 170 170))"
396396
)
397+
398+
399+
def test_check_geometry_overlaps():
400+
big_sq = rectangular_section(d=300, b=250)
401+
small_sq = rectangular_section(d=100, b=75)
402+
small_hole = rectangular_section(d=40, b=30).align_center(small_sq)
403+
404+
assert check_geometry_overlaps([small_sq.geom, small_hole.geom]) == True
405+
assert check_geometry_overlaps([small_sq.geom, small_sq.geom]) == True
406+
assert (
407+
check_geometry_overlaps(
408+
[big_sq.geom, small_sq.shift_section(x_offset=270).geom]
409+
)
410+
== False
411+
)
412+
assert (
413+
check_geometry_overlaps(
414+
[big_sq.geom, small_sq.shift_section(x_offset=200, y_offset=150).geom]
415+
)
416+
== True
417+
)

0 commit comments

Comments
 (0)