Skip to content

Commit

Permalink
more location updates in route refresh tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VysotskiVadim committed Oct 27, 2023
1 parent 20d2239 commit 0fda286
Showing 1 changed file with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.mapbox.navigation.instrumentation_tests.utils.http.MockDirectionsRequ
import com.mapbox.navigation.instrumentation_tests.utils.http.MockRoutingTileEndpointErrorRequestHandler
import com.mapbox.navigation.instrumentation_tests.utils.idling.IdlingPolicyTimeoutRule
import com.mapbox.navigation.instrumentation_tests.utils.location.MockLocationReplayerRule
import com.mapbox.navigation.instrumentation_tests.utils.location.stayOnPosition
import com.mapbox.navigation.instrumentation_tests.utils.readRawFileText
import com.mapbox.navigation.instrumentation_tests.utils.routes.MockRoute
import com.mapbox.navigation.instrumentation_tests.utils.routes.RoutesProvider.toNavigationRoutes
Expand Down Expand Up @@ -815,34 +816,33 @@ class RouteRefreshTest : BaseCoreNoCleanUpTest() {
}.first()

// corresponds to currentRouteGeometryIndex = 70 for alternative route and 11 for the primary route
mockLocationUpdatesRule.pushLocationUpdate(
mockLocationUpdatesRule.generateLocationUpdate {
latitude = 38.581798
longitude = -121.476146
}
)

mapboxNavigation.setNavigationRoutes(
listOf(primaryRoute) + alternativeRoutes,
initialLegIndex = 0
)
mapboxNavigation.startTripSession()
stayOnPosition(
latitude = 38.581798,
longitude = -121.476146,
bearing = 0f
) {
mapboxNavigation.setNavigationRoutes(
listOf(primaryRoute) + alternativeRoutes,
initialLegIndex = 0
)
mapboxNavigation.startTripSession()

mapboxNavigation.routeProgressUpdates()
.filter {
it.currentRouteGeometryIndex == 11
}
.first()
mapboxNavigation.routeProgressUpdates()
.filter {
it.currentRouteGeometryIndex == 11
}
.first()

mapboxNavigation.routesUpdates()
.filter {
(it.reason == ROUTES_UPDATE_REASON_REFRESH).also {
if (it) {
assertEquals(0, mapboxNavigation.currentLegIndex())
mapboxNavigation.routesUpdates()
.filter {
(it.reason == ROUTES_UPDATE_REASON_REFRESH).also {
if (it) {
assertEquals(0, mapboxNavigation.currentLegIndex())
}
}
}
}
.first()
.first()
}
}

@Test
Expand Down

0 comments on commit 0fda286

Please sign in to comment.