@@ -144,6 +144,105 @@ TEST_CASE("simple expire z18", "[NoDB]")
144144 CHECK (*(itr++) == tile_t (18 , 131072 , 131072 ));
145145}
146146
147+ TEST_CASE (" expire a simple line" , " [NoDB]" )
148+ {
149+ uint32_t const zoom = 18 ;
150+ expire_tiles et{zoom, 20000 , defproj};
151+
152+ et.from_geometry (
153+ geom::linestring_t {{1398725.0 , 7493354.0 }, {1399030.0 , 7493354.0 }});
154+
155+ auto const tiles = get_tiles_ordered (&et, zoom, zoom);
156+ CHECK (tiles.size () == 3 );
157+
158+ auto itr = tiles.begin ();
159+ CHECK (*(itr++) == tile_t (18 , 140221 , 82055 ));
160+ CHECK (*(itr++) == tile_t (18 , 140222 , 82055 ));
161+ CHECK (*(itr++) == tile_t (18 , 140223 , 82055 ));
162+ }
163+
164+ TEST_CASE (" expire a line near the tile border" , " [NoDB]" )
165+ {
166+ uint32_t const zoom = 18 ;
167+ expire_tiles et{zoom, 20000 , defproj};
168+
169+ et.from_geometry (
170+ geom::linestring_t {{1398945.0 , 7493267.0 }, {1398960.0 , 7493282.0 }});
171+
172+ auto const tiles = get_tiles_ordered (&et, zoom, zoom);
173+ REQUIRE (tiles.size () == 4 );
174+
175+ auto itr = tiles.begin ();
176+ CHECK (*(itr++) == tile_t (18 , 140222 , 82055 ));
177+ CHECK (*(itr++) == tile_t (18 , 140223 , 82055 ));
178+ CHECK (*(itr++) == tile_t (18 , 140222 , 82056 ));
179+ CHECK (*(itr++) == tile_t (18 , 140223 , 82056 ));
180+ }
181+
182+ TEST_CASE (" expire a u-shaped linestring" , " [NoDB]" )
183+ {
184+ uint32_t const zoom = 18 ;
185+ expire_tiles et{zoom, 20000 , defproj};
186+
187+ et.from_geometry (geom::linestring_t {{1398586.0 , 7493485.0 },
188+ {1398575.0 , 7493347.0 },
189+ {1399020.0 , 7493344.0 },
190+ {1399012.0 , 7493470.0 }});
191+
192+ auto const tiles = get_tiles_unordered (&et, zoom);
193+ REQUIRE (tiles.size () == 6 );
194+
195+ CHECK (tiles.count (tile_t (18 , 140220 , 82054 )) == 1 );
196+ CHECK (tiles.count (tile_t (18 , 140220 , 82055 )) == 1 );
197+ CHECK (tiles.count (tile_t (18 , 140221 , 82055 )) == 1 );
198+ CHECK (tiles.count (tile_t (18 , 140222 , 82055 )) == 1 );
199+ CHECK (tiles.count (tile_t (18 , 140223 , 82055 )) == 1 );
200+ CHECK (tiles.count (tile_t (18 , 140223 , 82054 )) == 1 );
201+ }
202+
203+ TEST_CASE (" expire longer horizontal line" , " [NoDB]" )
204+ {
205+ uint32_t const zoom = 18 ;
206+ expire_tiles et{zoom, 20000 , defproj};
207+
208+ et.from_geometry (
209+ geom::linestring_t {{1397815.0 , 7493800.0 }, {1399316.0 , 7493780.0 }});
210+
211+ auto const tiles = get_tiles_unordered (&et, zoom);
212+ REQUIRE (tiles.size () == 11 );
213+
214+ for (uint32_t x = 140215 ; x <= 140225 ; ++x) {
215+ CHECK (tiles.count (tile_t (18 , x, 82052 )) == 1 );
216+ }
217+ }
218+
219+ TEST_CASE (" expire longer diagonal line" , " [NoDB]" )
220+ {
221+ uint32_t const zoom = 18 ;
222+ expire_tiles et{zoom, 20000 , defproj};
223+
224+ et.from_geometry (
225+ geom::linestring_t {{1398427.0 , 7494118.0 }, {1398869.0 , 7493189.0 }});
226+
227+ auto const tiles = get_tiles_unordered (&et, zoom);
228+ REQUIRE (tiles.size () == 14 );
229+
230+ CHECK (tiles.count (tile_t (18 , 140219 , 82050 )) == 1 );
231+ CHECK (tiles.count (tile_t (18 , 140220 , 82050 )) == 1 );
232+ CHECK (tiles.count (tile_t (18 , 140219 , 82051 )) == 1 );
233+ CHECK (tiles.count (tile_t (18 , 140220 , 82051 )) == 1 );
234+ CHECK (tiles.count (tile_t (18 , 140219 , 82052 )) == 1 );
235+ CHECK (tiles.count (tile_t (18 , 140220 , 82052 )) == 1 );
236+ CHECK (tiles.count (tile_t (18 , 140221 , 82052 )) == 1 );
237+ CHECK (tiles.count (tile_t (18 , 140220 , 82053 )) == 1 );
238+ CHECK (tiles.count (tile_t (18 , 140221 , 82053 )) == 1 );
239+ CHECK (tiles.count (tile_t (18 , 140221 , 82054 )) == 1 );
240+ CHECK (tiles.count (tile_t (18 , 140221 , 82055 )) == 1 );
241+ CHECK (tiles.count (tile_t (18 , 140222 , 82055 )) == 1 );
242+ CHECK (tiles.count (tile_t (18 , 140221 , 82056 )) == 1 );
243+ CHECK (tiles.count (tile_t (18 , 140222 , 82056 )) == 1 );
244+ }
245+
147246/* *
148247 * Test tile expiry on two zoom levels.
149248 */
0 commit comments