Skip to content

Commit 517aace

Browse files
committed
fix(flutter): gate pre-tap diagnostic events
1 parent bb01903 commit 517aace

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

sdks/flutter/packages/tugboat/lib/src/controller.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,6 +3218,7 @@ class TugboatReplayController extends ChangeNotifier {
32183218
InteractionTransaction tx,
32193219
TugboatPreTapEvidence evidence,
32203220
) {
3221+
if (!config.emitCaptureDiagnostics) return;
32213222
_addEvent(
32223223
TugboatEvent(
32233224
id: _nextId('event'),

sdks/flutter/packages/tugboat/test/exploration_pre_tap_test.dart

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,37 @@ void main() {
608608
expect(eventTypes, isNot(contains('viewport_semantic_map')));
609609
});
610610

611+
testWidgets('inventory pre-tap work does not emit diagnostics by default', (
612+
tester,
613+
) async {
614+
final controller = await _mountController(
615+
tester,
616+
Scaffold(
617+
body: FilledButton(onPressed: () {}, child: const Text('Go')),
618+
),
619+
config: const TugboatReplayConfig(
620+
enabled: true,
621+
emitSceneInventory: true,
622+
settleDelay: Duration.zero,
623+
interactionClaimWindow: Duration.zero,
624+
enableGlobalPointerCapture: false,
625+
capturePixelRatio: 1,
626+
),
627+
);
628+
final point = tester.getCenter(find.text('Go'));
629+
final buildsBefore = controller.debugAnchorTokenMapBuildCount;
630+
631+
controller.recordPointerDown(point);
632+
633+
expect(controller.debugAnchorTokenMapBuildCount, greaterThan(buildsBefore));
634+
expect(
635+
controller.session!.events.where(
636+
(event) => event.type == 'exploration_pre_tap_diagnostic',
637+
),
638+
isEmpty,
639+
);
640+
});
641+
611642
testWidgets('disabled capture performs no pointer-down capture work', (
612643
tester,
613644
) async {

0 commit comments

Comments
 (0)