Skip to content

Commit

Permalink
Update smoke_test.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha committed Sep 15, 2024
1 parent 3476994 commit cbd689c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions example/integration_test/smoke_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:maplibre/maplibre.dart';
Expand All @@ -11,15 +10,15 @@ void main() {
group('controller', () {
testWidgets(
'render map',
(tester) async {
(tester) async {
await tester.pumpWidget(const App());
await tester.pumpAndSettle();
expect(tester.allWidgets.any((w) => w is MapLibreMap), isTrue);
},
);
testWidgets(
'getCamera',
(tester) async {
(tester) async {
late final MapController ctrl;
final app = App(
onMapCreated: (controller) => ctrl = controller,
Expand All @@ -39,7 +38,7 @@ void main() {
);
testWidgets(
'jumpTo',
(tester) async {
(tester) async {
late final MapController ctrl;
final app = App(onMapCreated: (controller) => ctrl = controller);
await tester.pumpWidget(app);
Expand All @@ -56,7 +55,7 @@ void main() {
);
testWidgets(
'flyTo',
(tester) async {
(tester) async {
late final MapController ctrl;
final app = App(onMapCreated: (controller) => ctrl = controller);
await tester.pumpWidget(app);
Expand Down Expand Up @@ -102,27 +101,27 @@ void main() {
);*/
testWidgets(
'getMetersPerPixelAtLatitude',
(tester) async {
(tester) async {
late final MapController ctrl;
final app = App(onMapCreated: (controller) => ctrl = controller);
await tester.pumpWidget(app);
await tester.pumpAndSettle();
await expectLater(
ctrl.getMetersPerPixelAtLatitude(23),
closeTo(12345, 0.00001), // TODO adjust value
);
final meters = await ctrl.getMetersPerPixelAtLatitude(23);
// TODO adjust value
expect(meters, closeTo(12345, 0.00001));
},
);
testWidgets(
'getVisibleRegion',
(tester) async {
(tester) async {
late final MapController ctrl;
final app = App(onMapCreated: (controller) => ctrl = controller);
await tester.pumpWidget(app);
await tester.pumpAndSettle();
final region = await ctrl.getVisibleRegion();
// TODO adjust values
expect(region.latitudeNorth, closeTo(12345, 0.00001));
expect(region.latitudeNorth, closeTo(85.05112862791722, 0.00001));
print(region);
expect(region.latitudeSouth, closeTo(12345, 0.00001));
expect(region.longitudeEast, closeTo(12345, 0.00001));
expect(region.longitudeWest, closeTo(12345, 0.00001));
Expand Down

0 comments on commit cbd689c

Please sign in to comment.