@@ -144,122 +144,126 @@ void main() {
144144 await GoogleMapsNavigator .cleanup ();
145145 });
146146
147- patrol ('Test navigating to multiple destinations' ,
148- (PatrolIntegrationTester $) async {
149- final Completer <void > navigationFinished = Completer <void >();
150- int arrivalEventCount = 0 ;
151-
152- /// Set up navigation.
153- await startNavigationWithoutDestination ($);
154-
155- /// Set audio guidance settings.
156- /// Cannot be verified, because native SDK lacks getter methods,
157- /// but exercise the API for basic sanity testing
158- final NavigationAudioGuidanceSettings settings =
159- NavigationAudioGuidanceSettings (
160- isBluetoothAudioEnabled: false ,
161- isVibrationEnabled: false ,
162- guidanceType: NavigationAudioGuidanceType .alertsOnly,
163- );
164- await GoogleMapsNavigator .setAudioGuidance (settings);
165-
166- /// Specify tolerance and navigation destination coordinates.
167- const double tolerance = 0.001 ;
168- const double midLat = 68.59781164189049 ,
169- midLon = 23.520303427087182 ,
170- endLat = 68.60079240808535 ,
171- endLng = 23.527946512754752 ;
172-
173- Future <void > onArrivalEvent (OnArrivalEvent msg) async {
174- arrivalEventCount += 1 ;
175- await GoogleMapsNavigator .continueToNextDestination ();
176-
177- /// Finish executing the tests once 2 onArrival events come in.
178- /// Test the guidance stops on last Arrival.
179- if (arrivalEventCount == 2 ) {
180- navigationFinished.complete ();
147+ patrol (
148+ 'Test navigating to multiple destinations' ,
149+ (PatrolIntegrationTester $) async {
150+ final Completer <void > navigationFinished = Completer <void >();
151+ int arrivalEventCount = 0 ;
152+
153+ /// Set up navigation.
154+ await startNavigationWithoutDestination ($);
155+
156+ /// Set audio guidance settings.
157+ /// Cannot be verified, because native SDK lacks getter methods,
158+ /// but exercise the API for basic sanity testing
159+ final NavigationAudioGuidanceSettings settings =
160+ NavigationAudioGuidanceSettings (
161+ isBluetoothAudioEnabled: false ,
162+ isVibrationEnabled: false ,
163+ guidanceType: NavigationAudioGuidanceType .alertsOnly,
164+ );
165+ await GoogleMapsNavigator .setAudioGuidance (settings);
166+
167+ /// Specify tolerance and navigation destination coordinates.
168+ const double tolerance = 0.001 ;
169+ const double midLat = 68.59781164189049 ,
170+ midLon = 23.520303427087182 ,
171+ endLat = 68.60079240808535 ,
172+ endLng = 23.527946512754752 ;
173+
174+ Future <void > onArrivalEvent (OnArrivalEvent msg) async {
175+ arrivalEventCount += 1 ;
176+ await GoogleMapsNavigator .continueToNextDestination ();
177+
178+ /// Finish executing the tests once 2 onArrival events come in.
179+ /// Test the guidance stops on last Arrival.
180+ if (arrivalEventCount == 2 ) {
181+ navigationFinished.complete ();
182+ }
181183 }
182- }
183184
184- GoogleMapsNavigator .setOnArrivalListener (onArrivalEvent);
185+ GoogleMapsNavigator .setOnArrivalListener (onArrivalEvent);
185186
186- /// Simulate location and test it.
187- await GoogleMapsNavigator .simulator.setUserLocation (const LatLng (
188- latitude: startLat,
189- longitude: startLng,
190- ));
191- await $.pumpAndSettle (timeout: const Duration (seconds: 1 ));
187+ /// Simulate location and test it.
188+ await GoogleMapsNavigator .simulator.setUserLocation (const LatLng (
189+ latitude: startLat,
190+ longitude: startLng,
191+ ));
192+ await $.pumpAndSettle (timeout: const Duration (seconds: 1 ));
192193
193- /// Set Destination.
194- final Destinations destinations = Destinations (
195- waypoints: < NavigationWaypoint > [
196- NavigationWaypoint .withLatLngTarget (
197- title: 'Näkkäläntie 1st stop' ,
198- target: const LatLng (
199- latitude: midLat,
200- longitude: midLon,
194+ /// Set Destination.
195+ final Destinations destinations = Destinations (
196+ waypoints: < NavigationWaypoint > [
197+ NavigationWaypoint .withLatLngTarget (
198+ title: 'Näkkäläntie 1st stop' ,
199+ target: const LatLng (
200+ latitude: midLat,
201+ longitude: midLon,
202+ ),
201203 ),
202- ),
203- NavigationWaypoint . withLatLngTarget (
204- title : 'Näkkäläntie 2nd stop' ,
205- target : const LatLng (
206- latitude : endLat ,
207- longitude : endLng ,
204+ NavigationWaypoint . withLatLngTarget (
205+ title : 'Näkkäläntie 2nd stop' ,
206+ target : const LatLng (
207+ latitude : endLat,
208+ longitude : endLng ,
209+ ) ,
208210 ),
209- ),
210- ],
211- displayOptions: NavigationDisplayOptions (showDestinationMarkers: false ),
212- );
213- final NavigationRouteStatus status =
214- await GoogleMapsNavigator .setDestinations (destinations);
215- expect (status, NavigationRouteStatus .statusOk);
216- await $.pumpAndSettle ();
211+ ],
212+ displayOptions: NavigationDisplayOptions (showDestinationMarkers: false ),
213+ );
214+ final NavigationRouteStatus status =
215+ await GoogleMapsNavigator .setDestinations (destinations);
216+ expect (status, NavigationRouteStatus .statusOk);
217+ await $.pumpAndSettle ();
217218
218- expect (await GoogleMapsNavigator .isGuidanceRunning (), false );
219+ expect (await GoogleMapsNavigator .isGuidanceRunning (), false );
219220
220- /// Start guidance.
221- await GoogleMapsNavigator .startGuidance ();
222- await $.pumpAndSettle ();
221+ /// Start guidance.
222+ await GoogleMapsNavigator .startGuidance ();
223+ await $.pumpAndSettle ();
223224
224- /// Test that the received coordinates fit between start and end location coordinates within tolerance.
225- void onLocationEvent (RoadSnappedLocationUpdatedEvent msg) {
226- /// Sometimes on Android, the simulator "overshoots" and passes the destination
227- /// with high speedMultiplier.
228- if (arrivalEventCount < 2 ) {
229- expectSync (
230- msg.location.latitude,
231- greaterThanOrEqualTo (startLat - tolerance),
232- );
233- expectSync (
234- msg.location.latitude,
235- lessThanOrEqualTo (endLat + tolerance),
236- );
237- expectSync (
238- msg.location.longitude,
239- greaterThanOrEqualTo (startLng - tolerance),
240- );
241- expectSync (
242- msg.location.longitude,
243- lessThanOrEqualTo (endLng + tolerance),
244- );
225+ /// Test that the received coordinates fit between start and end location coordinates within tolerance.
226+ void onLocationEvent (RoadSnappedLocationUpdatedEvent msg) {
227+ /// Sometimes on Android, the simulator "overshoots" and passes the destination
228+ /// with high speedMultiplier.
229+ if (arrivalEventCount < 2 ) {
230+ expectSync (
231+ msg.location.latitude,
232+ greaterThanOrEqualTo (startLat - tolerance),
233+ );
234+ expectSync (
235+ msg.location.latitude,
236+ lessThanOrEqualTo (endLat + tolerance),
237+ );
238+ expectSync (
239+ msg.location.longitude,
240+ greaterThanOrEqualTo (startLng - tolerance),
241+ );
242+ expectSync (
243+ msg.location.longitude,
244+ lessThanOrEqualTo (endLng + tolerance),
245+ );
246+ }
245247 }
246- }
247248
248- await GoogleMapsNavigator .setRoadSnappedLocationUpdatedListener (
249- onLocationEvent);
249+ await GoogleMapsNavigator .setRoadSnappedLocationUpdatedListener (
250+ onLocationEvent);
250251
251- /// Start simulation.
252- await GoogleMapsNavigator .simulator
253- .simulateLocationsAlongExistingRouteWithOptions (SimulationOptions (
254- speedMultiplier: 10 ,
255- ));
252+ /// Start simulation.
253+ await GoogleMapsNavigator .simulator
254+ .simulateLocationsAlongExistingRouteWithOptions (SimulationOptions (
255+ speedMultiplier: 10 ,
256+ ));
256257
257- expect (await GoogleMapsNavigator .isGuidanceRunning (), true );
258- await navigationFinished.future;
259- expect (await GoogleMapsNavigator .isGuidanceRunning (), false );
258+ expect (await GoogleMapsNavigator .isGuidanceRunning (), true );
259+ await navigationFinished.future;
260+ expect (await GoogleMapsNavigator .isGuidanceRunning (), false );
260261
261- await GoogleMapsNavigator .cleanup ();
262- });
262+ await GoogleMapsNavigator .cleanup ();
263+ },
264+ // TODO(jokerttu): Skipping Android as this fails on Android emulator on CI.
265+ skip: Platform .isAndroid,
266+ );
263267
264268 patrol ('Test simulation along new route' , (PatrolIntegrationTester $) async {
265269 int loopIteration = 1 ;
0 commit comments