File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
examples/src/main/java/com/mapbox/navigation/examples/core
main/java/com/mapbox/navigation/core/trip
test/java/com/mapbox/navigation/core/trip Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,6 @@ import kotlinx.coroutines.CoroutineScope
5151import kotlinx.coroutines.Dispatchers
5252import kotlinx.coroutines.Job
5353import kotlinx.coroutines.launch
54- import java.util.*
5554
5655private const val DEFAULT_INITIAL_ZOOM = 15.0
5756
Original file line number Diff line number Diff line change @@ -206,6 +206,12 @@ class MapboxTripStarter internal constructor(
206206 }
207207 }
208208
209+ /* *
210+ * Internally called when the trip type has been set to replay history.
211+ *
212+ * @param mapboxNavigation
213+ * @param options parameters for the [ReplayHistorySession]
214+ */
209215 private fun onReplayHistoryEnabled (
210216 mapboxNavigation : MapboxNavigation ,
211217 options : ReplayHistorySessionOptions
Original file line number Diff line number Diff line change @@ -241,6 +241,30 @@ class MapboxTripStarterTest {
241241 verify(exactly = 1 ) { replayHistorySession.onAttached(mapboxNavigation) }
242242 }
243243
244+ @Test
245+ fun `enableReplayHistory will set options before onAttached` () {
246+ every { PermissionsManager .areLocationPermissionsGranted(any()) } returns false
247+
248+ val mapboxNavigation = mockMapboxNavigation()
249+ sut.enableReplayHistory()
250+ sut.onAttached(mapboxNavigation)
251+ val nextOptions = sut.getReplayHistorySessionOptions().toBuilder()
252+ .enableSetRoute(false )
253+ .build()
254+ sut.enableReplayHistory(nextOptions)
255+
256+ verifyOrder {
257+ replayHistorySession.setOptions(any())
258+ replayHistorySession.onAttached(mapboxNavigation)
259+ replayHistorySession.setOptions(nextOptions)
260+ }
261+ verify(exactly = 0 ) {
262+ mapboxNavigation.stopTripSession()
263+ replayHistorySession.onDetached(mapboxNavigation)
264+ }
265+ }
266+
267+
244268 private fun mockMapboxNavigation (): MapboxNavigation {
245269 val mapboxNavigation = mockk<MapboxNavigation >(relaxed = true )
246270 every { mapboxNavigation.getTripSessionState() } returns TripSessionState .STOPPED
You can’t perform that action at this time.
0 commit comments