File tree Expand file tree Collapse file tree 2 files changed +39
-3
lines changed
main/java/com/mapcode/map
test/java/com/mapcode/map Expand file tree Collapse file tree 2 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ class MapViewModel @Inject constructor(
190190 }
191191
192192 val cleansedLatitude = LocationUtils .cleanseLatitude(query.toDouble())
193- moveCamera(cleansedLatitude, location.value.longitude, 0f )
193+ moveCamera(cleansedLatitude, location.value.longitude, 17f )
194194 }
195195
196196 fun queryLongitude (query : String ) {
@@ -199,7 +199,7 @@ class MapViewModel @Inject constructor(
199199 }
200200
201201 val cleansedLongitude = LocationUtils .cleanseLongitude(query.toDouble())
202- moveCamera(location.value.latitude, cleansedLongitude, 0f )
202+ moveCamera(location.value.latitude, cleansedLongitude, 17f )
203203 }
204204
205205 fun onTerritoryClick () {
@@ -250,7 +250,7 @@ class MapViewModel @Inject constructor(
250250 */
251251 private fun onResolveAddressQuery (query : String , result : Result <Location >) {
252252 result.onSuccess { newLocation ->
253- moveCamera(newLocation.latitude, newLocation.longitude, 0f )
253+ moveCamera(newLocation.latitude, newLocation.longitude, 17f )
254254 }.onFailure { error ->
255255 val addressHelper: AddressHelper
256256 val addressError: AddressError
Original file line number Diff line number Diff line change @@ -583,4 +583,40 @@ internal class MapViewModelTest {
583583
584584 assertThat(viewModel.showCantFindLocationSnackBar).isFalse()
585585 }
586+
587+ @Test
588+ fun `zoom into street level after searching an address` () = runTest {
589+ useCase.knownLocations.add(
590+ FakeLocation (
591+ 1.0 ,
592+ 1.0 ,
593+ addresses = listOf (" Street, City, Country" ),
594+ mapcodes = listOf (
595+ Mapcode (" AB.CD" , Territory .NLD ),
596+ Mapcode (" VX.YZ" , Territory .NLD )
597+ )
598+ )
599+ )
600+
601+ viewModel.queryAddress(" Street, City, Country" )
602+ runCurrent()
603+
604+ assertThat(viewModel.zoom.value).isEqualTo(17f )
605+ }
606+
607+ @Test
608+ fun `zoom into street level after searching a latitude` () = runTest {
609+ viewModel.queryLatitude(" 1.0" )
610+ runCurrent()
611+
612+ assertThat(viewModel.zoom.value).isEqualTo(17f )
613+ }
614+
615+ @Test
616+ fun `zoom into street level after searching a longitude` () = runTest {
617+ viewModel.queryLongitude(" 1.0" )
618+ runCurrent()
619+
620+ assertThat(viewModel.zoom.value).isEqualTo(17f )
621+ }
586622}
You can’t perform that action at this time.
0 commit comments