Unverified Commit eec3f060 authored by Polina Cherkasova's avatar Polina Cherkasova Committed by GitHub

TestClipPaintingContext should dispose ContainerLayer (#135949)

parent 7d016638
......@@ -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(
......@@ -397,6 +401,11 @@ class TestClipPaintingContext extends PaintingContext {
}
Clip clipBehavior = Clip.none;
@mustCallSuper
void dispose() {
_containerLayer.dispose();
}
}
class TestPushLayerPaintingContext extends PaintingContext {
......
......@@ -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(
......@@ -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(
......
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment