mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-11-19 01:52:29 +01:00
Refuse rotator port 65535 and reload antenna proposals on a source change
setStn_pstRotatorPort stores 1..65534 and replaces anything else by 12000, so the wizard must not accept 65535. And antenna values typed for a new station stayed in the summary after the operator chose to keep the station, where they are not written. Written-by: Claude Fable 5.2
This commit is contained in:
6 files changed
+105
-6
No files matched your search
@@ -565,4 +565,34 @@ class SetupWizardStateTest {
|
||||
assertTrue(state.canGoNext)
|
||||
assertTrue(state.mandatoryComplete)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun antennaValuesTypedForANewStationAreGoneWhenTheStationIsKeptAfterAll() {
|
||||
val profile = duplicatedWinTestStation().apply { setStn_antennaBeamWidthDeg(28.0) }
|
||||
val state = SetupWizardState(profile)
|
||||
state.chooseStationSource(WizardSource.NEW)
|
||||
state.next()
|
||||
state.name = "Philipp"
|
||||
state.next()
|
||||
state.callsign = "DL0TEST"
|
||||
state.password = "secret"
|
||||
state.next()
|
||||
state.locator = "JO50AA"
|
||||
state.setBand(WizardBand.B144, true)
|
||||
state.next()
|
||||
assertEquals(WizardPage.ANTENNA, state.page)
|
||||
state.antenna.beamWidthDeg = 99.0
|
||||
|
||||
repeat(4) { state.back() }
|
||||
assertEquals(WizardPage.ENTRY, state.page)
|
||||
state.chooseStationSource(WizardSource.KEEP)
|
||||
state.next()
|
||||
|
||||
assertFalse(state.pages.contains(WizardPage.ANTENNA), "a kept station does not write the antenna page")
|
||||
assertEquals(
|
||||
28.0,
|
||||
state.antenna.beamWidthDeg,
|
||||
"the summary must not show a value that Save will not write",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -105,4 +105,23 @@ class WizardAntennaTest {
|
||||
|
||||
assertTrue(target.getStn_pathAnalysisOwnHeightAslMeters().isNaN(), "empty hands the elevation back to the model")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun loadingTheStoredValuesAgainDropsWhatWasTyped() {
|
||||
val antenna = WizardAntenna(stored())
|
||||
antenna.beamWidthDeg = 99.0
|
||||
antenna.gainDbi = 1.0
|
||||
antenna.heightMeters = 2.0
|
||||
antenna.txPowerWatts = 3.0
|
||||
antenna.heightAslText = "abc"
|
||||
|
||||
antenna.loadStored()
|
||||
|
||||
assertEquals(28.0, antenna.beamWidthDeg)
|
||||
assertEquals(16.5, antenna.gainDbi)
|
||||
assertEquals(18.0, antenna.heightMeters)
|
||||
assertEquals(400.0, antenna.txPowerWatts)
|
||||
assertEquals("612", antenna.heightAslText)
|
||||
assertTrue(antenna.complete)
|
||||
}
|
||||
}
|
||||
@@ -277,4 +277,24 @@ class WizardIntegrationsTest {
|
||||
assertEquals(emptyList<WizardSwitch>(), answers.switchedOffByLog())
|
||||
assertEquals(emptyList<WizardSwitch>(), answers.switchedOffByGear())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theHighestPortIsNoRotatorPort() {
|
||||
// PSTRotator answers on port + 1, so the setter stores 1..65534 only and would
|
||||
// replace 65535 by its factory default without a word.
|
||||
val target = allOff()
|
||||
val answers = WizardIntegrations(target)
|
||||
answers.rotator = true
|
||||
|
||||
answers.rotatorPort = 65535
|
||||
assertFalse(answers.gearComplete, "65535 would be stored as 12000")
|
||||
|
||||
answers.rotatorPort = 65534
|
||||
assertTrue(answers.gearComplete)
|
||||
answers.writeGearTo(target)
|
||||
assertEquals(65534, target.getStn_pstRotatorPort(), "an accepted port is stored as entered")
|
||||
|
||||
answers.rotatorPort = 0
|
||||
assertFalse(answers.gearComplete)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user