mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Relocate radio config to new top-level Settings screen (#2834)
This commit is contained in:
parent
af6066d788
commit
f1bb020203
52 changed files with 1077 additions and 1189 deletions
|
|
@ -27,7 +27,7 @@ import com.geeksville.mesh.ClientOnlyProtos.DeviceProfile
|
|||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.deviceProfile
|
||||
import com.geeksville.mesh.position
|
||||
import com.geeksville.mesh.ui.radioconfig.components.EditDeviceProfileDialog
|
||||
import com.geeksville.mesh.ui.settings.radio.components.EditDeviceProfileDialog
|
||||
import org.junit.Assert
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
|
@ -36,11 +36,9 @@ import org.junit.runner.RunWith
|
|||
@RunWith(AndroidJUnit4::class)
|
||||
class EditDeviceProfileDialogTest {
|
||||
|
||||
@get:Rule
|
||||
val composeTestRule = createComposeRule()
|
||||
@get:Rule val composeTestRule = createComposeRule()
|
||||
|
||||
private fun getString(id: Int): String =
|
||||
InstrumentationRegistry.getInstrumentation().targetContext.getString(id)
|
||||
private fun getString(id: Int): String = InstrumentationRegistry.getInstrumentation().targetContext.getString(id)
|
||||
|
||||
private val title = "Export configuration"
|
||||
private val deviceProfile = deviceProfile {
|
||||
|
|
@ -54,17 +52,15 @@ class EditDeviceProfileDialogTest {
|
|||
}
|
||||
}
|
||||
|
||||
private fun testEditDeviceProfileDialog(
|
||||
onDismiss: () -> Unit = {},
|
||||
onConfirm: (DeviceProfile) -> Unit = {},
|
||||
) = composeTestRule.setContent {
|
||||
EditDeviceProfileDialog(
|
||||
title = title,
|
||||
deviceProfile = deviceProfile,
|
||||
onConfirm = onConfirm,
|
||||
onDismiss = onDismiss,
|
||||
)
|
||||
}
|
||||
private fun testEditDeviceProfileDialog(onDismiss: () -> Unit = {}, onConfirm: (DeviceProfile) -> Unit = {}) =
|
||||
composeTestRule.setContent {
|
||||
EditDeviceProfileDialog(
|
||||
title = title,
|
||||
deviceProfile = deviceProfile,
|
||||
onConfirm = onConfirm,
|
||||
onDismiss = onDismiss,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testEditDeviceProfileDialog_showsDialogTitle() {
|
||||
|
|
@ -113,4 +109,4 @@ class EditDeviceProfileDialogTest {
|
|||
// Verify onConfirm is called with the correct DeviceProfile
|
||||
Assert.assertEquals(deviceProfile, actualDeviceProfile)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import androidx.compose.ui.test.performClick
|
|||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.ui.radioconfig.components.MapReportingPreference
|
||||
import com.geeksville.mesh.ui.settings.radio.components.MapReportingPreference
|
||||
import org.junit.Assert
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
|
@ -36,30 +36,19 @@ import org.junit.runner.RunWith
|
|||
@RunWith(AndroidJUnit4::class)
|
||||
class MapReportingPreferenceTest {
|
||||
|
||||
@get:Rule
|
||||
val composeTestRule = createComposeRule()
|
||||
@get:Rule val composeTestRule = createComposeRule()
|
||||
|
||||
private fun getString(id: Int): String =
|
||||
InstrumentationRegistry.getInstrumentation().targetContext.getString(id)
|
||||
private fun getString(id: Int): String = InstrumentationRegistry.getInstrumentation().targetContext.getString(id)
|
||||
|
||||
var mapReportingEnabled = false
|
||||
var shouldReportLocation = false
|
||||
var positionPrecision = 5
|
||||
var positionReportingInterval = 60
|
||||
|
||||
var mapReportingEnabledChanged = { enabled: Boolean ->
|
||||
mapReportingEnabled = enabled
|
||||
}
|
||||
var shouldReportLocationChanged = { enabled: Boolean ->
|
||||
shouldReportLocation = enabled
|
||||
}
|
||||
var positionPrecisionChanged = { precision: Int ->
|
||||
positionPrecision = precision
|
||||
}
|
||||
var positionReportingIntervalChanged = { interval: Int ->
|
||||
positionReportingInterval = interval
|
||||
}
|
||||
|
||||
var mapReportingEnabledChanged = { enabled: Boolean -> mapReportingEnabled = enabled }
|
||||
var shouldReportLocationChanged = { enabled: Boolean -> shouldReportLocation = enabled }
|
||||
var positionPrecisionChanged = { precision: Int -> positionPrecision = precision }
|
||||
var positionReportingIntervalChanged = { interval: Int -> positionReportingInterval = interval }
|
||||
|
||||
private fun testMapReportingPreference() = composeTestRule.setContent {
|
||||
Column {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue