From 15de7c21d93d20dcc8d4744dda70f1a5d2a2168a Mon Sep 17 00:00:00 2001 From: skunkworxdark Date: Tue, 12 Dec 2023 14:12:22 +0000 Subject: [PATCH] updated tests with a test for tile > image for calc_tiles_min_overlap() --- tests/backend/tiles/test_tiles.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/backend/tiles/test_tiles.py b/tests/backend/tiles/test_tiles.py index 0b18f9ed54..114ff4a5e0 100644 --- a/tests/backend/tiles/test_tiles.py +++ b/tests/backend/tiles/test_tiles.py @@ -241,6 +241,28 @@ def test_calc_tiles_min_overlap_not_evenly_divisible(): assert tiles == expected_tiles +def test_calc_tiles_min_overlap_tile_bigger_than_image(): + """Test calc_tiles_min_overlap() behavior when the tile is nigger than the image""" + # Parameters mimic roughly the same output as the original tile generations of the same test name + tiles = calc_tiles_min_overlap( + image_height=1024, + image_width=1024, + tile_height=1408, + tile_width=1408, + min_overlap=128, + ) + + expected_tiles = [ + # single tile + Tile( + coords=TBLR(top=0, bottom=1024, left=0, right=1024), + overlap=TBLR(top=0, bottom=0, left=0, right=0), + ), + ] + + assert tiles == expected_tiles + + @pytest.mark.parametrize( [ "image_height",