Skip to content

Commit 7fa2f50

Browse files
authored
remove enum_to_string from deps (#575)
* remove enum_to_string from deps * fix getCameraState test
1 parent 79d6f33 commit 7fa2f50

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed

example/integration_test/camera_test.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import 'package:mapbox_maps_example/empty_map_widget.dart' as app;
88

99
void main() {
1010
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
11+
final initialCamera = CameraOptions(
12+
center: Point(coordinates: Position(0, 0)),
13+
zoom: 15,
14+
pitch: 60,
15+
bearing: 12,
16+
);
1117

1218
testWidgets('cameraForCoordinatesPadding', (WidgetTester tester) async {
1319
final mapFuture = app.main();
@@ -321,17 +327,17 @@ void main() {
321327
});
322328

323329
testWidgets('getCameraState', (WidgetTester tester) async {
324-
final mapFuture = app.main();
330+
final mapFuture = app.runMapWithCustomCamera(initialCamera);
325331
await tester.pumpAndSettle();
326332

327333
final mapboxMap = await mapFuture;
328334
var cameraState = await mapboxMap.getCameraState();
329-
expect(cameraState.zoom.floor(), 15);
330-
expect(cameraState.pitch.floor(), 60);
331-
expect(cameraState.bearing.floor(), 12);
335+
expect(cameraState.zoom, closeTo(15, 0.1));
336+
expect(cameraState.pitch, closeTo(60, 1));
337+
expect(cameraState.bearing, closeTo(12, 0.1));
332338
final position = cameraState.center;
333-
expect(position.coordinates.lng.floor(), -88);
334-
expect(position.coordinates.lat.floor(), 41);
339+
expect(position.coordinates.lng, 0);
340+
expect(position.coordinates.lat, 0);
335341
expect(cameraState.padding.top, 0);
336342
expect(cameraState.padding.right, 0);
337343
expect(cameraState.padding.bottom, 0);

example/lib/empty_map_widget.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,24 @@ Future<MapboxMap> runFixedSizeMap() {
9595
return completer.future;
9696
}
9797

98+
Future<MapboxMap> runMapWithCustomCamera(CameraOptions camera) {
99+
final completer = Completer<MapboxMap>();
100+
101+
const ACCESS_TOKEN = String.fromEnvironment('ACCESS_TOKEN');
102+
MapboxOptions.setAccessToken(ACCESS_TOKEN);
103+
104+
runApp(MaterialApp(
105+
home: MapWidget(
106+
key: ValueKey("mapWidget"),
107+
cameraOptions: camera,
108+
onMapCreated: (MapboxMap mapboxMap) {
109+
completer.complete(mapboxMap);
110+
}),
111+
));
112+
113+
return completer.future;
114+
}
115+
98116
void runEmpty() {
99117
const ACCESS_TOKEN = String.fromEnvironment('ACCESS_TOKEN');
100118
MapboxOptions.setAccessToken(ACCESS_TOKEN);

example/pubspec.lock

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ packages:
7373
url: "https://pub.dev"
7474
source: hosted
7575
version: "0.0.2+3"
76-
enum_to_string:
77-
dependency: transitive
78-
description:
79-
name: enum_to_string
80-
sha256: bd9e83a33b754cb43a75b36a9af2a0b92a757bfd9847d2621ca0b1bed45f8e7a
81-
url: "https://pub.dev"
82-
source: hosted
83-
version: "2.0.1"
8476
fake_async:
8577
dependency: transitive
8678
description:
@@ -192,7 +184,7 @@ packages:
192184
path: ".."
193185
relative: true
194186
source: path
195-
version: "2.0.0-rc.1"
187+
version: "2.0.0"
196188
matcher:
197189
dependency: transitive
198190
description:

pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ environment:
88
flutter: ">=3.10.0"
99

1010
dependencies:
11-
enum_to_string: ^2.0.1
1211
flutter:
1312
sdk: flutter
1413
flutter_plugin_android_lifecycle: ^2.0.5

0 commit comments

Comments
 (0)