mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-11-19 01:52:29 +01:00
Name what a taken station drops and keep a profile from being its own donor
Written-by: Gemini 4 Hydrogen (Antigravity) Written-by: Claude Fable 5.2
This commit is contained in:
14 files changed
+211
-12
No files matched your search
+17
@@ -272,4 +272,21 @@ class SetupWizardContentScreenTest {
|
||||
|
||||
assertEquals(WizardPage.ENTRY, state.page, "which profile is not said yet")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theSummaryShowsTheFallbackBandForSpots() = runComposeUiTest {
|
||||
val prefs = configuredProfile().apply {
|
||||
setStn_bandActive144(false)
|
||||
setStn_bandActive432(true)
|
||||
setNotify_optionalFrequencyPrefix("144")
|
||||
}
|
||||
val state = SetupWizardState(prefs)
|
||||
state.chooseLoginSource(WizardSource.KEEP)
|
||||
state.chooseStationSource(WizardSource.KEEP)
|
||||
state.next()
|
||||
state.next()
|
||||
show(state)
|
||||
|
||||
onNodeWithText("144 MHz").assertExists()
|
||||
}
|
||||
}
|
||||
@@ -349,4 +349,98 @@ class SetupWizardDonorTest(@param:TempDir private val directory: Path) {
|
||||
assertFalse(restored.isStn_pstRotatorEnabled(), "the operator switched the taken rotator off")
|
||||
assertEquals("JN58QA", restored.getStn_loginLocatorMainCat(), "the operator changed the taken locator")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun takingAStationNamesSo2rAndRotatorTwoWhenTheDonorDropsThem() {
|
||||
val own = emptyProfile().apply {
|
||||
setTrxSynch_so2rEnabled(true)
|
||||
setStn_pstRotator2Enabled(true)
|
||||
}
|
||||
val donorOff = contestStation()
|
||||
val donorOn = WizardDonor("both-on", "Beide an", prefs {
|
||||
integrationsOff()
|
||||
setStn_loginCallSign("DL0BOTH")
|
||||
setStn_loginPassword("secret")
|
||||
setStn_loginLocatorMainCat("JO50AA")
|
||||
setStn_bandActive144(true)
|
||||
setLoginChatCategoryMain(ChatCategory(2))
|
||||
setLoginToSecondChatEnabled(false)
|
||||
setTrxSynch_so2rEnabled(true)
|
||||
setStn_pstRotator2Enabled(true)
|
||||
})
|
||||
|
||||
val takeDrops = SetupWizardState(own, listOf(donorOff)).apply {
|
||||
chooseLoginSource(WizardSource.NEW)
|
||||
chooseStationSource(WizardSource.TAKE)
|
||||
next()
|
||||
}
|
||||
assertEquals(
|
||||
listOf(WizardSwitch.SO2R, WizardSwitch.ROTATOR_2),
|
||||
takeDrops.switchedOff.takeLast(2),
|
||||
)
|
||||
|
||||
val keep = SetupWizardState(own, listOf(donorOff)).apply {
|
||||
chooseLoginSource(WizardSource.NEW)
|
||||
chooseStationSource(WizardSource.KEEP)
|
||||
next()
|
||||
}
|
||||
assertFalse(WizardSwitch.SO2R in keep.switchedOff)
|
||||
assertFalse(WizardSwitch.ROTATOR_2 in keep.switchedOff)
|
||||
|
||||
val takeKeeps = SetupWizardState(own, listOf(donorOn)).apply {
|
||||
chooseLoginSource(WizardSource.NEW)
|
||||
chooseStationSource(WizardSource.TAKE)
|
||||
next()
|
||||
}
|
||||
assertFalse(WizardSwitch.SO2R in takeKeeps.switchedOff)
|
||||
assertFalse(WizardSwitch.ROTATOR_2 in takeKeeps.switchedOff)
|
||||
|
||||
val ownRotator2WithoutSo2r = emptyProfile().apply {
|
||||
setTrxSynch_so2rEnabled(false)
|
||||
setStn_pstRotator2Enabled(true)
|
||||
}
|
||||
val noSo2r = SetupWizardState(ownRotator2WithoutSo2r, listOf(donorOff)).apply {
|
||||
chooseLoginSource(WizardSource.NEW)
|
||||
chooseStationSource(WizardSource.TAKE)
|
||||
next()
|
||||
}
|
||||
assertFalse(WizardSwitch.ROTATOR_2 in noSo2r.switchedOff)
|
||||
assertFalse(WizardSwitch.SO2R in noSo2r.switchedOff)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theSummaryFallbackBandFollowsTheStationSource() {
|
||||
val own = emptyProfile().apply { setNotify_optionalFrequencyPrefix("144") }
|
||||
val donor = WizardDonor("uhf", "UHF", prefs {
|
||||
integrationsOff()
|
||||
setStn_loginCallSign("DL0UHF")
|
||||
setStn_loginPassword("secret")
|
||||
setStn_loginLocatorMainCat("JO50AA")
|
||||
setStn_bandActive432(true)
|
||||
setLoginChatCategoryMain(ChatCategory(2))
|
||||
setLoginToSecondChatEnabled(false)
|
||||
setNotify_optionalFrequencyPrefix("432")
|
||||
})
|
||||
|
||||
val take = SetupWizardState(own, listOf(donor)).apply {
|
||||
chooseLoginSource(WizardSource.NEW)
|
||||
chooseStationSource(WizardSource.TAKE)
|
||||
next()
|
||||
}
|
||||
assertEquals("432", take.summaryFallbackBand)
|
||||
|
||||
val keep = SetupWizardState(own, listOf(donor)).apply {
|
||||
chooseLoginSource(WizardSource.NEW)
|
||||
chooseStationSource(WizardSource.KEEP)
|
||||
next()
|
||||
}
|
||||
assertEquals("144", keep.summaryFallbackBand)
|
||||
|
||||
val fresh = SetupWizardState(own, listOf(donor)).apply {
|
||||
chooseLoginSource(WizardSource.NEW)
|
||||
chooseStationSource(WizardSource.NEW)
|
||||
next()
|
||||
}
|
||||
assertEquals("144", fresh.summaryFallbackBand)
|
||||
}
|
||||
}
|
||||
+18
@@ -6,6 +6,7 @@ import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertFalse
|
||||
import org.junit.jupiter.api.Assertions.assertNull
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Assumptions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.io.TempDir
|
||||
import java.nio.file.Files
|
||||
@@ -203,4 +204,21 @@ class SetupWizardLauncherTest(@param:TempDir private val directory: Path) {
|
||||
assertEquals(1, loaded)
|
||||
assertEquals(emptyList<WizardDonor>(), seen)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aLinkedDirectoryToTheActiveProfileIsNotOfferedAsItsOwnDonor() {
|
||||
val dirB = Files.createDirectory(directory.resolve("b"))
|
||||
val fileInB = dirB.resolve("preferences.xml")
|
||||
Files.copy(configuredFile(), fileInB, StandardCopyOption.REPLACE_EXISTING)
|
||||
val linkA = directory.resolve("a")
|
||||
val linked = runCatching { Files.createSymbolicLink(linkA, dirB) }
|
||||
Assumptions.assumeTrue(
|
||||
linked.isSuccess,
|
||||
"file system refused symbolic link: ${linked.exceptionOrNull()?.message}",
|
||||
)
|
||||
|
||||
val candidates = listOf(DonorCandidate("b", "B", fileInB))
|
||||
assertTrue(loadDonors(candidates, activeFile = linkA.resolve("preferences.xml")).isEmpty())
|
||||
assertEquals(listOf("b"), loadDonors(candidates).map { it.profileId })
|
||||
}
|
||||
}
|
||||
@@ -135,4 +135,17 @@ class WizardAntennaTest {
|
||||
assertEquals("612", antenna.heightAslText)
|
||||
assertTrue(antenna.complete)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aNegativeStoredAntennaHeightIsClampedToZero() {
|
||||
val prefs = stored()
|
||||
val field = ChatPreferences::class.java.getDeclaredField("stn_pathAnalysisOwnAntennaHeightMeters")
|
||||
field.isAccessible = true
|
||||
field.setDouble(prefs, -2.0)
|
||||
|
||||
val antenna = WizardAntenna(prefs)
|
||||
|
||||
assertEquals(0.0, antenna.heightMeters)
|
||||
assertTrue(antenna.complete)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user