mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Added LocationUtilsTest for LocationUtils (#4319)
* added location utils test * requested changes
This commit is contained in:
parent
0d23e65e0f
commit
0a7ff3e068
1 changed files with 34 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
||||||
|
package fr.free.nrw.commons.utils
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.location.LatLng
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test class for location utils
|
||||||
|
*/
|
||||||
|
class LocationUtilsTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MapBox LatLng to commons LatLng test.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun testMapBoxLatLngToCommonsLatLng() {
|
||||||
|
val commonsLatLngTest = LocationUtils.mapBoxLatLngToCommonsLatLng(com.mapbox.mapboxsdk.geometry.LatLng(0.0, 0.0))
|
||||||
|
assertEquals(0.0, commonsLatLngTest.latitude)
|
||||||
|
assertEquals(0.0, commonsLatLngTest.longitude)
|
||||||
|
assertEquals(0f, commonsLatLngTest.accuracy)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commons LatLng to MapBox LatLng test.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun testCommonsLatLngToMapBoxLatLng() {
|
||||||
|
val geoLatLngTest = LocationUtils.commonsLatLngToMapBoxLatLng(LatLng(0.0, 0.0, 0f))
|
||||||
|
assertEquals(0.0, geoLatLngTest.latitude)
|
||||||
|
assertEquals(0.0, geoLatLngTest.longitude)
|
||||||
|
assertEquals(0.0, geoLatLngTest.altitude)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue