Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/web_ui/lib/src/engine/canvaskit/path.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ class CkPath implements ui.Path {

@override
void reset() {
// Only reset the local field. Skia will reset its internal state via
// SkPath.reset() below.
_fillType = ui.PathFillType.nonZero;
_skPath.reset();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() {
}

void testMain() {
group('Path Metrics', () {
group('CkPath', () {
setUpAll(() async {
await ui.webOnlyInitializePlatform();
});
Expand Down Expand Up @@ -72,5 +72,20 @@ void testMain() {
expect(() => iter1.current, throwsRangeError);
expect(() => iter2.current, throwsRangeError);
});

test('CkPath.reset', () {
final ui.Path path = ui.Path();
expect(path, isA<CkPath>());
path.addRect(const ui.Rect.fromLTRB(0, 0, 10, 10));
expect(path.contains(const ui.Offset(5, 5)), isTrue);

expect(path.fillType, ui.PathFillType.nonZero);
path.fillType = ui.PathFillType.evenOdd;
expect(path.fillType, ui.PathFillType.evenOdd);

path.reset();
expect(path.fillType, ui.PathFillType.nonZero);
expect(path.contains(const ui.Offset(5, 5)), isFalse);
});
}, skip: isIosSafari); // TODO: https://github.com/flutter/flutter/issues/60040
}