Repository navigation
[Mock Canvas] paints...arc() is missing ability to test start and end arc angles. #162317
Copy link
Copy link
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Use case
The paints..arc() is missing the ability to test start and end arc angles. You can test total arc rect but cannot test where the arc begins and ends. Testing arc drawn path is crucial. As a workaround, golden tests can be used to capture the arc start and end path visually.
flutter/packages/flutter_test/lib/src/mock_canvas.dart
Lines 968 to 987 in 9e273d5
| @override | |
| void arc({ | |
| Rect? rect, | |
| Color? color, | |
| double? strokeWidth, | |
| bool? hasMaskFilter, | |
| PaintingStyle? style, | |
| StrokeCap? strokeCap, | |
| }) { | |
| _predicates.add( | |
| _ArcPaintPredicate( | |
| rect: rect, | |
| color: color, | |
| strokeWidth: strokeWidth, | |
| hasMaskFilter: hasMaskFilter, | |
| style: style, | |
| strokeCap: strokeCap, | |
| ), | |
| ); | |
| } |
See the arc API for angles parameters :
https://api.flutter.dev/flutter/dart-ui/Canvas/drawArc.html
Proposal
Add ability to test arc start and end angles in paints..arc()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Activity
justinmc commentedon Jan 28, 2025
Any time we can trade image diff testing for regular unit testing it's a big win in terms of test performance and reducing time spent fixing irrelevant test failures, so I'm definitely on board with this 👍 . I'm not an expert on what it would take to make this change but hopefully someone else has context.
maheshj01 commentedon Jan 29, 2025
labelling this as a valid proposal
Add missing properties to _ArcPaintPredicate. (#162572)
github-actions commentedon Mar 4, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.