Skip to content

Commit

Permalink
[skwasm] Fix implementation of SkwasmPath.relativeLineTo (#57201)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored Dec 13, 2024
1 parent 0c8e1de commit c4e3cc2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/web_ui/lib/src/engine/skwasm/skwasm_impl/path.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SkwasmPath extends SkwasmObjectWrapper<RawPath> implements ScenePath {
void lineTo(double x, double y) => pathLineTo(handle, x, y);

@override
void relativeLineTo(double x, double y) => pathRelativeMoveTo(handle, x, y);
void relativeLineTo(double x, double y) => pathRelativeLineTo(handle, x, y);

@override
void quadraticBezierTo(double x1, double y1, double x2, double y2) =>
Expand Down
9 changes: 9 additions & 0 deletions lib/web_ui/test/ui/path_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,13 @@ Future<void> testMain() async {
expect(newFirstMetric.extractPath(4.0, 10.0).computeMetrics().first.length, 6.0);
// TODO(hterkelsen): isClosed always returns false in the HTML renderer, https://github.com/flutter/flutter/issues/114446
}, skip: isHtml);

test('path relativeLineTo', () {
final p = Path();
p.moveTo(100, 100);
p.relativeLineTo(-50, -50);
p.relativeLineTo(100, 0);
p.relativeLineTo(-50, 50);
expect(p.getBounds(), equals(const Rect.fromLTRB(50.0, 50.0, 150.0, 100.0)));
});
}

0 comments on commit c4e3cc2

Please sign in to comment.