mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
make the test work with any non US default Locale
This commit is contained in:
parent
57e30e5757
commit
7c829998e9
1 changed files with 17 additions and 0 deletions
|
|
@ -1,13 +1,30 @@
|
|||
package com.geeksville.mesh
|
||||
|
||||
import androidx.core.os.LocaleListCompat
|
||||
import org.junit.After
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import java.util.*
|
||||
|
||||
class NodeInfoTest {
|
||||
val ni1 = NodeInfo(4, MeshUser("+one", "User One", "U1"), Position(37.1, 121.1, 35))
|
||||
val ni2 = NodeInfo(5, MeshUser("+two", "User Two", "U2"), Position(37.11, 121.1, 40))
|
||||
val ni3 = NodeInfo(6, MeshUser("+three", "User Three", "U3"), Position(37.101, 121.1, 40))
|
||||
|
||||
private val currentDefaultLocale = LocaleListCompat.getDefault().get(0)
|
||||
|
||||
@Before
|
||||
fun setup()
|
||||
{
|
||||
Locale.setDefault(Locale.US)
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
Locale.setDefault(currentDefaultLocale)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun distanceGood() {
|
||||
Assert.assertEquals(ni1.distance(ni2), 1111)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue