| OLD | NEW |
| 1 <parent style='background-color: lightblue;'> | 1 <parent style='background-color: lightblue;'> |
| 2 <child style='background-color: pink;'> | 2 <child style='background-color: pink;'> |
| 3 <grandchild style='background-color: red; width: 25px; height: 25px;'></gran
dchild> | 3 <grandchild style='background-color: red; width: 25px; height: 25px;'></gran
dchild> |
| 4 </child> | 4 </child> |
| 5 <child2 style='background-color: salmon; height: 25px;' /> | 5 <child2 style='background-color: salmon; height: 25px;' /> |
| 6 </parent> | 6 </parent> |
| 7 | 7 |
| 8 <script> | 8 <script> |
| 9 import "../resources/third_party/unittest/unittest.dart"; | 9 import "../resources/third_party/unittest/unittest.dart"; |
| 10 import "../resources/unit.dart"; | 10 import "../resources/unit.dart"; |
| 11 | 11 |
| 12 import 'dart:async'; | 12 import 'dart:async'; |
| 13 import 'dart:sky'; | 13 import 'dart:sky'; |
| 14 | 14 |
| 15 void main() { | 15 void main() { |
| 16 initUnit(); | 16 initUnit(); |
| 17 | 17 |
| 18 var first = true; | 18 var first = true; |
| 19 | 19 |
| 20 var parent = document.querySelector('parent'); | 20 var parent = document.querySelector('parent'); |
| 21 var firstChild = parent.firstElementChild; | 21 var firstChild = parent.firstElementChild; |
| 22 var secondChild = parent.lastElementChild; | 22 var secondChild = parent.lastElementChild; |
| 23 | 23 |
| 24 parent.setLayoutManager(() { | 24 parent.setLayoutManager(() { |
| 25 if (first) { | 25 if (first) { |
| 26 first = false; | |
| 27 parent.width = 200.0; | 26 parent.width = 200.0; |
| 28 } else { | 27 } else { |
| 29 parent.width = 150.0; | 28 parent.width = 150.0; |
| 30 } | 29 } |
| 31 | 30 |
| 32 firstChild.width = 100.0; | 31 firstChild.width = 100.0; |
| 33 firstChild.layout(); | 32 firstChild.layout(); |
| 34 firstChild.x = 100.0; | 33 firstChild.x = 100.0; |
| 35 firstChild.y = 50.0; | 34 firstChild.y = 50.0; |
| 36 firstChild.height = 50.0; | 35 firstChild.height = 50.0; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 test("should have the right sizes after layout", () { | 63 test("should have the right sizes after layout", () { |
| 65 Completer completer = new Completer(); | 64 Completer completer = new Completer(); |
| 66 | 65 |
| 67 window.requestAnimationFrame((_) { | 66 window.requestAnimationFrame((_) { |
| 68 expect(parent.offsetWidth, equals(200)); | 67 expect(parent.offsetWidth, equals(200)); |
| 69 expect(secondChild.offsetWidth, equals(200)); | 68 expect(secondChild.offsetWidth, equals(200)); |
| 70 assertNonChangingValues(); | 69 assertNonChangingValues(); |
| 71 | 70 |
| 71 first = false; |
| 72 parent.setNeedsLayout(); | 72 parent.setNeedsLayout(); |
| 73 | 73 |
| 74 window.requestAnimationFrame((_) { | 74 window.requestAnimationFrame((_) { |
| 75 expect(parent.offsetWidth, equals(150)); | 75 expect(parent.offsetWidth, equals(150)); |
| 76 expect(secondChild.offsetWidth, equals(150)); | 76 expect(secondChild.offsetWidth, equals(150)); |
| 77 assertNonChangingValues(); | 77 assertNonChangingValues(); |
| 78 completer.complete(); | 78 completer.complete(); |
| 79 }); | 79 }); |
| 80 }); | 80 }); |
| 81 | 81 |
| 82 return completer.future; | 82 return completer.future; |
| 83 }); | 83 }); |
| 84 } | 84 } |
| 85 </script> | 85 </script> |
| OLD | NEW |