Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
11 changes: 10 additions & 1 deletion packages/flutter/test/rendering/rendering_tester.dart
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ class FakeTicker implements Ticker {
}

class TestClipPaintingContext extends PaintingContext {
TestClipPaintingContext() : super(ContainerLayer(), Rect.zero);
TestClipPaintingContext() : this._(ContainerLayer());

TestClipPaintingContext._(this._containerLayer) : super(_containerLayer, Rect.zero);

final ContainerLayer _containerLayer;

@override
ClipRectLayer? pushClipRect(
Expand All @@ -397,6 +401,11 @@ class TestClipPaintingContext extends PaintingContext {
}

Clip clipBehavior = Clip.none;

@mustCallSuper
void dispose() {
_containerLayer.dispose();
}
}

class TestPushLayerPaintingContext extends PaintingContext {
Expand Down
20 changes: 4 additions & 16 deletions packages/flutter/test/widgets/grid_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -664,16 +664,8 @@ void main() {
final TestClipPaintingContext context = TestClipPaintingContext();
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.none));
},
leakTrackingTestConfig: const LeakTrackingTestConfig(
// TODO(ksokolovskyi): remove after fixing
notDisposedAllowList: <String, int?> {
// https://github.com/flutter/flutter/issues/134575
'OffsetLayer': 1,
// https://github.com/flutter/flutter/issues/134572
'ContainerLayer': 1,
},
));
context.dispose();
});

testWidgetsWithLeakTracking('GridView respects clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(
Expand Down Expand Up @@ -739,12 +731,8 @@ void main() {
// 4th, check that a non-default clip behavior can be sent to the painting context.
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.antiAlias));
},
leakTrackingTestConfig: const LeakTrackingTestConfig(
// TODO(ksokolovskyi): remove after fixing
// https://github.com/flutter/flutter/issues/134572
notDisposedAllowList: <String, int?> {'ContainerLayer': 1},
));
context.dispose();
});

testWidgetsWithLeakTracking('GridView.builder respects clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(
Expand Down
8 changes: 2 additions & 6 deletions packages/flutter/test/widgets/list_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -730,12 +730,8 @@ void main() {
// 4th, check that a non-default clip behavior can be sent to the painting context.
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.antiAlias));
},
leakTrackingTestConfig: const LeakTrackingTestConfig(
// TODO(ksokolovskyi): remove after fixing
// https://github.com/flutter/flutter/issues/134572
notDisposedAllowList: <String, int?> {'ContainerLayer': 1},
));
context.dispose();
});

testWidgetsWithLeakTracking('ListView.builder respects clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(
Expand Down