OLD | NEW |
(Empty) | |
| 1 <style> |
| 2 .container { |
| 3 height: 100px; |
| 4 width: 200px; |
| 5 margin: 30px; |
| 6 outline: 1px solid black; |
| 7 } |
| 8 .box { |
| 9 height: 100%; |
| 10 width: 100%; |
| 11 padding: 5px; |
| 12 margin: 5px; |
| 13 border: 5px solid gray; |
| 14 background-color: green; |
| 15 transform-origin: 20% 50%; |
| 16 } |
| 17 </style> |
| 18 |
| 19 <div class="container"> |
| 20 <div id="test-box" class="box"></div> |
| 21 </div> |
| 22 |
| 23 <script type="text/javascript" charset="utf-8"> |
| 24 import "../resources/third_party/unittest/unittest.dart"; |
| 25 import "../resources/unit.dart"; |
| 26 |
| 27 import "dart:sky"; |
| 28 |
| 29 void main() { |
| 30 initUnit(); |
| 31 |
| 32 var testBox = document.getElementById('test-box'); |
| 33 |
| 34 void testTransformRoundTrip(transform, resultMatrix) { |
| 35 testBox.style['transform'] = transform; |
| 36 var computedTransform = window.getComputedStyle(testBox)['transform']; |
| 37 expect(computedTransform, equals(resultMatrix)); |
| 38 } |
| 39 |
| 40 test('pixel translate should roundtrip', () { |
| 41 testTransformRoundTrip('translate(80px, 90px)', 'matrix(1, 0, 0, 1, 80, 90
)'); |
| 42 }); |
| 43 |
| 44 test('percent translate should roundtrip', () { |
| 45 testTransformRoundTrip('translate(10px, 50%)', 'matrix(1, 0, 0, 1, 10, 60)
'); |
| 46 }); |
| 47 |
| 48 test('scale should roundtrip', () { |
| 49 testTransformRoundTrip('scale(1.2, 0.8)', 'matrix(1.2, 0, 0, 0.8, 0, 0)'); |
| 50 }); |
| 51 } |
| 52 </script> |
OLD | NEW |