OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 import '../resources/third_party/unittest/unittest.dart'; | 5 import '../resources/third_party/unittest/unittest.dart'; |
6 import '../resources/unit.dart'; | 6 import '../resources/unit.dart'; |
7 import '../resources/display_list.dart'; | 7 import '../resources/display_list.dart'; |
8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
9 import 'package:sky/framework/app.dart'; | 9 import 'package:sky/framework/app.dart'; |
10 import 'package:sky/framework/rendering/block.dart'; | 10 import 'package:sky/framework/rendering/block.dart'; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 var renderBlock = new RenderBlock(); | 65 var renderBlock = new RenderBlock(); |
66 | 66 |
67 renderBlock.add(new RenderSolidColor(0xFF00FF00, desiredSize: new sky.Size(1 00.0, 50.0))); | 67 renderBlock.add(new RenderSolidColor(0xFF00FF00, desiredSize: new sky.Size(1 00.0, 50.0))); |
68 renderBlock.add(new RenderSolidColor(0x7700FFFF, desiredSize: new sky.Size(5 0.0, 100.0))); | 68 renderBlock.add(new RenderSolidColor(0x7700FFFF, desiredSize: new sky.Size(5 0.0, 100.0))); |
69 | 69 |
70 var renderDecoratedBlock = new RenderDecoratedBox( | 70 var renderDecoratedBlock = new RenderDecoratedBox( |
71 decoration: new BoxDecoration(backgroundColor: 0xFFFFFFFF), | 71 decoration: new BoxDecoration(backgroundColor: 0xFFFFFFFF), |
72 child: renderBlock | 72 child: renderBlock |
73 ); | 73 ); |
74 | 74 |
75 flexRoot.add(new RenderPadding(const EdgeDims(10.0, 10.0, 10.0, 10.0), rende rDecoratedBlock)); | 75 flexRoot.add(new RenderPadding(padding: const EdgeDims(10.0, 10.0, 10.0, 10. 0), |
Hixie
2015/06/02 21:52:21
This can be const EdgeDims.all(10.0) now.
abarth-chromium
2015/06/02 22:32:21
Done.
| |
76 child: renderDecoratedBlock)); | |
76 | 77 |
77 var row = new RenderFlex(direction: FlexDirection.Horizontal); | 78 var row = new RenderFlex(direction: FlexDirection.Horizontal); |
78 | 79 |
79 // Purple and blue cells | 80 // Purple and blue cells |
80 addFlexChildSolidColor(row, 0x77FF00FF, flex: 1); | 81 addFlexChildSolidColor(row, 0x77FF00FF, flex: 1); |
81 addFlexChildSolidColor(row, 0xFF0000FF, flex: 2); | 82 addFlexChildSolidColor(row, 0xFF0000FF, flex: 2); |
82 | 83 |
83 var decoratedRow = new RenderDecoratedBox( | 84 var decoratedRow = new RenderDecoratedBox( |
84 decoration: new BoxDecoration(backgroundColor: 0xFF333333), | 85 decoration: new BoxDecoration(backgroundColor: 0xFF333333), |
85 child: row | 86 child: row |
86 ); | 87 ); |
87 | 88 |
88 flexRoot.add(decoratedRow); | 89 flexRoot.add(decoratedRow); |
89 decoratedRow.parentData.flex = 3; | 90 decoratedRow.parentData.flex = 3; |
90 app = new TestApp(root); | 91 app = new TestApp(root); |
91 | 92 |
92 expect(root.size.width, equals(sky.view.width)); | 93 expect(root.size.width, equals(sky.view.width)); |
93 expect(root.size.height, equals(sky.view.height)); | 94 expect(root.size.height, equals(sky.view.height)); |
94 expect(renderBlock.size.width, equals(sky.view.width - 20.0)); | 95 expect(renderBlock.size.width, equals(sky.view.width - 20.0)); |
95 | 96 |
96 }); | 97 }); |
97 } | 98 } |
OLD | NEW |