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

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

Issue 11275054: Modified unittest to use new argument syntax. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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('SVG2Test'); 1 #library('SVG2Test');
2 #import('../../pkg/unittest/unittest.dart'); 2 #import('../../pkg/unittest/unittest.dart');
3 #import('../../pkg/unittest/html_config.dart'); 3 #import('../../pkg/unittest/html_config.dart');
4 #import('dart:html'); 4 #import('dart:html');
5 5
6 // Test that SVG elements explicitly implement the IDL interfaces (is-checks 6 // Test that SVG elements explicitly implement the IDL interfaces (is-checks
7 // only, see SVGTest3 for behavioural tests). 7 // only, see SVGTest3 for behavioural tests).
8 8
9 main() { 9 main() {
10 10
11 insertTestDiv() { 11 insertTestDiv() {
12 var element = new Element.tag('div'); 12 var element = new Element.tag('div');
13 element.innerHTML = r''' 13 element.innerHTML = r'''
14 <svg id='svg1' width='200' height='100'> 14 <svg id='svg1' width='200' height='100'>
15 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> 15 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect>
16 </svg> 16 </svg>
17 '''; 17 ''';
18 document.body.nodes.add(element); 18 document.body.nodes.add(element);
19 return element; 19 return element;
20 } 20 }
21 21
22 useHtmlConfiguration(); 22 useHtmlConfiguration();
23 23
24 var isElement = predicate((x) => x is Element, 'is an Element');
25 var isSVGElement = predicate((x) => x is SVGElement, 'is a SVGElement');
26 var isSVGSVGElement =
27 predicate((x) => x is SVGSVGElement, 'is a SVGSVGElement');
28 var isNode = predicate((x) => x is Node, 'is a Node');
29 var isSVGTests = predicate((x) => x is SVGTests, 'is a SVGTests');
30 var isSVGLangSpace = predicate((x) => x is SVGLangSpace, 'is a SVGLangSpace');
31 var isSVGExternalResourcesRequired =
32 predicate((x) => x is SVGExternalResourcesRequired,
33 'is a SVGExternalResourcesRequired');
34 var isSVGStylable = predicate((x) => x is SVGStylable, 'is a SVGStylable');
35 var isSVGTransformable =
36 predicate((x) => x is SVGTransformable, 'is a SVGTransformable');
37 var isSVGLocatable = predicate((x) => x is SVGLocatable, 'is a SVGLocatable');
38 var isSVGNumber = predicate((x) => x is SVGNumber, 'is a SVGNumber');
39 var isSVGRect = predicate((x) => x is SVGRect, 'is a SVGRect');
40
24 test('rect_isChecks', () { 41 test('rect_isChecks', () {
25 var div = insertTestDiv(); 42 var div = insertTestDiv();
26 var r = document.query('#rect1'); 43 var r = document.query('#rect1');
27 44
28 // Direct inheritance chain 45 // Direct inheritance chain
29 Expect.isTrue(r is SVGElement); 46 expect(r, isSVGElement);
30 Expect.isTrue(r is Element); 47 expect(r, isElement);
31 Expect.isTrue(r is Node); 48 expect(r, isNode);
32 49
33 // Other implemented interfaces. 50 // Other implemented interfaces.
34 Expect.isTrue(r is SVGTests); 51 expect(r, isSVGTests);
35 Expect.isTrue(r is SVGLangSpace); 52 expect(r, isSVGLangSpace);
36 Expect.isTrue(r is SVGExternalResourcesRequired); 53 expect(r, isSVGExternalResourcesRequired);
37 Expect.isTrue(r is SVGStylable); 54 expect(r, isSVGStylable);
38 Expect.isTrue(r is SVGTransformable); 55 expect(r, isSVGTransformable);
39 Expect.isTrue(r is SVGLocatable); 56 expect(r, isSVGLocatable);
40 57
41 // Interfaces not implemented. 58 // Interfaces not implemented.
42 Expect.isFalse(r is SVGNumber); 59 expect(r, isNot(isSVGNumber));
43 Expect.isFalse(r is SVGRect); 60 expect(r, isNot(isSVGRect));
44 Expect.isFalse(r is SVGSVGElement); 61 expect(r, isNot(isSVGSVGElement));
45 62
46 div.remove(); 63 div.remove();
47 }); 64 });
48 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698