Open
Description
Steps to reproduce
- Create integration test in google_maps_flutter_android/example
- Add onTap callback on the ExampleGoogleMap
- Use the WidgetTester instance to call tap i.e. tester.tap(find.byKey(myGoogleMapKey))
- See that this tap was not recognized
Expected results
I expect that when I use .tap from WidgetTester on my GoogleMap widget that the onTap callback is called.
Actual results
What I see is that the onLongPress callback is called.
Code sample
Code sample
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:google_maps_flutter_example/example_google_map.dart';
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
void main() {
testWidgets('onTap', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<int> mapIdCompleter = Completer<int>();
bool hasTapped = false;
await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: ExampleGoogleMap(
key: key,
onTap: (LatLng position) {
print('Tapped at: $position');
hasTapped = true;
},
onLongPress: (LatLng position) => print('Long pressed at: $position'),
initialCameraPosition: const CameraPosition(
target: LatLng(0, 0),
zoom: 5,
),
onMapCreated: (ExampleGoogleMapController controller) {
mapIdCompleter.complete(controller.mapId);
},
),
));
final int mapsId = await mapIdCompleter.future;
await tester.tap(find.byKey(key));
expect(mapsId, 0);
expect(hasTapped, isTrue, reason: 'onTap callback should be called when the map is tapped.');
});
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.0, on Linux Mint 22.1 6.8.0-51-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] VS Code (version 1.99.3)
[✓] Connected device (3 available)
[✓] Network resources
! Doctor found issues in 1 category.
This was tested with a Galaxy Tab Active5
Metadata
Metadata
Assignees
Labels
Important issues not at the top of the work listEmbedding Android/iOS views in Flutter apps"flutter test", flutter_test, or one of our testsFound to occur in 3.32Found to occur in 3.33flutter/packages/flutter repository. See also f: labels.The issue has been confirmed reproducible and is ready to work onGoogle Maps pluginflutter/packages repository. See also p: labels.Android applications specificallyOwned by Android platform teamTriaged by Android platform team