OLD | NEW |
| (Empty) |
1 #import('../../../../../dart/client/testing/unittest/unittest.dart'); | |
2 #import('dart:dom'); | |
3 | |
4 main() { | |
5 forLayoutTests(); | |
6 test('WebKitCSSMatrix', () { | |
7 WebKitCSSMatrix matrix1 = new WebKitCSSMatrix(); | |
8 Expect.equals(1, matrix1.m11.round()); | |
9 Expect.equals(0, matrix1.m12.round()); | |
10 | |
11 WebKitCSSMatrix matrix2 = new WebKitCSSMatrix('matrix(1, 0, 0, 1, -835, 0)')
; | |
12 Expect.equals(1, matrix2.a.round()); | |
13 Expect.equals(-835, matrix2.e.round()); | |
14 }); | |
15 test('WebKitPoint', () { | |
16 HTMLElement element = document.createElement('div'); | |
17 element.setAttribute('style', | |
18 ''' | |
19 position: absolute; | |
20 width: 60px; | |
21 height: 100px; | |
22 left: 0px; | |
23 top: 0px; | |
24 background-color: red; | |
25 -webkit-transform: translate3d(250px, 100px, 0px) perspective(500px) rotat
eX(30deg); | |
26 '''); | |
27 document.body.appendChild(element); | |
28 | |
29 WebKitPoint point = new WebKitPoint(5, 2); | |
30 checkPoint(5, 2, point); | |
31 checkPoint(256, 110, window.webkitConvertPointFromNodeToPage(element, point)
); | |
32 point.y = 100; | |
33 checkPoint(5, 100, point); | |
34 checkPoint(254, 196, window.webkitConvertPointFromNodeToPage(element, point)
); | |
35 }); | |
36 } | |
37 | |
38 void checkPoint(expectedX, expectedY, WebKitPoint point) { | |
39 Expect.equals(expectedX, point.x.round(), 'Wrong point.x'); | |
40 Expect.equals(expectedY, point.y.round(), 'Wrong point.y'); | |
41 } | |
OLD | NEW |