mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-10-26 16:15:51 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d024dc53b4 |
No files matched your search
@@ -6,9 +6,6 @@ on:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||
|
||||
|
||||
@@ -3,10 +3,6 @@ name: TEST publish-version-xml (local only)
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
|
||||
jobs:
|
||||
publish-version-xml:
|
||||
name: Publish Version Info XML via WebDAV
|
||||
|
||||
+36
-38
@@ -55,47 +55,45 @@ class CompactControlsVisualRenderingTest(@param:TempDir private val tempDir: Pat
|
||||
}
|
||||
val filters = StationFilterState()
|
||||
|
||||
return onEventThread {
|
||||
val scene = ImageComposeScene(width = 1366, height = 380, density = Density(scale)) {
|
||||
Kst4ContestTheme(darkMode = darkMode, baseFontSizeSp = 12f) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
) {
|
||||
Column(Modifier.padding(4.dp)) {
|
||||
TimelineView(
|
||||
state = TimelineState(),
|
||||
onCandidateClicked = {},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
StationFilterBar(
|
||||
filters = filters,
|
||||
activeBands = EnumSet.of(Band.B_144, Band.B_432, Band.B_1296),
|
||||
reachability = ReachabilityState(
|
||||
EnumSet.of(Band.B_144, Band.B_432, Band.B_1296),
|
||||
),
|
||||
onChanged = {},
|
||||
)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
ChatInputRow(
|
||||
state = chatInputState,
|
||||
prefs = preferences,
|
||||
ownQrgMain = ObservedValue(preferences.getMYQRGFirstCat()),
|
||||
ownQrgSecond = ObservedValue(preferences.getMYQRGSecondCat()),
|
||||
antennaQtf = ObservedValue(preferences.getActualQTF()),
|
||||
antennaQtf2 = ObservedValue(preferences.getActualQTF2()),
|
||||
so2rEnabled = false,
|
||||
)
|
||||
}
|
||||
val scene = ImageComposeScene(width = 1366, height = 380, density = Density(scale)) {
|
||||
Kst4ContestTheme(darkMode = darkMode, baseFontSizeSp = 12f) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
) {
|
||||
Column(Modifier.padding(4.dp)) {
|
||||
TimelineView(
|
||||
state = TimelineState(),
|
||||
onCandidateClicked = {},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
StationFilterBar(
|
||||
filters = filters,
|
||||
activeBands = EnumSet.of(Band.B_144, Band.B_432, Band.B_1296),
|
||||
reachability = ReachabilityState(
|
||||
EnumSet.of(Band.B_144, Band.B_432, Band.B_1296),
|
||||
),
|
||||
onChanged = {},
|
||||
)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
ChatInputRow(
|
||||
state = chatInputState,
|
||||
prefs = preferences,
|
||||
ownQrgMain = ObservedValue(preferences.getMYQRGFirstCat()),
|
||||
ownQrgSecond = ObservedValue(preferences.getMYQRGSecondCat()),
|
||||
antennaQtf = ObservedValue(preferences.getActualQTF()),
|
||||
antennaQtf2 = ObservedValue(preferences.getActualQTF2()),
|
||||
so2rEnabled = false,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
scene.render().encodeToData()!!.bytes
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
return try {
|
||||
scene.render().encodeToData()!!.bytes
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package kst4contest.view.compose
|
||||
|
||||
import java.awt.EventQueue
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
|
||||
/*
|
||||
* An ImageComposeScene must live on the AWT event thread, the thread the application renders
|
||||
* on. Compose Multiplatform 1.8.2 sends the global snapshot notifications there
|
||||
* (GlobalSnapshotManager), and doing so takes two locks in the opposite order from a render
|
||||
* on any other thread:
|
||||
*
|
||||
* - the render holds the scene's FlushCoroutineDispatcher runLock while a task it runs
|
||||
* (here LazyListState.scrollToItem) measures and wants the SnapshotStateObserver's
|
||||
* observedScopeMapsLock;
|
||||
* - the event thread holds observedScopeMapsLock in drainChanges while a derived state it
|
||||
* re-reads wakes a snapshotFlow collector of that scene, whose dispatch wants runLock.
|
||||
*
|
||||
* Both waited forever in CI runs 40252077018, 40252089738 and 40299943329; the thread dump of
|
||||
* the last one shows both stacks. On one thread the two monitors are simply re-entered, which
|
||||
* is why the application never hangs this way.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Runs [block] on the AWT event thread, waits for it and returns its result. Whatever
|
||||
* [block] throws is rethrown here unwrapped, so a failed assertion still reads as one.
|
||||
*/
|
||||
internal fun <T> onEventThread(block: () -> T): T {
|
||||
if (EventQueue.isDispatchThread()) return block()
|
||||
|
||||
var result: Result<T>? = null
|
||||
try {
|
||||
EventQueue.invokeAndWait { result = runCatching(block) }
|
||||
} catch (wrapped: InvocationTargetException) {
|
||||
throw wrapped.cause ?: wrapped
|
||||
}
|
||||
return result!!.getOrThrow()
|
||||
}
|
||||
+27
-29
@@ -84,39 +84,37 @@ class SelectedStationMessageUiVisualRenderingTest {
|
||||
replaceRows(listOf(message(member("DL1ABC", 2), member("DL2XYZ", 2), "pse sked")))
|
||||
}
|
||||
|
||||
return onEventThread {
|
||||
val scene = ImageComposeScene(width = 1366, height = windowHeight, density = Density(scale)) {
|
||||
Kst4ContestTheme(darkMode = darkMode, baseFontSizeSp = 12f) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
) {
|
||||
Row(Modifier.fillMaxSize().padding(6.dp)) {
|
||||
MessageTabs(
|
||||
publicMessages = publicMessages,
|
||||
clusterMessages = clusterTable(),
|
||||
qsoOfTheOther = qsoMessages,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
SelectedStationPanel(
|
||||
state = selectedState,
|
||||
messages = selectedMessages,
|
||||
activeBands = EnumSet.of(Band.B_144, Band.B_432, Band.B_1296),
|
||||
openInBrowser = Consumer {},
|
||||
onShowOnMap = {},
|
||||
onShowPathInAirScout = {},
|
||||
modifier = Modifier.width(panelWidth).padding(start = 6.dp),
|
||||
)
|
||||
}
|
||||
val scene = ImageComposeScene(width = 1366, height = windowHeight, density = Density(scale)) {
|
||||
Kst4ContestTheme(darkMode = darkMode, baseFontSizeSp = 12f) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
) {
|
||||
Row(Modifier.fillMaxSize().padding(6.dp)) {
|
||||
MessageTabs(
|
||||
publicMessages = publicMessages,
|
||||
clusterMessages = clusterTable(),
|
||||
qsoOfTheOther = qsoMessages,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
SelectedStationPanel(
|
||||
state = selectedState,
|
||||
messages = selectedMessages,
|
||||
activeBands = EnumSet.of(Band.B_144, Band.B_432, Band.B_1296),
|
||||
openInBrowser = Consumer {},
|
||||
onShowOnMap = {},
|
||||
onShowPathInAirScout = {},
|
||||
modifier = Modifier.width(panelWidth).padding(start = 6.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
scene.render().encodeToData()!!.bytes
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
return try {
|
||||
scene.render().encodeToData()!!.bytes
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+51
-53
@@ -87,64 +87,62 @@ class StationWorkspaceVisualRenderingTest {
|
||||
RowKeys.byReference<ChatMessage>(),
|
||||
)
|
||||
|
||||
return onEventThread {
|
||||
val scene = ImageComposeScene(
|
||||
width = 1366,
|
||||
height = scenario.height,
|
||||
density = Density(scale),
|
||||
) {
|
||||
Kst4ContestTheme(darkMode = darkMode, baseFontSizeSp = 12f) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
val scene = ImageComposeScene(
|
||||
width = 1366,
|
||||
height = scenario.height,
|
||||
density = Density(scale),
|
||||
) {
|
||||
Kst4ContestTheme(darkMode = darkMode, baseFontSizeSp = 12f) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
) {
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
Column(
|
||||
Modifier
|
||||
.width(scenario.width.dp)
|
||||
.fillMaxHeight()
|
||||
.align(Alignment.TopEnd)
|
||||
.padding(4.dp),
|
||||
) {
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
Column(
|
||||
Modifier
|
||||
.width(scenario.width.dp)
|
||||
.fillMaxHeight()
|
||||
.align(Alignment.TopEnd)
|
||||
.padding(4.dp),
|
||||
) {
|
||||
StationFilterBar(
|
||||
filters = StationFilterState(),
|
||||
activeBands = EnumSet.of(Band.B_144, Band.B_432),
|
||||
reachability = ReachabilityState(EnumSet.of(Band.B_144, Band.B_432)),
|
||||
onChanged = {},
|
||||
)
|
||||
DataTableView(
|
||||
state = stations,
|
||||
modifier = Modifier.weight(0.45f),
|
||||
emphasizeCell = { member, column ->
|
||||
column.id == "callsign" && newJoined.isRecent(member)
|
||||
},
|
||||
)
|
||||
TopPriorityBar(
|
||||
state = priority,
|
||||
newJoined = newJoined,
|
||||
onShowMore = {},
|
||||
)
|
||||
SelectedStationPanel(
|
||||
state = selected,
|
||||
messages = selectedMessages,
|
||||
activeBands = EnumSet.of(Band.B_144, Band.B_432),
|
||||
contentSplitter = SplitterState(2, doubleArrayOf(0.48)) {},
|
||||
openInBrowser = Consumer {},
|
||||
onShowOnMap = {},
|
||||
onShowPathInAirScout = {},
|
||||
modifier = Modifier.weight(0.55f),
|
||||
)
|
||||
}
|
||||
}
|
||||
StationFilterBar(
|
||||
filters = StationFilterState(),
|
||||
activeBands = EnumSet.of(Band.B_144, Band.B_432),
|
||||
reachability = ReachabilityState(EnumSet.of(Band.B_144, Band.B_432)),
|
||||
onChanged = {},
|
||||
)
|
||||
DataTableView(
|
||||
state = stations,
|
||||
modifier = Modifier.weight(0.45f),
|
||||
emphasizeCell = { member, column ->
|
||||
column.id == "callsign" && newJoined.isRecent(member)
|
||||
},
|
||||
)
|
||||
TopPriorityBar(
|
||||
state = priority,
|
||||
newJoined = newJoined,
|
||||
onShowMore = {},
|
||||
)
|
||||
SelectedStationPanel(
|
||||
state = selected,
|
||||
messages = selectedMessages,
|
||||
activeBands = EnumSet.of(Band.B_144, Band.B_432),
|
||||
contentSplitter = SplitterState(2, doubleArrayOf(0.48)) {},
|
||||
openInBrowser = Consumer {},
|
||||
onShowOnMap = {},
|
||||
onShowPathInAirScout = {},
|
||||
modifier = Modifier.weight(0.55f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
scene.render().encodeToData()!!.bytes
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
return try {
|
||||
scene.render().encodeToData()!!.bytes
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-21
@@ -32,20 +32,18 @@ class TopPriorityCandidatesWindowTest {
|
||||
/** Runs [block] against a rendered list of [twoCandidates] and reports what it picked. */
|
||||
private fun picking(block: (ImageComposeScene) -> Unit): String? {
|
||||
var picked: String? = null
|
||||
onEventThread {
|
||||
val scene = ImageComposeScene(width = 360, height = 500, density = Density(1f)) {
|
||||
TopPriorityCandidatesWindow.CandidateListForTest(twoCandidates) {
|
||||
picked = it.displayCallSign
|
||||
}
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
block(scene)
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
val scene = ImageComposeScene(width = 360, height = 500, density = Density(1f)) {
|
||||
TopPriorityCandidatesWindow.CandidateListForTest(twoCandidates) {
|
||||
picked = it.displayCallSign
|
||||
}
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
block(scene)
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
return picked
|
||||
}
|
||||
|
||||
@@ -80,15 +78,13 @@ class TopPriorityCandidatesWindowTest {
|
||||
@Test
|
||||
fun `the list renders with candidates and without`() {
|
||||
listOf(emptyList(), twoCandidates).forEach { ranking ->
|
||||
onEventThread {
|
||||
val scene = ImageComposeScene(width = 360, height = 500, density = Density(1f)) {
|
||||
TopPriorityCandidatesWindow.CandidateListForTest(ranking) { }
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
val scene = ImageComposeScene(width = 360, height = 500, density = Density(1f)) {
|
||||
TopPriorityCandidatesWindow.CandidateListForTest(ranking) { }
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-24
@@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.ui.ImageComposeScene
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.Density
|
||||
import kst4contest.view.compose.onEventThread
|
||||
import kst4contest.view.map.MapCallsignRawSnapshot
|
||||
import kst4contest.view.map.MapViewport
|
||||
import kst4contest.view.map.TileFetcher
|
||||
@@ -72,29 +71,27 @@ class ComposeStationMapDrawingTest {
|
||||
workedGrossFields: Set<String> = emptySet(),
|
||||
darkMode: Boolean = true,
|
||||
): BufferedImage {
|
||||
return onEventThread {
|
||||
val scene = ImageComposeScene(canvasWidth, canvasHeight, Density(1f)) {
|
||||
ComposeStationMap(
|
||||
markers = markers,
|
||||
tileFetcher = offlineTileFetcher,
|
||||
mapState = MapState(zoom = zoom, centerLon = 10.0, centerLat = 51.0),
|
||||
groupingEnabled = false,
|
||||
selectedMarkerCallsign = null,
|
||||
ownLocator6 = ownLocator6,
|
||||
antennaAzimuthDeg = 90.0,
|
||||
antennaBeamWidthDeg = 0.0,
|
||||
maxQrbKm = 0.0,
|
||||
onMarkerClicked = null,
|
||||
workedGrossFields = workedGrossFields,
|
||||
darkMode = darkMode,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
)
|
||||
}
|
||||
try {
|
||||
ImageIO.read(ByteArrayInputStream(scene.render().encodeToData()!!.bytes))
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
val scene = ImageComposeScene(canvasWidth, canvasHeight, Density(1f)) {
|
||||
ComposeStationMap(
|
||||
markers = markers,
|
||||
tileFetcher = offlineTileFetcher,
|
||||
mapState = MapState(zoom = zoom, centerLon = 10.0, centerLat = 51.0),
|
||||
groupingEnabled = false,
|
||||
selectedMarkerCallsign = null,
|
||||
ownLocator6 = ownLocator6,
|
||||
antennaAzimuthDeg = 90.0,
|
||||
antennaBeamWidthDeg = 0.0,
|
||||
maxQrbKm = 0.0,
|
||||
onMarkerClicked = null,
|
||||
workedGrossFields = workedGrossFields,
|
||||
darkMode = darkMode,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
)
|
||||
}
|
||||
try {
|
||||
return ImageIO.read(ByteArrayInputStream(scene.render().encodeToData()!!.bytes))
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-27
@@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.ui.ImageComposeScene
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.Density
|
||||
import kst4contest.view.compose.onEventThread
|
||||
import kst4contest.view.map.MapCallsignRawSnapshot
|
||||
import kst4contest.view.map.TileFetcher
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -34,32 +33,30 @@ class ComposeStationMapLayoutTest {
|
||||
)
|
||||
|
||||
private fun renderAt(widthPx: Int, heightPx: Int, zoom: Float) {
|
||||
onEventThread {
|
||||
val scene = ImageComposeScene(
|
||||
width = widthPx,
|
||||
height = heightPx,
|
||||
density = Density(1f),
|
||||
) {
|
||||
ComposeStationMap(
|
||||
markers = stations,
|
||||
tileFetcher = TileFetcher(),
|
||||
mapState = MapState(zoom = zoom, centerLon = 10.0, centerLat = 51.0),
|
||||
groupingEnabled = true,
|
||||
selectedMarkerCallsign = "F5JMI",
|
||||
ownLocator6 = "JO50JP",
|
||||
antennaAzimuthDeg = 229.0,
|
||||
antennaBeamWidthDeg = 60.0,
|
||||
maxQrbKm = 800.0,
|
||||
onMarkerClicked = null,
|
||||
darkMode = true,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
)
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
val scene = ImageComposeScene(
|
||||
width = widthPx,
|
||||
height = heightPx,
|
||||
density = Density(1f),
|
||||
) {
|
||||
ComposeStationMap(
|
||||
markers = stations,
|
||||
tileFetcher = TileFetcher(),
|
||||
mapState = MapState(zoom = zoom, centerLon = 10.0, centerLat = 51.0),
|
||||
groupingEnabled = true,
|
||||
selectedMarkerCallsign = "F5JMI",
|
||||
ownLocator6 = "JO50JP",
|
||||
antennaAzimuthDeg = 229.0,
|
||||
antennaBeamWidthDeg = 60.0,
|
||||
maxQrbKm = 800.0,
|
||||
onMarkerClicked = null,
|
||||
darkMode = true,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
)
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-18
@@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.ui.ImageComposeScene
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.Density
|
||||
import kst4contest.view.compose.onEventThread
|
||||
import kst4contest.view.map.PathAnalysisResult
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
@@ -26,23 +25,21 @@ class PathAnalysisDetailsLayoutTest {
|
||||
private val narrowWidthPx = 120
|
||||
|
||||
private fun renderAt(widthPx: Int, result: PathAnalysisResult?) {
|
||||
onEventThread {
|
||||
val scene = ImageComposeScene(
|
||||
width = widthPx,
|
||||
height = 600,
|
||||
density = Density(1f),
|
||||
) {
|
||||
PathAnalysisDetails(
|
||||
result = result,
|
||||
darkMode = true,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
val scene = ImageComposeScene(
|
||||
width = widthPx,
|
||||
height = 600,
|
||||
density = Density(1f),
|
||||
) {
|
||||
PathAnalysisDetails(
|
||||
result = result,
|
||||
darkMode = true,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-15
@@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.ui.ImageComposeScene
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.Density
|
||||
import kst4contest.view.compose.onEventThread
|
||||
import kst4contest.view.map.PathAnalysisResult
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -32,20 +31,18 @@ class PathAnalysisDetailsWidthTest {
|
||||
private val assessmentBackground = 0x33383E
|
||||
|
||||
private fun render(paneWidthPx: Int, heightPx: Int = 600): BufferedImage {
|
||||
return onEventThread {
|
||||
val scene = ImageComposeScene(width = paneWidthPx, height = heightPx, density = Density(1f)) {
|
||||
PathAnalysisDetails(
|
||||
result = PathAnalysisResult.loading("JO50JP", "JN24JB", "F5JMI"),
|
||||
darkMode = true,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
try {
|
||||
val png = scene.render().encodeToData()!!.bytes
|
||||
ImageIO.read(ByteArrayInputStream(png))
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
val scene = ImageComposeScene(width = paneWidthPx, height = heightPx, density = Density(1f)) {
|
||||
PathAnalysisDetails(
|
||||
result = PathAnalysisResult.loading("JO50JP", "JN24JB", "F5JMI"),
|
||||
darkMode = true,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
try {
|
||||
val png = scene.render().encodeToData()!!.bytes
|
||||
return ImageIO.read(ByteArrayInputStream(png))
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-14
@@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.ui.ImageComposeScene
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.Density
|
||||
import kst4contest.view.compose.onEventThread
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
/**
|
||||
@@ -19,19 +18,17 @@ import org.junit.jupiter.api.Test
|
||||
class PathProfileChartLayoutTest {
|
||||
|
||||
private fun renderAt(widthPx: Int, heightPx: Int) {
|
||||
onEventThread {
|
||||
val scene = ImageComposeScene(
|
||||
width = widthPx,
|
||||
height = heightPx,
|
||||
density = Density(1f),
|
||||
) {
|
||||
PathProfileChart(modifier = Modifier.fillMaxSize(), darkMode = true)
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
val scene = ImageComposeScene(
|
||||
width = widthPx,
|
||||
height = heightPx,
|
||||
density = Density(1f),
|
||||
) {
|
||||
PathProfileChart(modifier = Modifier.fillMaxSize(), darkMode = true)
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-10
@@ -15,7 +15,6 @@ import androidx.compose.ui.unit.dp
|
||||
import kst4contest.view.compose.SplitterOrientation
|
||||
import kst4contest.view.compose.SplitterPane
|
||||
import kst4contest.view.compose.SplitterState
|
||||
import kst4contest.view.compose.onEventThread
|
||||
import kst4contest.view.map.MapCallsignRawSnapshot
|
||||
import kst4contest.view.map.PathAnalysisResult
|
||||
import kst4contest.view.map.TileFetcher
|
||||
@@ -89,15 +88,13 @@ class StationMapBodyLayoutTest {
|
||||
}
|
||||
|
||||
private fun renderAt(widthPx: Int, heightPx: Int, pathAnalysisVisible: Boolean = true) {
|
||||
onEventThread {
|
||||
val scene = ImageComposeScene(width = widthPx, height = heightPx, density = Density(1f)) {
|
||||
Body(pathAnalysisVisible)
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
val scene = ImageComposeScene(width = widthPx, height = heightPx, density = Density(1f)) {
|
||||
Body(pathAnalysisVisible)
|
||||
}
|
||||
try {
|
||||
scene.render()
|
||||
} finally {
|
||||
scene.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,13 +151,6 @@ subprojects {
|
||||
*/
|
||||
systemProperty("junit.jupiter.execution.timeout.default", "2m")
|
||||
systemProperty("junit.jupiter.execution.timeout.thread.mode.default", "SEPARATE_THREAD")
|
||||
/*
|
||||
* The timed-out thread's stack shows where a test waits, not who it waits for: the
|
||||
* rare CI hang in SelectedStationMessageUiVisualRenderingTest blocks on a monitor
|
||||
* that another thread holds. On a timeout JUnit prints all threads to the test's
|
||||
* standard output, which lands in its XML report (the test-results artifact).
|
||||
*/
|
||||
systemProperty("junit.jupiter.execution.timeout.threaddump.enabled", "true")
|
||||
// The default short format prints only the first frame of each cause, which for a
|
||||
// timed-out test is the line it hung in but not the call that blocked there.
|
||||
testLogging {
|
||||
|
||||
+3
-18
@@ -32,26 +32,11 @@ const MANUAL_PAGE_ORDER = {
|
||||
]
|
||||
};
|
||||
|
||||
// Removes HTML tags until none are left, so that nested input such as
|
||||
// "<<b>script>" cannot reassemble a tag after a single pass.
|
||||
function stripHtmlTags(value) {
|
||||
let previous;
|
||||
let current = value;
|
||||
|
||||
do {
|
||||
previous = current;
|
||||
current = current.replace(/<[^>]+>/g, "");
|
||||
} while (current !== previous);
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
function markdownToPlainText(value) {
|
||||
const withoutLinks = (value || "")
|
||||
return (value || "")
|
||||
.replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1")
|
||||
.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
|
||||
|
||||
return stripHtmlTags(withoutLinks)
|
||||
.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1")
|
||||
.replace(/<[^>]+>/g, "")
|
||||
.replace(/[*_~`]/g, "")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
|
||||
Generated
+12
-12
@@ -397,9 +397,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.21",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz",
|
||||
"integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==",
|
||||
"version": "1.1.15",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
|
||||
"integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -831,9 +831,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/gray-matter/node_modules/js-yaml": {
|
||||
"version": "3.15.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.2.tgz",
|
||||
"integrity": "sha512-6EuL879VkRA+1Cz578mKMiKvjPNEuk6+r1JaFzoSWejZmtf7xWbIyw1e3KkxlkzTIt9Taw6JBhEppG7utc1P+w==",
|
||||
"version": "3.15.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.0.tgz",
|
||||
"integrity": "sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -1026,9 +1026,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
|
||||
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
|
||||
"integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -1098,9 +1098,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/liquidjs": {
|
||||
"version": "10.30.0",
|
||||
"resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-10.30.0.tgz",
|
||||
"integrity": "sha512-Fw4wA+8CZsJkaeLEIlPE3AoponfjEZhj7FQvYNcAEcg7jNRik7mEMoaco382FBdrYlykVf6w4vClPNctz2OYjg==",
|
||||
"version": "10.27.1",
|
||||
"resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-10.27.1.tgz",
|
||||
"integrity": "sha512-ylE+1q2kSef1UxAyxqbyuWM3FRWS1v48JK1Y3CoW3bD6TSNXZh0+GsVnihujEpKyR+Jejx2aRAFfC3AHm9rElg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
@@ -28,29 +28,14 @@ function extractTag(xml, tagName) {
|
||||
return match ? match[1].trim() : null;
|
||||
}
|
||||
|
||||
// Applies the removal until nothing changes, so that nested input such as
|
||||
// "<!-<!---->-->" cannot leave a fresh comment behind after a single pass.
|
||||
function removeUntilStable(value, pattern) {
|
||||
let previous;
|
||||
let current = value;
|
||||
|
||||
do {
|
||||
previous = current;
|
||||
current = current.replace(pattern, "");
|
||||
} while (current !== previous);
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
function assertWellFormedStructure(xml) {
|
||||
if (/&(?!amp;|lt;|gt;|quot;|apos;|#\d+;|#x[0-9a-f]+;)/i.test(xml)) {
|
||||
fail("the XML contains an unescaped ampersand");
|
||||
}
|
||||
|
||||
const withoutCommentsAndDeclaration = removeUntilStable(
|
||||
xml,
|
||||
/<!--[\s\S]*?-->|<\?[\s\S]*?\?>/g
|
||||
);
|
||||
const withoutCommentsAndDeclaration = xml
|
||||
.replace(/<!--[\s\S]*?-->/g, "")
|
||||
.replace(/<\?[\s\S]*?\?>/g, "");
|
||||
|
||||
const tagPattern =
|
||||
/<\/?([A-Za-z_][\w:.-]*)(?:\s[^<>]*?)?\s*\/?>/g;
|
||||
|
||||
Reference in new issue
Block a user