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

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

Issue 10222026: Migrate dom tests to dart:html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase & address comments. Created 8 years, 8 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
OLDNEW
1 #library('CSSTest'); 1 #library('CSSTest');
2 #import('../../lib/unittest/unittest.dart'); 2 #import('../../lib/unittest/unittest.dart');
3 #import('../../lib/unittest/dom_config.dart'); 3 #import('../../lib/unittest/html_config.dart');
4 #import('dart:dom'); 4 #import('dart:html');
5 5
6 main() { 6 main() {
7 useDomConfiguration(); 7 useHtmlConfiguration();
8 test('WebKitCSSMatrix', () { 8 test('CSSMatrix', () {
9 WebKitCSSMatrix matrix1 = new WebKitCSSMatrix(); 9 CSSMatrix matrix1 = new CSSMatrix();
10 Expect.equals(1, matrix1.m11.round()); 10 Expect.equals(1, matrix1.m11.round());
11 Expect.equals(0, matrix1.m12.round()); 11 Expect.equals(0, matrix1.m12.round());
12 12
13 WebKitCSSMatrix matrix2 = new WebKitCSSMatrix('matrix(1, 0, 0, 1, -835, 0)') ; 13 CSSMatrix matrix2 = new CSSMatrix('matrix(1, 0, 0, 1, -835, 0)');
14 Expect.equals(1, matrix2.a.round()); 14 Expect.equals(1, matrix2.a.round());
15 Expect.equals(-835, matrix2.e.round()); 15 Expect.equals(-835, matrix2.e.round());
16 }); 16 });
17 test('WebKitPoint', () { 17 test('Point', () {
18 HTMLElement element = document.createElement('div'); 18 Element element = new Element.tag('div');
19 element.setAttribute('style', 19 element.attributes['style'] =
20 ''' 20 '''
21 position: absolute; 21 position: absolute;
22 width: 60px; 22 width: 60px;
23 height: 100px; 23 height: 100px;
24 left: 0px; 24 left: 0px;
25 top: 0px; 25 top: 0px;
26 background-color: red; 26 background-color: red;
27 -webkit-transform: translate3d(250px, 100px, 0px) perspective(500px) rotat eX(30deg); 27 -webkit-transform: translate3d(250px, 100px, 0px) perspective(500px) rotat eX(30deg);
28 '''); 28 ''';
29 document.body.appendChild(element); 29 document.body.nodes.add(element);
30 30
31 WebKitPoint point = new WebKitPoint(5, 2); 31 Point point = new Point(5, 2);
32 checkPoint(5, 2, point); 32 checkPoint(5, 2, point);
33 checkPoint(256, 110, window.webkitConvertPointFromNodeToPage(element, point) ); 33 checkPoint(256, 110, window.webkitConvertPointFromNodeToPage(element, point) );
34 point.y = 100; 34 point.y = 100;
35 checkPoint(5, 100, point); 35 checkPoint(5, 100, point);
36 checkPoint(254, 196, window.webkitConvertPointFromNodeToPage(element, point) ); 36 checkPoint(254, 196, window.webkitConvertPointFromNodeToPage(element, point) );
37 }); 37 });
38 } 38 }
39 39
40 void checkPoint(expectedX, expectedY, WebKitPoint point) { 40 void checkPoint(expectedX, expectedY, Point point) {
41 Expect.equals(expectedX, point.x.round(), 'Wrong point.x'); 41 Expect.equals(expectedX, point.x.round(), 'Wrong point.x');
42 Expect.equals(expectedY, point.y.round(), 'Wrong point.y'); 42 Expect.equals(expectedY, point.y.round(), 'Wrong point.y');
43 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698