Handle Widget instances being moved as-is to different parts of the tree.

This commit is contained in:
Hixie
2015-09-01 14:32:14 -07:00
parent 4d84e1b732
commit 6cac226fa6
4 changed files with 236 additions and 34 deletions

View File

@@ -43,4 +43,29 @@ void main() {
expect(container.renderObject.parentData.bottom, isNull);
expect(container.renderObject.parentData.left, isNull);
});
test('Can remove parent data', () {
WidgetTester tester = new WidgetTester();
Container container;
tester.pumpFrame(() {
container = new Container(width: 10.0, height: 10.0);
return new Stack([ new Positioned(left: 10.0, child: container) ]);
});
expect(container.renderObject.parentData.top, isNull);
expect(container.renderObject.parentData.right, isNull);
expect(container.renderObject.parentData.bottom, isNull);
expect(container.renderObject.parentData.left, equals(10.0));
tester.pumpFrame(() {
return new Stack([ container ]);
});
expect(container.renderObject.parentData.top, isNull);
expect(container.renderObject.parentData.right, isNull);
expect(container.renderObject.parentData.bottom, isNull);
expect(container.renderObject.parentData.left, isNull);
});
}