Commit d7bc93b7 authored by Hixie's avatar Hixie

SizeObserver crusade: The Last Test

parent b18047bf
...@@ -10,7 +10,6 @@ import 'package:test/test.dart'; ...@@ -10,7 +10,6 @@ import 'package:test/test.dart';
void main() { void main() {
test('FractionallySizedBox', () { test('FractionallySizedBox', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
Size detectedSize;
GlobalKey inner = new GlobalKey(); GlobalKey inner = new GlobalKey();
tester.pumpWidget(new OverflowBox( tester.pumpWidget(new OverflowBox(
minWidth: 0.0, minWidth: 0.0,
...@@ -22,19 +21,14 @@ void main() { ...@@ -22,19 +21,14 @@ void main() {
child: new FractionallySizedBox( child: new FractionallySizedBox(
width: 0.5, width: 0.5,
height: 0.25, height: 0.25,
child: new SizeObserver(
onSizeChanged: (Size size) {
detectedSize = size;
},
child: new Container( child: new Container(
key: inner key: inner
) )
) )
) )
)
)); ));
expect(detectedSize, equals(const Size(50.0, 25.0)));
RenderBox box = inner.currentContext.findRenderObject(); RenderBox box = inner.currentContext.findRenderObject();
expect(box.size, equals(const Size(50.0, 25.0)));
expect(box.localToGlobal(Point.origin), equals(const Point(25.0, 37.5))); expect(box.localToGlobal(Point.origin), equals(const Point(25.0, 37.5)));
}); });
}); });
......
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