Ask about antenna, log program, rotator and AirScout in the setup wizard

Written-by: Codex (GPT-6.2 Sol)
Written-by: Claude Fable 5.2
This commit is contained in:
Rsclub2_2 committed 2026-11-18 21:32:13 +01:00
1 parent facba2b010
commit bde77f3ec1
7 files changed
+625 -44

No files matched your search

@@ -124,4 +124,57 @@ class SetupWizardContentScreenTest {
onNodeWithText("DE").assertExists()
}
/** A first installation: the template's credentials, so the wizard starts from scratch. */
private fun firstInstallation() =
ChatPreferences(Path.of("setup-wizard-screen-test-unused.xml")).apply {
setStn_loginCallSign("DO5AMF")
setStn_loginPassword("changeMe")
setLogsynch_wintestNetworkListenerEnabled(false)
setLogsynch_ucxUDPWkdCallListenerEnabled(true)
setLogsynch_fileBasedWkdCallInterpreterEnabled(false)
// Every other switch stated too, so the summary's wording does not hang on a
// compiled-in default.
setTrxSynch_ucxLogUDPListenerEnabled(false)
setLogsynch_wintestQrgSyncEnabled(false)
setNotify_dxClusterServerEnabled(false)
setStn_pstRotatorEnabled(false)
setAirScout_asUDPListenerEnabled(true)
setLoginToSecondChatEnabled(false)
}
private fun SetupWizardState.walkToTheLogPage() {
name = "Philipp"
next()
callsign = "DL0TEST"
password = "secret"
next()
locator = "JO50AA"
setBand(WizardBand.B144, true)
next()
next()
}
@Test
fun choosingALogProgramOnTheDrawnPageReachesTheState() = runComposeUiTest {
val state = SetupWizardState(firstInstallation())
state.walkToTheLogPage()
assertEquals(WizardPage.LOG, state.page)
show(state)
onNodeWithText("Win-Test").performClick()
assertEquals(WizardLogProgram.WINTEST, state.integrations.logProgram)
onNodeWithText("Take my own frequency from the log program").assertExists()
}
@Test
fun theSummaryNamesWhatANewStationSwitchesOff() = runComposeUiTest {
val state = SetupWizardState(firstInstallation())
state.walkToTheLogPage()
state.finish()
show(state)
onNodeWithText("Will be switched off: network log synchronisation, AirScout.").assertExists()
}
}
@@ -65,7 +65,10 @@ class SetupWizardStateTest {
assertFalse(state.hasEntryPage)
assertEquals(WizardPage.PERSONAL, state.page)
assertEquals(
listOf(WizardPage.PERSONAL, WizardPage.LOGIN, WizardPage.SITE, WizardPage.SUMMARY),
listOf(
WizardPage.PERSONAL, WizardPage.LOGIN, WizardPage.SITE,
WizardPage.ANTENNA, WizardPage.LOG, WizardPage.GEAR, WizardPage.SUMMARY,
),
state.pages,
)
assertEquals("", state.name, "the template's name is nobody's name")
@@ -280,19 +283,6 @@ class SetupWizardStateTest {
assertEquals(WizardPage.SUMMARY, state.page)
}
@Test
fun theSummarySaysWhatIsSwitchedOffAndWhatIsLeftAlone() {
val fresh = SetupWizardState(freshInstallation())
assertTrue(fresh.turnsOffSecondChat, "the template has the second chat on, a new station has it off")
assertTrue(fresh.leavesIntegrationsUntouched)
val kept = SetupWizardState(duplicatedProfile())
kept.chooseStationSource(WizardSource.KEEP)
kept.next()
assertFalse(kept.turnsOffSecondChat)
assertFalse(kept.leavesIntegrationsUntouched)
}
@Test
fun keepingAStationWithMissingLocatorKeepsTheSitePageInTheCourse() {
val state = SetupWizardState(duplicatedProfile().apply { setStn_loginLocatorMainCat("") })
@@ -414,4 +404,165 @@ class SetupWizardStateTest {
state.next()
assertEquals(WizardPage.SUMMARY, state.page)
}
/** A first installation whose stored integrations are those of the bundled template. */
private fun freshInstallationLikeTheTemplate() = freshInstallation().apply {
setLogsynch_wintestNetworkListenerEnabled(false)
setLogsynch_ucxUDPWkdCallListenerEnabled(true)
setLogsynch_fileBasedWkdCallInterpreterEnabled(true)
setTrxSynch_ucxLogUDPListenerEnabled(true)
setLogsynch_wintestQrgSyncEnabled(false)
setNotify_dxClusterServerEnabled(true)
setStn_pstRotatorEnabled(false)
setAirScout_asUDPListenerEnabled(true)
setLogsynch_ucxUDPWkdCallListenerPort(12060)
}
/** A duplicated profile at a Win-Test station with a rotator. */
private fun duplicatedWinTestStation() = duplicatedProfile().apply {
setLogsynch_wintestNetworkListenerEnabled(true)
setLogsynch_wintestNetworkPort(9871)
setLogsynch_wintestNetworkStationNameOfKST("KST")
setLogsynch_ucxUDPWkdCallListenerEnabled(false)
setLogsynch_fileBasedWkdCallInterpreterEnabled(false)
setLogsynch_wintestQrgSyncEnabled(true)
setTrxSynch_ucxLogUDPListenerEnabled(false)
setNotify_dxClusterServerEnabled(false)
setStn_pstRotatorEnabled(true)
setStn_pstRotatorHost("127.0.0.1")
setStn_pstRotatorPort(12000)
setAirScout_asUDPListenerEnabled(false)
setTrxSynch_so2rEnabled(false)
}
@Test
fun aNewStationStartsWithEveryIntegrationOff() {
val state = SetupWizardState(freshInstallationLikeTheTemplate())
assertEquals(WizardLogProgram.NONE, state.integrations.logProgram)
assertFalse(state.integrations.qrgFollow)
assertFalse(state.integrations.clusterServer)
assertFalse(state.integrations.rotator)
assertFalse(state.integrations.airScout)
assertEquals(
listOf(
WizardSwitch.SECOND_CHAT, WizardSwitch.LOG_UDP, WizardSwitch.LOG_FILE,
WizardSwitch.QRG_FOLLOW, WizardSwitch.CLUSTER_SERVER, WizardSwitch.AIRSCOUT,
),
state.switchedOff,
"the summary names everything the template had on",
)
}
@Test
fun theNewPagesComeAfterTheLocationAndCanBeWalkedThrough() {
val state = SetupWizardState(freshInstallationLikeTheTemplate())
state.fillFirstInstallation()
state.next()
assertEquals(WizardPage.ANTENNA, state.page)
assertTrue(state.canGoNext, "the antenna values are proposals and valid as they stand")
state.next()
assertEquals(WizardPage.LOG, state.page)
state.next()
assertEquals(WizardPage.GEAR, state.page)
state.next()
assertEquals(WizardPage.SUMMARY, state.page)
state.back()
assertEquals(WizardPage.GEAR, state.page)
}
@Test
fun finishingEarlyStillSwitchesANewStationsIntegrationsOff() {
val state = SetupWizardState(freshInstallationLikeTheTemplate())
state.fillFirstInstallation()
assertTrue(state.canFinish)
state.finish()
assertEquals(WizardPage.SUMMARY, state.page)
assertTrue(state.switchedOff.contains(WizardSwitch.LOG_UDP), "a skipped page of a new station still applies")
assertTrue(state.switchedOff.contains(WizardSwitch.AIRSCOUT))
}
@Test
fun aKeptStationSkipsTheNewPagesAndSwitchesNothingOff() {
val state = SetupWizardState(duplicatedWinTestStation())
state.chooseStationSource(WizardSource.KEEP)
state.next()
assertEquals(
listOf(WizardPage.ENTRY, WizardPage.PERSONAL, WizardPage.LOGIN, WizardPage.SUMMARY),
state.pages,
)
assertEquals(WizardLogProgram.WINTEST, state.integrations.logProgram, "the summary shows what is stored")
assertTrue(state.integrations.rotator)
assertEquals(emptyList<WizardSwitch>(), state.switchedOff)
assertTrue(state.logPageEditable)
}
@Test
fun changeFromTheSummaryOpensANewPageOfAKeptStation() {
val state = SetupWizardState(duplicatedWinTestStation())
state.chooseStationSource(WizardSource.KEEP)
state.next()
state.name = "Philipp"
state.next()
state.callsign = "DL0TEST"
state.password = "secret"
state.next()
assertEquals(WizardPage.SUMMARY, state.page)
state.edit(WizardPage.GEAR)
assertEquals(WizardPage.GEAR, state.page)
state.integrations.rotator = false
state.next()
assertEquals(WizardPage.SUMMARY, state.page)
assertEquals(listOf(WizardSwitch.ROTATOR), state.switchedOff)
}
@Test
fun aKeptStationWithSeveralLogSourcesCannotOpenTheLogPage() {
val state = SetupWizardState(duplicatedProfile().apply {
setLogsynch_wintestNetworkListenerEnabled(false)
setLogsynch_ucxUDPWkdCallListenerEnabled(true)
setLogsynch_fileBasedWkdCallInterpreterEnabled(true)
})
state.chooseStationSource(WizardSource.KEEP)
state.next()
state.name = "Philipp"
state.next()
state.callsign = "DL0TEST"
state.password = "secret"
state.next()
assertFalse(state.logPageEditable, "the page knows one source and would switch the other off")
state.edit(WizardPage.LOG)
assertEquals(WizardPage.SUMMARY, state.page, "the log page must stay shut")
state.edit(WizardPage.GEAR)
assertEquals(WizardPage.GEAR, state.page, "the other pages are not affected")
}
@Test
fun anInvalidOptionalPageBlocksSaving() {
val state = SetupWizardState(freshInstallationLikeTheTemplate())
state.fillFirstInstallation()
state.next()
state.next()
assertEquals(WizardPage.LOG, state.page)
state.integrations.chooseLogProgram(WizardLogProgram.UDP)
state.integrations.udpPort = 0
assertFalse(state.canGoNext)
assertFalse(state.canFinish, "a summary that cannot be saved helps nobody")
assertFalse(state.mandatoryComplete)
state.integrations.udpPort = 12060
assertTrue(state.canGoNext)
assertTrue(state.mandatoryComplete)
}
}
@@ -100,9 +100,6 @@ class SetupWizardWriteTest(@param:TempDir private val directory: Path) {
val prefs = read(file)
val server = prefs.getStn_on4kstServersDns()
val rotatorPort = prefs.getStn_pstRotatorPort()
val udpListener = prefs.isLogsynch_ucxUDPWkdCallListenerEnabled()
val clusterServer = prefs.isNotify_dxClusterServerEnabled()
val airScout = prefs.isAirScout_asUDPListenerEnabled()
val beamWidth = prefs.getStn_antennaBeamWidthDeg()
val state = SetupWizardState(prefs)
@@ -112,9 +109,6 @@ class SetupWizardWriteTest(@param:TempDir private val directory: Path) {
val restored = read(file)
assertEquals(server, restored.getStn_on4kstServersDns())
assertEquals(rotatorPort, restored.getStn_pstRotatorPort())
assertEquals(udpListener, restored.isLogsynch_ucxUDPWkdCallListenerEnabled())
assertEquals(clusterServer, restored.isNotify_dxClusterServerEnabled())
assertEquals(airScout, restored.isAirScout_asUDPListenerEnabled())
assertEquals(beamWidth, restored.getStn_antennaBeamWidthDeg())
}
@@ -224,4 +218,122 @@ class SetupWizardWriteTest(@param:TempDir private val directory: Path) {
assertFalse(state.writeTo(unwritable), "a write that failed must not read as saved")
}
@Test
fun aNewStationWithoutALogProgramHasEverySynchronisationOff() {
val file = templateFile()
val prefs = read(file)
val state = SetupWizardState(prefs)
state.answerFirstInstallation()
assertTrue(state.writeTo(prefs))
val restored = read(file)
assertFalse(restored.isLogsynch_wintestNetworkListenerEnabled())
assertFalse(restored.isLogsynch_ucxUDPWkdCallListenerEnabled())
assertFalse(restored.isLogsynch_fileBasedWkdCallInterpreterEnabled())
assertFalse(restored.isTrxSynch_ucxLogUDPListenerEnabled())
assertFalse(restored.isLogsynch_wintestQrgSyncEnabled())
assertFalse(restored.isNotify_dxClusterServerEnabled())
assertFalse(restored.isStn_pstRotatorEnabled())
assertFalse(restored.isAirScout_asUDPListenerEnabled())
}
@Test
fun theAnswersOfTheNewPagesAreWritten() {
val file = templateFile()
val prefs = read(file)
val state = SetupWizardState(prefs)
state.name = "Philipp"
state.next()
state.callsign = "DL0TEST"
state.password = "secret"
state.next()
state.locator = "JO50AA"
state.setBand(WizardBand.B144, true)
state.next()
state.antenna.beamWidthDeg = 28.0
state.antenna.heightAslText = "612"
state.next()
state.integrations.chooseLogProgram(WizardLogProgram.WINTEST)
state.integrations.wintestPort = 9871
// Stated, not taken from the template: without a name the page could not be left.
state.integrations.wintestStationName = "KST"
state.integrations.qrgFollow = true
state.next()
assertEquals(WizardPage.GEAR, state.page)
state.integrations.rotator = true
state.integrations.rotatorHost = "127.0.0.1"
state.integrations.rotatorPort = 12000
assertTrue(state.writeTo(prefs))
val restored = read(file)
assertEquals(28.0, restored.getStn_antennaBeamWidthDeg())
assertEquals(612.0, restored.getStn_pathAnalysisOwnHeightAslMeters())
assertTrue(restored.isLogsynch_wintestNetworkListenerEnabled())
assertEquals(9871, restored.getLogsynch_wintestNetworkPort())
assertTrue(restored.isLogsynch_wintestQrgSyncEnabled())
assertFalse(restored.isLogsynch_ucxUDPWkdCallListenerEnabled())
assertTrue(restored.isStn_pstRotatorEnabled())
assertFalse(restored.isAirScout_asUDPListenerEnabled())
}
@Test
fun aKeptStationKeepsEveryIntegrationAsItWas() {
// The template's integrations, several log sources among them, under a real login.
val file = configuredFile()
val before = read(file)
val prefs = read(file)
val state = SetupWizardState(prefs)
state.chooseLoginSource(WizardSource.KEEP)
state.chooseStationSource(WizardSource.KEEP)
state.next()
state.next()
assertTrue(state.writeTo(prefs))
val restored = read(file)
assertEquals(before.isLogsynch_ucxUDPWkdCallListenerEnabled(), restored.isLogsynch_ucxUDPWkdCallListenerEnabled())
assertEquals(
before.isLogsynch_fileBasedWkdCallInterpreterEnabled(),
restored.isLogsynch_fileBasedWkdCallInterpreterEnabled(),
)
assertEquals(before.isTrxSynch_ucxLogUDPListenerEnabled(), restored.isTrxSynch_ucxLogUDPListenerEnabled())
assertEquals(before.isNotify_dxClusterServerEnabled(), restored.isNotify_dxClusterServerEnabled())
assertEquals(before.isAirScout_asUDPListenerEnabled(), restored.isAirScout_asUDPListenerEnabled())
assertEquals(before.getStn_antennaBeamWidthDeg(), restored.getStn_antennaBeamWidthDeg())
assertTrue(
restored.isLogsynch_ucxUDPWkdCallListenerEnabled() && restored.isLogsynch_fileBasedWkdCallInterpreterEnabled(),
"the template has two log sources on; if this fails the template changed and the test needs another example",
)
}
@Test
fun openingOneNewPageOfAKeptStationWritesOnlyThatPage() {
val file = configuredFile()
val before = read(file)
val prefs = read(file)
val state = SetupWizardState(prefs)
state.chooseLoginSource(WizardSource.KEEP)
state.chooseStationSource(WizardSource.KEEP)
state.next()
state.next()
state.edit(WizardPage.GEAR)
state.integrations.rotator = true
state.integrations.rotatorHost = "127.0.0.1"
state.integrations.rotatorPort = 12000
state.next()
assertTrue(state.writeTo(prefs))
val restored = read(file)
assertTrue(restored.isStn_pstRotatorEnabled())
assertEquals(
before.isLogsynch_fileBasedWkdCallInterpreterEnabled(),
restored.isLogsynch_fileBasedWkdCallInterpreterEnabled(),
"the log page was not opened, so the log sources stay",
)
assertEquals(before.isNotify_dxClusterServerEnabled(), restored.isNotify_dxClusterServerEnabled())
}
}