Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: tests/html/css_test.dart

Issue 12049097: Adding supported checks for CssMatrix and Point. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 useHtmlConfiguration(); 7 useHtmlIndividualConfiguration();
8 test('CssMatrix', () {
9 CssMatrix matrix1 = new CssMatrix();
10 expect(matrix1.m11.round(), equals(1));
11 expect(matrix1.m12.round(), isZero);
12 8
13 CssMatrix matrix2 = new CssMatrix('matrix(1, 0, 0, 1, -835, 0)'); 9 group('supported_CssMatrix', () {
14 expect(matrix2.a.round(), equals(1)); 10 test('supported', () {
15 expect(matrix2.e.round(), equals(-835)); 11 expect(CssMatrix.supported, true);
12 });
16 }); 13 });
17 test('Point', () {
18 Element element = new Element.tag('div');
19 element.attributes['style'] =
20 '''
21 position: absolute;
22 width: 60px;
23 height: 100px;
24 left: 0px;
25 top: 0px;
26 background-color: red;
27 -webkit-transform: translate3d(250px, 100px, 0px) perspective(500px) rotat eX(30deg);
28 ''';
29 document.body.nodes.add(element);
30 14
31 Point point = new Point(5, 2); 15 group('supported_DomPoint', () {
32 checkPoint(5, 2, point); 16 test('supported', () {
33 checkPoint(256, 110, window.webkitConvertPointFromNodeToPage(element, point) ); 17 expect(DomPoint.supported, true);
34 point.y = 100; 18 });
35 checkPoint(5, 100, point); 19 });
36 checkPoint(254, 196, window.webkitConvertPointFromNodeToPage(element, point) ); 20
21 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', () {
35 var expectation = DomPoint.supported ? returnsNormally : throws;
36 expect(() {
37 Element element = new Element.tag('div');
38 element.attributes['style'] =
39 '''
40 position: absolute;
41 width: 60px;
42 height: 100px;
43 left: 0px;
44 top: 0px;
45 background-color: red;
46 -webkit-transform: translate3d(250px, 100px, 0px);
47 ''';
48 document.body.nodes.add(element);
49
50 DomPoint point = new DomPoint(5, 2);
51 checkPoint(5, 2, point);
52 checkPoint(255, 102, window.convertPointFromNodeToPage(element, point));
53 point.y = 100;
54 checkPoint(5, 100, point);
55 checkPoint(255, 200, window.convertPointFromNodeToPage(element, point));
56 }, expectation);
57 });
37 }); 58 });
38 } 59 }
39 60
40 void checkPoint(expectedX, expectedY, Point point) { 61 void checkPoint(expectedX, expectedY, DomPoint point) {
41 expect(point.x.round(), equals(expectedX), reason: 'Wrong point.x'); 62 expect(point.x.round(), equals(expectedX), reason: 'Wrong point.x');
42 expect(point.y.round(), equals(expectedY), reason: 'Wrong point.y'); 63 expect(point.y.round(), equals(expectedY), reason: 'Wrong point.y');
43 } 64 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698