Don't crash if no widthFactor is set in an unbounded context

This commit is contained in:
Adam Barth
2015-11-06 13:16:45 -08:00
parent 5cf258c49e
commit e4a14e5675
2 changed files with 27 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:test/test.dart';
@@ -21,4 +22,26 @@ void main() {
);
});
});
test('Shrink wraps in finite space', () {
testWidgets((WidgetTester tester) {
GlobalKey alignKey = new GlobalKey();
tester.pumpWidget(
new ScrollableViewport(
child: new Align(
key: alignKey,
child: new Container(
width: 10.0,
height: 10.0
),
alignment: const FractionalOffset(0.50, 0.50)
)
)
);
RenderBox box = alignKey.currentContext.findRenderObject();
expect(box.size.width, equals(800.0));
expect(box.size.height, equals(10.0));
});
});
}