Fix the Sky tests

Instead of triggering layout synchronously during AppView construction, we now
schedule the initial layout using a magic bootstrapping function.

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1172123003.
This commit is contained in:
Adam Barth 2015-06-09 14:07:17 -07:00
parent 783ef15a58
commit f5d736743c
2 changed files with 10 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import '../resources/third_party/unittest/unittest.dart';
import '../resources/unit.dart';
import '../resources/display_list.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/object.dart';
void main() {
initUnit();
@ -22,7 +23,10 @@ void main() {
child: paddingBox
);
TestView renderView = new TestView(child: root);
renderView.layout(new ViewConstraints(width: sky.view.width, height: sky.view.height));
renderView.attach();
renderView.rootConstraints = new ViewConstraints(width: sky.view.width, height: sky.view.height);
renderView.scheduleInitialLayout();
RenderObject.flushLayout();
expect(coloredBox.size.width, equals(sky.view.width - 20));
expect(coloredBox.size.height, equals(sky.view.height - 20));
});

View File

@ -7,6 +7,7 @@ import '../resources/unit.dart';
import '../resources/display_list.dart';
import 'dart:sky' as sky;
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/object.dart';
void main() {
initUnit();
@ -18,7 +19,10 @@ void main() {
)
);
TestView renderView = new TestView(child: root);
renderView.layout(new ViewConstraints(width: sky.view.width, height: sky.view.height));
renderView.attach();
renderView.rootConstraints = new ViewConstraints(width: sky.view.width, height: sky.view.height);
renderView.scheduleInitialLayout();
RenderObject.flushLayout();
expect(root.size.width, equals(sky.view.width));
expect(root.size.height, equals(sky.view.height));
renderView.paintFrame();