| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 SVGTest; | 5 library SVGTest; |
| 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_individual_config.dart'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:svg' as svg; | 9 import 'dart:svg' as svg; |
| 10 | 10 |
| 11 main() { | 11 main() { |
| 12 useHtmlIndividualConfiguration(); | 12 useHtmlIndividualConfiguration(); |
| 13 | 13 |
| 14 group('svgPresence', () { | 14 group('svgPresence', () { |
| 15 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); | 15 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); |
| 16 | 16 |
| 17 test('simpleRect', () { | 17 test('simpleRect', () { |
| 18 var div = new Element.tag('div'); | 18 var div = new Element.tag('div'); |
| 19 document.body.nodes.add(div); | 19 document.body.append(div); |
| 20 div.innerHtml = r''' | 20 div.innerHtml = r''' |
| 21 <svg id='svg1' width='200' height='100'> | 21 <svg id='svg1' width='200' height='100'> |
| 22 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> | 22 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> |
| 23 </svg> | 23 </svg> |
| 24 | 24 |
| 25 '''; | 25 '''; |
| 26 | 26 |
| 27 var e = document.query('#svg1'); | 27 var e = document.query('#svg1'); |
| 28 expect(e, isNotNull); | 28 expect(e, isNotNull); |
| 29 | 29 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 51 group('svgInterfaceMatch', () { | 51 group('svgInterfaceMatch', () { |
| 52 // Test that SVG elements explicitly implement the IDL interfaces (is-checks | 52 // Test that SVG elements explicitly implement the IDL interfaces (is-checks |
| 53 // only, see SVGTest3 for behavioural tests). | 53 // only, see SVGTest3 for behavioural tests). |
| 54 insertTestDiv() { | 54 insertTestDiv() { |
| 55 var element = new Element.tag('div'); | 55 var element = new Element.tag('div'); |
| 56 element.innerHtml = r''' | 56 element.innerHtml = r''' |
| 57 <svg id='svg1' width='200' height='100'> | 57 <svg id='svg1' width='200' height='100'> |
| 58 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> | 58 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> |
| 59 </svg> | 59 </svg> |
| 60 '''; | 60 '''; |
| 61 document.body.nodes.add(element); | 61 document.body.append(element); |
| 62 return element; | 62 return element; |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 var isElement = predicate((x) => x is Element, 'is an Element'); | 66 var isElement = predicate((x) => x is Element, 'is an Element'); |
| 67 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); | 67 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); |
| 68 var isSvgSvgElement = | 68 var isSvgSvgElement = |
| 69 predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement'); | 69 predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement'); |
| 70 var isNode = predicate((x) => x is Node, 'is a Node'); | 70 var isNode = predicate((x) => x is Node, 'is a Node'); |
| 71 var isSvgTests = predicate((x) => x is svg.Tests, 'is a svg.Tests'); | 71 var isSvgTests = predicate((x) => x is svg.Tests, 'is a svg.Tests'); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 }); | 105 }); |
| 106 }); | 106 }); |
| 107 | 107 |
| 108 insertTestDiv() { | 108 insertTestDiv() { |
| 109 var element = new Element.tag('div'); | 109 var element = new Element.tag('div'); |
| 110 element.innerHtml = r''' | 110 element.innerHtml = r''' |
| 111 <svg id='svg1' width='200' height='100'> | 111 <svg id='svg1' width='200' height='100'> |
| 112 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> | 112 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> |
| 113 </svg> | 113 </svg> |
| 114 '''; | 114 '''; |
| 115 document.body.nodes.add(element); | 115 document.body.append(element); |
| 116 return element; | 116 return element; |
| 117 } | 117 } |
| 118 | 118 |
| 119 group('supported_externalResourcesRequired', () { | 119 group('supported_externalResourcesRequired', () { |
| 120 test('supported', () { | 120 test('supported', () { |
| 121 var div = insertTestDiv(); | 121 var div = insertTestDiv(); |
| 122 var r = document.query('#rect1'); | 122 var r = document.query('#rect1'); |
| 123 expect(svg.ExternalResourcesRequired.supported(r), true); | 123 expect(svg.ExternalResourcesRequired.supported(r), true); |
| 124 div.remove(); | 124 div.remove(); |
| 125 }); | 125 }); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 testRect('rect_SvgTests', checkSvgTests); | 238 testRect('rect_SvgTests', checkSvgTests); |
| 239 testRect('rect_SvgLangSpace', checkSvgLangSpace); | 239 testRect('rect_SvgLangSpace', checkSvgLangSpace); |
| 240 testRect('rect_SvgExternalResourcesRequired', | 240 testRect('rect_SvgExternalResourcesRequired', |
| 241 checkSvgExternalResourcesRequired); | 241 checkSvgExternalResourcesRequired); |
| 242 testRect('rect_SvgLocatable', checkSvgLocatable); | 242 testRect('rect_SvgLocatable', checkSvgLocatable); |
| 243 testRect('rect_SvgTransformable', checkSvgTransformable); | 243 testRect('rect_SvgTransformable', checkSvgTransformable); |
| 244 }); | 244 }); |
| 245 | 245 |
| 246 } | 246 } |
| OLD | NEW |