From 3dd2cf109193949fd019289fd44224fff9ab9f12 Mon Sep 17 00:00:00 2001 From: Philipp Wagner Date: Thu, 8 Oct 2026 23:18:35 +0200 Subject: [PATCH] Keep the map drawing test off the network and the user's tile cache The test assumed no tile ever arrives, but it used the default TileFetcher, which reads the real disk cache and the OSM tile server. On CI a tile now and then landed before the frame was rendered and covered the background the 'unreachable tile source' test asserts on. An empty temporary cache and a source that always fails make the assumption hold by construction. Co-Authored-By: Claude Opus 5.5 --- .../compose/map/ComposeStationMapDrawingTest.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app-desktop/src/test/kotlin/kst4contest/view/compose/map/ComposeStationMapDrawingTest.kt b/app-desktop/src/test/kotlin/kst4contest/view/compose/map/ComposeStationMapDrawingTest.kt index 0dba96d0..6f5932b4 100644 --- a/app-desktop/src/test/kotlin/kst4contest/view/compose/map/ComposeStationMapDrawingTest.kt +++ b/app-desktop/src/test/kotlin/kst4contest/view/compose/map/ComposeStationMapDrawingTest.kt @@ -11,6 +11,8 @@ import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import java.awt.image.BufferedImage import java.io.ByteArrayInputStream +import java.io.IOException +import java.nio.file.Files import javax.imageio.ImageIO import kotlin.math.abs @@ -42,6 +44,16 @@ class ComposeStationMapDrawingTest { private val darkMapBackground = 0x23282D + /* + * An empty cache and a source that always fails, so that "tiles never arrive" holds by + * construction. The default fetcher read the user's disk cache and the real tile + * server, and on CI a tile now and then made it in before the frame was rendered. + */ + private val offlineTileFetcher = TileFetcher( + Files.createTempDirectory("kst4contest-tile-cache-test"), + { throw IOException("no tile source in this test") }, + ) + private fun station(call: String, locator: String, lat: Double, lon: Double) = MapCallsignRawSnapshot( call, call, locator, lat, lon, "", emptyMap(), @@ -56,7 +68,7 @@ class ComposeStationMapDrawingTest { val scene = ImageComposeScene(canvasWidth, canvasHeight, Density(1f)) { ComposeStationMap( markers = markers, - tileFetcher = TileFetcher(), + tileFetcher = offlineTileFetcher, mapState = MapState(zoom = zoom, centerLon = 10.0, centerLat = 51.0), groupingEnabled = false, selectedMarkerCallsign = null,