diff --git a/packages/convenient_test_dev/lib/src/utils/util.dart b/packages/convenient_test_dev/lib/src/utils/util.dart index 8d780ce4..779b9a8f 100644 --- a/packages/convenient_test_dev/lib/src/utils/util.dart +++ b/packages/convenient_test_dev/lib/src/utils/util.dart @@ -5,15 +5,33 @@ import 'package:test_api/src/backend/state.dart'; // ignore_for_file: implementa class DelegatingFinder implements Finder { final Finder target; + @Deprecated('Use FinderBase.describeMatch instead. ' + 'FinderBase.describeMatch allows for more readable descriptions and removes ambiguity about pluralization. ' + 'This feature was deprecated after v3.13.0-0.2.pre.') final String? overrideDescription; + final String Function(Plurality)? overrideDescribeMatch; - DelegatingFinder(this.target, {this.overrideDescription}); + DelegatingFinder( + this.target, { + @Deprecated('Use FinderBase.describeMatch instead. ' + 'FinderBase.describeMatch allows for more readable descriptions and removes ambiguity about pluralization. ' + 'This feature was deprecated after v3.13.0-0.2.pre.') + this.overrideDescription, + this.overrideDescribeMatch, + }); @override + @Deprecated('Use FinderBase.describeMatch instead. ' + 'FinderBase.describeMatch allows for more readable descriptions and removes ambiguity about pluralization. ' + 'This feature was deprecated after v3.13.0-0.2.pre.') String get description => overrideDescription ?? target.description; @override - Iterable apply(Iterable candidates) => target.apply(candidates); + @Deprecated('Override FinderBase.findInCandidates instead. ' + 'Using the FinderBase API allows for more consistent caching behavior and cleaner options for interacting with the widget tree. ' + 'This feature was deprecated after v3.13.0-0.2.pre.') + Iterable apply(Iterable candidates) => + target.apply(candidates); @override bool get skipOffstage => target.skipOffstage; @@ -22,9 +40,12 @@ class DelegatingFinder implements Finder { Iterable get allCandidates => target.allCandidates; @override - Iterable evaluate() => target.evaluate(); + FinderResult evaluate() => target.evaluate(); @override + @Deprecated('Use FinderBase.tryFind or FinderBase.runCached instead. ' + 'Using the FinderBase API allows for more consistent caching behavior and cleaner options for interacting with the widget tree. ' + 'This feature was deprecated after v3.13.0-0.2.pre.') bool precache() => target.precache(); @override @@ -37,10 +58,35 @@ class DelegatingFinder implements Finder { Finder at(int index) => target.at(index); @override - Finder hitTestable({Alignment at = Alignment.center}) => target.hitTestable(at: at); + Finder hitTestable({Alignment at = Alignment.center}) => + target.hitTestable(at: at); @override - String toString() => target.toString(); + String toString({bool describeSelf = false}) => + target.toString(describeSelf: describeSelf); + + @override + String describeMatch(Plurality plurality) => + overrideDescribeMatch?.call(plurality) ?? target.describeMatch(plurality); + + @override + Iterable findInCandidates(Iterable candidates) => + target.findInCandidates(candidates); + + @override + FinderResult get found => target.found; + + @override + bool get hasFound => target.hasFound; + + @override + void reset() => target.reset(); + + @override + void runCached(VoidCallback run) => target.runCached(run); + + @override + bool tryEvaluate() => target.tryEvaluate(); } extension ExtState on State {