blob: 1f87a8787a86293e84ecb8f227bd912a9042b15e [file] [log] [blame]
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/services.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
/// Inspect Google Maps state using the platform SDK.
///
/// This class is primarily used for testing. The methods on this
/// class should call "getters" on the GoogleMap object or equivalent
/// on the platform side.
class GoogleMapInspector {
GoogleMapInspector(this._channel);
final MethodChannel _channel;
Future<bool> isCompassEnabled() async {
return await _channel.invokeMethod<bool>('map#isCompassEnabled');
}
Future<bool> isMapToolbarEnabled() async {
return await _channel.invokeMethod<bool>('map#isMapToolbarEnabled');
}
Future<MinMaxZoomPreference> getMinMaxZoomLevels() async {
final List<double> zoomLevels =
(await _channel.invokeMethod<List<dynamic>>('map#getMinMaxZoomLevels'))
.cast<double>();
return MinMaxZoomPreference(zoomLevels[0], zoomLevels[1]);
}
Future<double> getZoomLevel() async {
final double zoomLevel =
await _channel.invokeMethod<double>('map#getZoomLevel');
return zoomLevel;
}
Future<bool> isZoomGesturesEnabled() async {
return await _channel.invokeMethod<bool>('map#isZoomGesturesEnabled');
}
Future<bool> isRotateGesturesEnabled() async {
return await _channel.invokeMethod<bool>('map#isRotateGesturesEnabled');
}
Future<bool> isTiltGesturesEnabled() async {
return await _channel.invokeMethod<bool>('map#isTiltGesturesEnabled');
}
Future<bool> isScrollGesturesEnabled() async {
return await _channel.invokeMethod<bool>('map#isScrollGesturesEnabled');
}
Future<bool> isMyLocationButtonEnabled() async {
return await _channel.invokeMethod<bool>('map#isMyLocationButtonEnabled');
}
Future<bool> isTrafficEnabled() async {
return await _channel.invokeMethod<bool>('map#isTrafficEnabled');
}
Future<bool> isBuildingsEnabled() async {
return await _channel.invokeMethod<bool>('map#isBuildingsEnabled');
}
}