| OLD | NEW |
| 1 library CssTest; | 1 library CssTest; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_individual_config.dart'; | 3 import '../../pkg/unittest/lib/html_individual_config.dart'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 | 5 |
| 6 main() { | 6 main() { |
| 7 useHtmlIndividualConfiguration(); | 7 useHtmlIndividualConfiguration(); |
| 8 | 8 |
| 9 group('supported_CssMatrix', () { | 9 group('supportsPointConversions', () { |
| 10 test('supported', () { | 10 test('supported', () { |
| 11 expect(CssMatrix.supported, true); | 11 expect(Window.supportsPointConversions, true); |
| 12 }); | |
| 13 }); | |
| 14 | |
| 15 group('supported_DomPoint', () { | |
| 16 test('supported', () { | |
| 17 expect(DomPoint.supported, true); | |
| 18 }); | 12 }); |
| 19 }); | 13 }); |
| 20 | 14 |
| 21 group('functional', () { | 15 group('functional', () { |
| 22 test('CssMatrix', () { | |
| 23 var expectation = CssMatrix.supported ? returnsNormally : throws; | |
| 24 expect(() { | |
| 25 CssMatrix matrix1 = new CssMatrix(); | |
| 26 expect(matrix1.m11.round(), equals(1)); | |
| 27 expect(matrix1.m12.round(), isZero); | |
| 28 | |
| 29 CssMatrix matrix2 = new CssMatrix('matrix(1, 0, 0, 1, -835, 0)'); | |
| 30 expect(matrix2.a.round(), equals(1)); | |
| 31 expect(matrix2.e.round(), equals(-835)); | |
| 32 }, expectation); | |
| 33 }); | |
| 34 test('DomPoint', () { | 16 test('DomPoint', () { |
| 35 var expectation = DomPoint.supported ? returnsNormally : throws; | 17 var expectation = Window.supportsPointConversions ? |
| 18 returnsNormally : throws; |
| 36 expect(() { | 19 expect(() { |
| 37 Element element = new Element.tag('div'); | 20 Element element = new Element.tag('div'); |
| 38 element.attributes['style'] = | 21 element.attributes['style'] = |
| 39 ''' | 22 ''' |
| 40 position: absolute; | 23 position: absolute; |
| 41 width: 60px; | 24 width: 60px; |
| 42 height: 100px; | 25 height: 100px; |
| 43 left: 0px; | 26 left: 0px; |
| 44 top: 0px; | 27 top: 0px; |
| 45 background-color: red; | 28 background-color: red; |
| 46 -webkit-transform: translate3d(250px, 100px, 0px); | 29 -webkit-transform: translate3d(250px, 100px, 0px); |
| 47 '''; | 30 '''; |
| 48 document.body.nodes.add(element); | 31 document.body.nodes.add(element); |
| 49 | 32 |
| 50 DomPoint point = new DomPoint(5, 2); | 33 Point point = new Point(5, 2); |
| 51 checkPoint(5, 2, point); | 34 checkPoint(5, 2, point); |
| 52 checkPoint(255, 102, window.convertPointFromNodeToPage(element, point)); | 35 checkPoint(255, 102, window.convertPointFromNodeToPage(element, point)); |
| 53 point.y = 100; | 36 point = new Point(5, 100); |
| 54 checkPoint(5, 100, point); | 37 checkPoint(5, 100, point); |
| 55 checkPoint(255, 200, window.convertPointFromNodeToPage(element, point)); | 38 checkPoint(255, 200, window.convertPointFromNodeToPage(element, point)); |
| 56 }, expectation); | 39 }, expectation); |
| 57 }); | 40 }); |
| 58 }); | 41 }); |
| 59 } | 42 } |
| 60 | 43 |
| 61 void checkPoint(expectedX, expectedY, DomPoint point) { | 44 void checkPoint(expectedX, expectedY, Point point) { |
| 62 expect(point.x.round(), equals(expectedX), reason: 'Wrong point.x'); | 45 expect(point.x.round(), equals(expectedX), reason: 'Wrong point.x'); |
| 63 expect(point.y.round(), equals(expectedY), reason: 'Wrong point.y'); | 46 expect(point.y.round(), equals(expectedY), reason: 'Wrong point.y'); |
| 64 } | 47 } |
| OLD | NEW |