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

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

Issue 11406002: Revert run large html tests individually. (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
« no previous file with comments | « tests/html/node_test.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library SVGElementTest; 5 library SVGElementTest;
6 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_individual_config.dart'; 7 import '../../pkg/unittest/lib/html_config.dart';
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 main() { 10 main() {
11 useHtmlIndividualConfiguration(); 11 useHtmlConfiguration();
12 12
13 var isSVGSVGElement = 13 var isSVGSVGElement =
14 predicate((x) => x is SVGSVGElement, 'is a SVGSVGElement'); 14 predicate((x) => x is SVGSVGElement, 'is a SVGSVGElement');
15 15
16 Collection<String> _nodeStrings(Collection<Node> input) { 16 Collection<String> _nodeStrings(Collection<Node> input) {
17 final out = new List<String>(); 17 final out = new List<String>();
18 for (Node n in input) { 18 for (Node n in input) {
19 if (n is Element) { 19 if (n is Element) {
20 Element e = n; 20 Element e = n;
21 out.add(e.tagName); 21 out.add(e.tagName);
22 } else { 22 } else {
23 out.add(n.text); 23 out.add(n.text);
24 } 24 }
25 } 25 }
26 return out; 26 return out;
27 }; 27 };
28 28
29 testConstructor(String tagName, Function isExpectedClass) { 29 testConstructor(String tagName, Function isExpectedClass) {
30 test(tagName, () { 30 test(tagName, () {
31 expect(isExpectedClass(new SVGElement.tag(tagName)), isTrue); 31 expect(isExpectedClass(new SVGElement.tag(tagName)), isTrue);
32 expect(isExpectedClass( 32 expect(isExpectedClass(
33 new SVGElement.svg('<$tagName></$tagName>')), isTrue); 33 new SVGElement.svg('<$tagName></$tagName>')), isTrue);
34 }); 34 });
35 } 35 }
36 group('additionalConstructors', () { 36
37 group('constructors', () {
37 group('svg', () { 38 group('svg', () {
38 test('valid', () { 39 test('valid', () {
39 final svg = """ 40 final svg = """
40 <svg version="1.1"> 41 <svg version="1.1">
41 <circle></circle> 42 <circle></circle>
42 <path></path> 43 <path></path>
43 </svg>"""; 44 </svg>""";
44 final el = new SVGElement.svg(svg); 45 final el = new SVGElement.svg(svg);
45 expect(el, isSVGSVGElement); 46 expect(el, isSVGSVGElement);
46 expect(el.innerHTML, "<circle></circle><path></path>"); 47 expect(el.innerHTML, "<circle></circle><path></path>");
47 expect(el.outerHTML, svg); 48 expect(el.outerHTML, svg);
48 }); 49 });
49 50
50 test('has no parent', () => 51 test('has no parent', () =>
51 expect(new SVGElement.svg('<circle/>').parent, isNull) 52 expect(new SVGElement.svg('<circle/>').parent, isNull)
52 ); 53 );
53 54
54 test('empty', () { 55 test('empty', () {
55 expect(() => new SVGElement.svg(""), throwsArgumentError); 56 expect(() => new SVGElement.svg(""), throwsArgumentError);
56 }); 57 });
57 58
58 test('too many elements', () { 59 test('too many elements', () {
59 expect(() => new SVGElement.svg("<circle></circle><path></path>"), 60 expect(() => new SVGElement.svg("<circle></circle><path></path>"),
60 throwsArgumentError); 61 throwsArgumentError);
61 }); 62 });
62 }); 63 });
64
65 testConstructor('a', (e) => e is SVGAElement);
63 testConstructor('altGlyphDef', (e) => e is SVGAltGlyphDefElement); 66 testConstructor('altGlyphDef', (e) => e is SVGAltGlyphDefElement);
64 testConstructor('altGlyph', (e) => e is SVGAltGlyphElement); 67 testConstructor('altGlyph', (e) => e is SVGAltGlyphElement);
65 testConstructor('animateColor', (e) => e is SVGAnimateColorElement); 68 testConstructor('animateColor', (e) => e is SVGAnimateColorElement);
66 testConstructor('animate', (e) => e is SVGAnimateElement); 69 testConstructor('animate', (e) => e is SVGAnimateElement);
67 // WebKit doesn't recognize animateMotion 70 // WebKit doesn't recognize animateMotion
68 // testConstructor('animateMotion', (e) => e is SVGAnimateMotionElement); 71 // testConstructor('animateMotion', (e) => e is SVGAnimateMotionElement);
69 testConstructor('animateTransform', (e) => e is SVGAnimateTransformElement); 72 testConstructor('animateTransform', (e) => e is SVGAnimateTransformElement);
73 testConstructor('circle', (e) => e is SVGCircleElement);
74 testConstructor('clipPath', (e) => e is SVGClipPathElement);
70 testConstructor('cursor', (e) => e is SVGCursorElement); 75 testConstructor('cursor', (e) => e is SVGCursorElement);
76 testConstructor('defs', (e) => e is SVGDefsElement);
77 testConstructor('desc', (e) => e is SVGDescElement);
78 testConstructor('ellipse', (e) => e is SVGEllipseElement);
71 testConstructor('feBlend', (e) => e is SVGFEBlendElement); 79 testConstructor('feBlend', (e) => e is SVGFEBlendElement);
72 testConstructor('feColorMatrix', (e) => e is SVGFEColorMatrixElement); 80 testConstructor('feColorMatrix', (e) => e is SVGFEColorMatrixElement);
73 testConstructor('feComponentTransfer', 81 testConstructor('feComponentTransfer',
74 (e) => e is SVGFEComponentTransferElement); 82 (e) => e is SVGFEComponentTransferElement);
75 testConstructor('feConvolveMatrix', (e) => e is SVGFEConvolveMatrixElement); 83 testConstructor('feConvolveMatrix', (e) => e is SVGFEConvolveMatrixElement);
76 testConstructor('feDiffuseLighting', 84 testConstructor('feDiffuseLighting',
77 (e) => e is SVGFEDiffuseLightingElement); 85 (e) => e is SVGFEDiffuseLightingElement);
78 testConstructor('feDisplacementMap', 86 testConstructor('feDisplacementMap',
79 (e) => e is SVGFEDisplacementMapElement); 87 (e) => e is SVGFEDisplacementMapElement);
80 testConstructor('feDistantLight', (e) => e is SVGFEDistantLightElement); 88 testConstructor('feDistantLight', (e) => e is SVGFEDistantLightElement);
(...skipping 15 matching lines...) Expand all
96 testConstructor('feTile', (e) => e is SVGFETileElement); 104 testConstructor('feTile', (e) => e is SVGFETileElement);
97 testConstructor('feTurbulence', (e) => e is SVGFETurbulenceElement); 105 testConstructor('feTurbulence', (e) => e is SVGFETurbulenceElement);
98 testConstructor('filter', (e) => e is SVGFilterElement); 106 testConstructor('filter', (e) => e is SVGFilterElement);
99 testConstructor('font', (e) => e is SVGFontElement); 107 testConstructor('font', (e) => e is SVGFontElement);
100 testConstructor('font-face', (e) => e is SVGFontFaceElement); 108 testConstructor('font-face', (e) => e is SVGFontFaceElement);
101 testConstructor('font-face-format', (e) => e is SVGFontFaceFormatElement); 109 testConstructor('font-face-format', (e) => e is SVGFontFaceFormatElement);
102 testConstructor('font-face-name', (e) => e is SVGFontFaceNameElement); 110 testConstructor('font-face-name', (e) => e is SVGFontFaceNameElement);
103 testConstructor('font-face-src', (e) => e is SVGFontFaceSrcElement); 111 testConstructor('font-face-src', (e) => e is SVGFontFaceSrcElement);
104 testConstructor('font-face-uri', (e) => e is SVGFontFaceUriElement); 112 testConstructor('font-face-uri', (e) => e is SVGFontFaceUriElement);
105 testConstructor('foreignObject', (e) => e is SVGForeignObjectElement); 113 testConstructor('foreignObject', (e) => e is SVGForeignObjectElement);
114 testConstructor('g', (e) => e is SVGGElement);
106 testConstructor('glyph', (e) => e is SVGGlyphElement); 115 testConstructor('glyph', (e) => e is SVGGlyphElement);
107 testConstructor('glyphRef', (e) => e is SVGGlyphRefElement); 116 testConstructor('glyphRef', (e) => e is SVGGlyphRefElement);
108 testConstructor('metadata', (e) => e is SVGMetadataElement);
109 testConstructor('missing-glyph', (e) => e is SVGMissingGlyphElement);
110 testConstructor('set', (e) => e is SVGSetElement);
111 testConstructor('tref', (e) => e is SVGTRefElement);
112 testConstructor('vkern', (e) => e is SVGVKernElement);
113 });
114
115 group('constructors', () {
116 testConstructor('a', (e) => e is SVGAElement);
117 testConstructor('circle', (e) => e is SVGCircleElement);
118 testConstructor('clipPath', (e) => e is SVGClipPathElement);
119 testConstructor('defs', (e) => e is SVGDefsElement);
120 testConstructor('desc', (e) => e is SVGDescElement);
121 testConstructor('ellipse', (e) => e is SVGEllipseElement);
122 testConstructor('g', (e) => e is SVGGElement);
123 // WebKit doesn't recognize hkern 117 // WebKit doesn't recognize hkern
124 // testConstructor('hkern', (e) => e is SVGHKernElement); 118 // testConstructor('hkern', (e) => e is SVGHKernElement);
125 testConstructor('image', (e) => e is SVGImageElement); 119 testConstructor('image', (e) => e is SVGImageElement);
126 testConstructor('line', (e) => e is SVGLineElement); 120 testConstructor('line', (e) => e is SVGLineElement);
127 testConstructor('linearGradient', (e) => e is SVGLinearGradientElement); 121 testConstructor('linearGradient', (e) => e is SVGLinearGradientElement);
128 // WebKit doesn't recognize mpath 122 // WebKit doesn't recognize mpath
129 // testConstructor('mpath', (e) => e is SVGMPathElement); 123 // testConstructor('mpath', (e) => e is SVGMPathElement);
130 testConstructor('marker', (e) => e is SVGMarkerElement); 124 testConstructor('marker', (e) => e is SVGMarkerElement);
131 testConstructor('mask', (e) => e is SVGMaskElement); 125 testConstructor('mask', (e) => e is SVGMaskElement);
126 testConstructor('metadata', (e) => e is SVGMetadataElement);
127 testConstructor('missing-glyph', (e) => e is SVGMissingGlyphElement);
132 testConstructor('path', (e) => e is SVGPathElement); 128 testConstructor('path', (e) => e is SVGPathElement);
133 testConstructor('pattern', (e) => e is SVGPatternElement); 129 testConstructor('pattern', (e) => e is SVGPatternElement);
134 testConstructor('polygon', (e) => e is SVGPolygonElement); 130 testConstructor('polygon', (e) => e is SVGPolygonElement);
135 testConstructor('polyline', (e) => e is SVGPolylineElement); 131 testConstructor('polyline', (e) => e is SVGPolylineElement);
136 testConstructor('radialGradient', (e) => e is SVGRadialGradientElement); 132 testConstructor('radialGradient', (e) => e is SVGRadialGradientElement);
137 testConstructor('rect', (e) => e is SVGRectElement); 133 testConstructor('rect', (e) => e is SVGRectElement);
138 testConstructor('script', (e) => e is SVGScriptElement); 134 testConstructor('script', (e) => e is SVGScriptElement);
135 testConstructor('set', (e) => e is SVGSetElement);
139 testConstructor('stop', (e) => e is SVGStopElement); 136 testConstructor('stop', (e) => e is SVGStopElement);
140 testConstructor('style', (e) => e is SVGStyleElement); 137 testConstructor('style', (e) => e is SVGStyleElement);
141 testConstructor('switch', (e) => e is SVGSwitchElement); 138 testConstructor('switch', (e) => e is SVGSwitchElement);
142 testConstructor('symbol', (e) => e is SVGSymbolElement); 139 testConstructor('symbol', (e) => e is SVGSymbolElement);
140 testConstructor('tref', (e) => e is SVGTRefElement);
143 testConstructor('tspan', (e) => e is SVGTSpanElement); 141 testConstructor('tspan', (e) => e is SVGTSpanElement);
144 testConstructor('text', (e) => e is SVGTextElement); 142 testConstructor('text', (e) => e is SVGTextElement);
145 testConstructor('textPath', (e) => e is SVGTextPathElement); 143 testConstructor('textPath', (e) => e is SVGTextPathElement);
146 testConstructor('title', (e) => e is SVGTitleElement); 144 testConstructor('title', (e) => e is SVGTitleElement);
147 testConstructor('use', (e) => e is SVGUseElement); 145 testConstructor('use', (e) => e is SVGUseElement);
146 testConstructor('vkern', (e) => e is SVGVKernElement);
148 testConstructor('view', (e) => e is SVGViewElement); 147 testConstructor('view', (e) => e is SVGViewElement);
149 }); 148 });
150 149
151 group('outerHTML', () { 150 test('outerHTML', () {
152 test('outerHTML', () { 151 final el = new SVGSVGElement();
153 final el = new SVGSVGElement(); 152 el.elements.add(new SVGElement.tag("circle"));
154 el.elements.add(new SVGElement.tag("circle")); 153 el.elements.add(new SVGElement.tag("path"));
155 el.elements.add(new SVGElement.tag("path")); 154 expect(el.outerHTML,
156 expect(el.outerHTML, 155 '<svg version="1.1"><circle></circle><path></path></svg>');
157 '<svg version="1.1"><circle></circle><path></path></svg>');
158 });
159 }); 156 });
160 157
161 group('innerHTML', () { 158 group('innerHTML', () {
162 test('get', () { 159 test('get', () {
163 final el = new SVGSVGElement(); 160 final el = new SVGSVGElement();
164 el.elements.add(new SVGElement.tag("circle")); 161 el.elements.add(new SVGElement.tag("circle"));
165 el.elements.add(new SVGElement.tag("path")); 162 el.elements.add(new SVGElement.tag("path"));
166 expect(el.innerHTML, '<circle></circle><path></path>'); 163 expect(el.innerHTML, '<circle></circle><path></path>');
167 }); 164 });
168 165
169 test('set', () { 166 test('set', () {
170 final el = new SVGSVGElement(); 167 final el = new SVGSVGElement();
171 el.elements.add(new SVGElement.tag("circle")); 168 el.elements.add(new SVGElement.tag("circle"));
172 el.elements.add(new SVGElement.tag("path")); 169 el.elements.add(new SVGElement.tag("path"));
173 el.innerHTML = '<rect></rect><a></a>'; 170 el.innerHTML = '<rect></rect><a></a>';
174 expect(_nodeStrings(el.elements), ["rect", "a"]); 171 expect(_nodeStrings(el.elements), ["rect", "a"]);
175 }); 172 });
176 }); 173 });
177 174
178 group('elementget', () { 175 group('elements', () {
179 test('get', () { 176 test('get', () {
180 final el = new SVGElement.svg(""" 177 final el = new SVGElement.svg("""
181 <svg version="1.1"> 178 <svg version="1.1">
182 <circle></circle> 179 <circle></circle>
183 <path></path> 180 <path></path>
184 text 181 text
185 </svg>"""); 182 </svg>""");
186 expect(_nodeStrings(el.elements), ["circle", "path"]); 183 expect(_nodeStrings(el.elements), ["circle", "path"]);
187 }); 184 });
188 });
189 185
190 group('elementset', () {
191 test('set', () { 186 test('set', () {
192 final el = new SVGSVGElement(); 187 final el = new SVGSVGElement();
193 el.elements = [new SVGElement.tag("circle"), new SVGElement.tag("path")]; 188 el.elements = [new SVGElement.tag("circle"), new SVGElement.tag("path")];
194 expect(el.innerHTML, '<circle></circle><path></path>'); 189 expect(el.innerHTML, '<circle></circle><path></path>');
195 }); 190 });
196 }); 191 });
197 } 192 }
OLDNEW
« no previous file with comments | « tests/html/node_test.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698