Dispose layers in test. (#134802)
This commit is contained in:
committed by
GitHub
parent
ec47148036
commit
f629dc8771
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user