Skip to content

[Mock Canvas] paints...arc() is missing ability to test start and end arc angles. #162317

Closed

Description

@TahaTesser

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.

@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()

Activity

  1. justinmc commented on Jan 28, 2025

    @justinmc
    Contributor

    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.

  2. maheshj01 commented on Jan 29, 2025

    @maheshj01
    Member

    labelling this as a valid proposal

  3. added
    a: tests"flutter test", flutter_test, or one of our tests
    packageflutter/packages repository. See also p: labels.
    c: proposalA detailed proposal for a change to Flutter
    frameworkflutter/packages/flutter repository. See also f: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Jan 29, 2025
  4. removed
    packageflutter/packages repository. See also p: labels.
    on Jan 29, 2025
  5. added
    P2Important issues not at the top of the work list
    on Feb 4, 2025
  6. added
    r: fixedIssue is closed as already fixed in a newer version
    on Feb 18, 2025
  7. github-actions commented on Mar 4, 2025

    @github-actions

    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 -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testsc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions