mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
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:
parent
783ef15a58
commit
f5d736743c
@ -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));
|
||||
});
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user