@@ -807,6 +807,43 @@ void main() {
807
807
});
808
808
809
809
testWidgets ('testToggleInfoWindow' , (WidgetTester tester) async {
810
+ const Marker marker = Marker (
811
+ markerId: MarkerId ('marker' ),
812
+ infoWindow: InfoWindow (title: 'InfoWindow' ));
813
+ final Set <Marker > markers = < Marker > {marker};
814
+
815
+ final Completer <ExampleGoogleMapController > controllerCompleter =
816
+ Completer <ExampleGoogleMapController >();
817
+
818
+ await tester.pumpWidget (Directionality (
819
+ textDirection: TextDirection .ltr,
820
+ child: ExampleGoogleMap (
821
+ initialCameraPosition: const CameraPosition (target: LatLng (10.0 , 15.0 )),
822
+ markers: markers,
823
+ onMapCreated: (ExampleGoogleMapController googleMapController) {
824
+ controllerCompleter.complete (googleMapController);
825
+ },
826
+ ),
827
+ ));
828
+
829
+ final ExampleGoogleMapController controller =
830
+ await controllerCompleter.future;
831
+
832
+ bool iwVisibleStatus =
833
+ await controller.isMarkerInfoWindowShown (marker.markerId);
834
+ expect (iwVisibleStatus, false );
835
+
836
+ await controller.showMarkerInfoWindow (marker.markerId);
837
+ iwVisibleStatus = await controller.isMarkerInfoWindowShown (marker.markerId);
838
+ expect (iwVisibleStatus, true );
839
+
840
+ await controller.hideMarkerInfoWindow (marker.markerId);
841
+ iwVisibleStatus = await controller.isMarkerInfoWindowShown (marker.markerId);
842
+ expect (iwVisibleStatus, false );
843
+ });
844
+
845
+ testWidgets ('updating a marker does not hide its info window' ,
846
+ (WidgetTester tester) async {
810
847
final Key key = GlobalKey ();
811
848
const Marker marker = Marker (
812
849
markerId: MarkerId ('marker' ),
@@ -838,15 +875,13 @@ void main() {
838
875
final ExampleGoogleMapController controller =
839
876
await controllerCompleter.future;
840
877
878
+ await controller.showMarkerInfoWindow (marker.markerId);
841
879
bool iwVisibleStatus =
842
880
await controller.isMarkerInfoWindowShown (marker.markerId);
843
- expect (iwVisibleStatus, false );
844
-
845
- await controller.showMarkerInfoWindow (marker.markerId);
846
- iwVisibleStatus = await controller.isMarkerInfoWindowShown (marker.markerId);
847
881
expect (iwVisibleStatus, true );
848
882
849
- // Update marker and check if the info window is still visible.
883
+ // Update marker and ensure the info window remains visible when added to a
884
+ // cluster manager.
850
885
final Marker updatedMarker = marker.copyWith (
851
886
alphaParam: 0.5 ,
852
887
clusterManagerIdParam: clusterManager.clusterManagerId,
@@ -862,13 +897,8 @@ void main() {
862
897
markers: Set <Marker >.of (markers)),
863
898
));
864
899
865
- await controller.showMarkerInfoWindow (marker.markerId);
866
900
iwVisibleStatus = await controller.isMarkerInfoWindowShown (marker.markerId);
867
901
expect (iwVisibleStatus, true );
868
-
869
- await controller.hideMarkerInfoWindow (marker.markerId);
870
- iwVisibleStatus = await controller.isMarkerInfoWindowShown (marker.markerId);
871
- expect (iwVisibleStatus, false );
872
902
});
873
903
874
904
testWidgets ('testTakeSnapshot' , (WidgetTester tester) async {
0 commit comments