File tree 1 file changed +31
-0
lines changed
packages/google_maps_flutter/google_maps_flutter/test
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -579,4 +579,35 @@ void main() {
579
579
580
580
expect (map.mapConfiguration.style, '' );
581
581
});
582
+
583
+ testWidgets ('Update state from widget only when mounted' ,
584
+ (WidgetTester tester) async {
585
+ await tester.pumpWidget (
586
+ const Directionality (
587
+ textDirection: TextDirection .ltr,
588
+ child: GoogleMap (
589
+ initialCameraPosition: CameraPosition (target: LatLng (10.0 , 15.0 )),
590
+ ),
591
+ ),
592
+ );
593
+
594
+ final State <StatefulWidget > googleMapState =
595
+ tester.state (find.byType (GoogleMap ));
596
+
597
+ await tester.pumpWidget (Container ());
598
+
599
+ // ignore:invalid_use_of_protected_member
600
+ googleMapState.didUpdateWidget (
601
+ GoogleMap (
602
+ initialCameraPosition: const CameraPosition (target: LatLng (10.0 , 15.0 )),
603
+ circles: < Circle > {const Circle (circleId: CircleId ('circle' ))},
604
+ ),
605
+ );
606
+
607
+ await tester.pumpAndSettle ();
608
+
609
+ final PlatformMapStateRecorder map = platform.lastCreatedMap;
610
+
611
+ expect (map.circleUpdates.length, 1 );
612
+ });
582
613
}
You can’t perform that action at this time.
0 commit comments