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
51
51
import kotlinx.coroutines.Dispatchers
52
52
import kotlinx.coroutines.Job
53
53
import kotlinx.coroutines.launch
54
- import java.util.*
55
54
56
55
private const val DEFAULT_INITIAL_ZOOM = 15.0
57
56
Original file line number Diff line number Diff line change @@ -206,6 +206,12 @@ class MapboxTripStarter internal constructor(
206
206
}
207
207
}
208
208
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
+ */
209
215
private fun onReplayHistoryEnabled (
210
216
mapboxNavigation : MapboxNavigation ,
211
217
options : ReplayHistorySessionOptions
Original file line number Diff line number Diff line change @@ -241,6 +241,30 @@ class MapboxTripStarterTest {
241
241
verify(exactly = 1 ) { replayHistorySession.onAttached(mapboxNavigation) }
242
242
}
243
243
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
+
244
268
private fun mockMapboxNavigation (): MapboxNavigation {
245
269
val mapboxNavigation = mockk<MapboxNavigation >(relaxed = true )
246
270
every { mapboxNavigation.getTripSessionState() } returns TripSessionState .STOPPED
You can’t perform that action at this time.
0 commit comments