Skip to content

Pointer counter should not be shared between tests #187909

Description

@ValentinVignal

Coming from #186898

WidgetController from packages/flutter_test/lib/src/controller.dart is using a static variable _nextPointer as a counter

/// The next available pointer identifier.
///
/// This is the default pointer identifier that will be used the next time the
/// [startGesture] method is called without an explicit pointer identifier.
int get nextPointer => _nextPointer;
static int _nextPointer = 1;
static int _getNextPointer() {
final int result = _nextPointer;
_nextPointer += 1;
return result;
}

to set the pointer ID of a new gesture.

This design introduces hidden dependencies between tests. When running a file with multiple tests under random seeds, the test order changes based on the seed, which in turn alters the gesture IDs. As a result, gestures may receive different IDs across runs, leading to conflicts and inconsistent behavior in certain scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework teamwaiting for PR to land (fixed)A fix is in flight

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions