Merge pull request #2248 from Hixie/size-obs-10
SizeObserver crusade: The Last Test
This commit is contained in:
commit
15e9b95d19
@ -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() {
|
|||||||
child: new FractionallySizedBox(
|
child: new FractionallySizedBox(
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
height: 0.25,
|
height: 0.25,
|
||||||
child: new SizeObserver(
|
child: new Container(
|
||||||
onSizeChanged: (Size size) {
|
key: inner
|
||||||
detectedSize = size;
|
|
||||||
},
|
|
||||||
child: new Container(
|
|
||||||
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)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user