mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
TestClipPaintingContext should dispose ContainerLayer (#135949)
This commit is contained in:
parent
7d01663885
commit
eec3f06090
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user