mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-11-19 01:52:29 +01:00
Stop the wizard on unreadable numbers and own its file chooser
Written-by: Codex (GPT-6.2 Sol) Written-by: Claude Fable 5.2
This commit is contained in:
7 files changed
+141
-43
No files matched your search
+43
@@ -2,8 +2,10 @@ package kst4contest.view.compose.wizard
|
||||
|
||||
import androidx.compose.ui.test.ComposeUiTest
|
||||
import androidx.compose.ui.test.ExperimentalTestApi
|
||||
import androidx.compose.ui.test.hasSetTextAction
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.compose.ui.test.performTextReplacement
|
||||
import androidx.compose.ui.test.runComposeUiTest
|
||||
import kst4contest.model.ChatCategory
|
||||
import kst4contest.model.ChatPreferences
|
||||
@@ -168,6 +170,47 @@ class SetupWizardContentScreenTest {
|
||||
onNodeWithText("Take my own frequency from the log program").assertExists()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun nextRefusesAnUnreadableUdpPortAndAcceptsItsCorrection() = runComposeUiTest {
|
||||
val state = SetupWizardState(firstInstallation())
|
||||
state.walkToTheLogPage()
|
||||
state.integrations.chooseLogProgram(WizardLogProgram.UDP)
|
||||
val originalPort = state.integrations.udpPort
|
||||
show(state)
|
||||
|
||||
val portField = onNode(hasSetTextAction())
|
||||
val refusal = onNodeWithText(
|
||||
"Shared UDP port for QSO and TRX messages [default 12060]:: \"abc\" is not a valid entry.",
|
||||
)
|
||||
portField.performTextReplacement("abc")
|
||||
onNodeWithText("Next").performClick()
|
||||
|
||||
assertEquals(originalPort, state.integrations.udpPort)
|
||||
assertEquals(WizardPage.LOG, state.page)
|
||||
refusal.assertExists()
|
||||
|
||||
portField.performTextReplacement("12061")
|
||||
refusal.assertExists()
|
||||
onNodeWithText("Next").performClick()
|
||||
|
||||
assertEquals(WizardPage.GEAR, state.page)
|
||||
assertEquals(12061, state.integrations.udpPort)
|
||||
refusal.assertDoesNotExist()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun finishRefusesAnUnreadableUdpPort() = runComposeUiTest {
|
||||
val state = SetupWizardState(firstInstallation())
|
||||
state.walkToTheLogPage()
|
||||
state.integrations.chooseLogProgram(WizardLogProgram.UDP)
|
||||
show(state)
|
||||
|
||||
onNode(hasSetTextAction()).performTextReplacement("abc")
|
||||
onNodeWithText("Finish").performClick()
|
||||
|
||||
assertEquals(WizardPage.LOG, state.page)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theSummaryNamesWhatANewStationSwitchesOff() = runComposeUiTest {
|
||||
val state = SetupWizardState(firstInstallation())
|
||||
|
||||
@@ -79,6 +79,17 @@ class WizardAntennaTest {
|
||||
assertFalse(antenna.complete)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun antennaHeightMustBeNonNegative() {
|
||||
val antenna = WizardAntenna(stored())
|
||||
|
||||
antenna.heightMeters = -5.0
|
||||
assertFalse(antenna.complete)
|
||||
|
||||
antenna.heightMeters = 0.0
|
||||
assertTrue(antenna.complete)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun writingPutsTheAnswersIntoThePreferences() {
|
||||
val target = prefs()
|
||||
|
||||
+3
-1
@@ -301,6 +301,7 @@ class WizardIntegrationsTest {
|
||||
@Test
|
||||
fun loadingAgainPutsTheDetailsBackToTheStoredOnes() {
|
||||
val answers = WizardIntegrations(winTestStation())
|
||||
val storedFilePath = answers.filePath
|
||||
answers.udpPort = 1
|
||||
answers.wintestPort = 2
|
||||
answers.wintestStationName = "typed"
|
||||
@@ -316,6 +317,7 @@ class WizardIntegrationsTest {
|
||||
assertEquals(12060, answers.udpPort)
|
||||
assertEquals(9999, answers.wintestPort)
|
||||
assertEquals("KST", answers.wintestStationName)
|
||||
assertEquals(storedFilePath, answers.filePath)
|
||||
assertEquals("127.0.0.1", answers.rotatorHost)
|
||||
assertEquals(12000, answers.rotatorPort)
|
||||
assertEquals(9872, answers.airScoutPort)
|
||||
@@ -326,7 +328,7 @@ class WizardIntegrationsTest {
|
||||
answers.rotatorPort = 3
|
||||
answers.loadStored()
|
||||
|
||||
assertFalse(answers.filePath == "/typed", "the stored file name is back")
|
||||
assertEquals(storedFilePath, answers.filePath)
|
||||
assertEquals(12000, answers.rotatorPort)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user