mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
test CkPath.reset() (#21567)
This commit is contained in:
parent
948dd97025
commit
33515242ed
@ -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();
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ void main() {
|
||||
}
|
||||
|
||||
void testMain() {
|
||||
group('Path Metrics', () {
|
||||
group('CkPath', () {
|
||||
setUpAll(() async {
|
||||
await ui.webOnlyInitializePlatform();
|
||||
});
|
||||
@ -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
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user