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

Dispose layers in test. (#134802)

parent ec471480
......@@ -1078,7 +1078,7 @@ void main() {
});
});
testWidgets('InkFeature skips painting if intermediate node skips', (WidgetTester tester) async {
testWidgetsWithLeakTracking('InkFeature skips painting if intermediate node skips', (WidgetTester tester) async {
final GlobalKey sizedBoxKey = GlobalKey();
final GlobalKey materialKey = GlobalKey();
await tester.pumpWidget(Material(
......@@ -1096,8 +1096,11 @@ void main() {
controller.addInkFeature(tracker);
expect(tracker.paintCount, 0);
final ContainerLayer layer1 = ContainerLayer();
addTearDown(layer1.dispose);
// Force a repaint. Since it's offstage, the ink feature should not get painted.
materialKey.currentContext!.findRenderObject()!.paint(PaintingContext(ContainerLayer(), Rect.largest), Offset.zero);
materialKey.currentContext!.findRenderObject()!.paint(PaintingContext(layer1, Rect.largest), Offset.zero);
expect(tracker.paintCount, 0);
await tester.pumpWidget(Material(
......@@ -1111,8 +1114,11 @@ void main() {
// now onstage.
expect(tracker.paintCount, 1);
final ContainerLayer layer2 = ContainerLayer();
addTearDown(layer2.dispose);
// Force a repaint again. This time, it gets repainted because it is onstage.
materialKey.currentContext!.findRenderObject()!.paint(PaintingContext(ContainerLayer(), Rect.largest), Offset.zero);
materialKey.currentContext!.findRenderObject()!.paint(PaintingContext(layer2, Rect.largest), Offset.zero);
expect(tracker.paintCount, 2);
});
......
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