| OLD | NEW |
| 1 library SVG2Test; | 1 library SVG2Test; |
| 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_config.dart'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 import 'dart:svg'; | 5 import 'dart:svg' as svg; |
| 6 | 6 |
| 7 // Test that SVG elements explicitly implement the IDL interfaces (is-checks | 7 // Test that SVG elements explicitly implement the IDL interfaces (is-checks |
| 8 // only, see SVGTest3 for behavioural tests). | 8 // only, see SVGTest3 for behavioural tests). |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 | 11 |
| 12 insertTestDiv() { | 12 insertTestDiv() { |
| 13 var element = new Element.tag('div'); | 13 var element = new Element.tag('div'); |
| 14 element.innerHTML = r''' | 14 element.innerHTML = r''' |
| 15 <svg id='svg1' width='200' height='100'> | 15 <svg id='svg1' width='200' height='100'> |
| 16 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> | 16 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> |
| 17 </svg> | 17 </svg> |
| 18 '''; | 18 '''; |
| 19 document.body.nodes.add(element); | 19 document.body.nodes.add(element); |
| 20 return element; | 20 return element; |
| 21 } | 21 } |
| 22 | 22 |
| 23 useHtmlConfiguration(); | 23 useHtmlConfiguration(); |
| 24 | 24 |
| 25 var isElement = predicate((x) => x is Element, 'is an Element'); | 25 var isElement = predicate((x) => x is Element, 'is an Element'); |
| 26 var isSVGElement = predicate((x) => x is SVGElement, 'is a SVGElement'); | 26 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); |
| 27 var isSVGSVGElement = | 27 var isSvgSvgElement = |
| 28 predicate((x) => x is SVGSVGElement, 'is a SVGSVGElement'); | 28 predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement'); |
| 29 var isNode = predicate((x) => x is Node, 'is a Node'); | 29 var isNode = predicate((x) => x is Node, 'is a Node'); |
| 30 var isSVGTests = predicate((x) => x is SVGTests, 'is a SVGTests'); | 30 var isSvgTests = predicate((x) => x is svg.Tests, 'is a svg.Tests'); |
| 31 var isSVGLangSpace = predicate((x) => x is SVGLangSpace, 'is a SVGLangSpace'); | 31 var isSvgLangSpace = predicate((x) => x is svg.LangSpace, 'is a svg.LangSpace'
); |
| 32 var isSVGExternalResourcesRequired = | 32 var isSvgExternalResourcesRequired = |
| 33 predicate((x) => x is SVGExternalResourcesRequired, | 33 predicate((x) => x is svg.ExternalResourcesRequired, |
| 34 'is a SVGExternalResourcesRequired'); | 34 'is a svg.ExternalResourcesRequired'); |
| 35 var isSVGStylable = predicate((x) => x is SVGStylable, 'is a SVGStylable'); | 35 var isSvgStylable = predicate((x) => x is svg.Stylable, 'is a svg.Stylable'); |
| 36 var isSVGTransformable = | 36 var isSvgTransformable = |
| 37 predicate((x) => x is SVGTransformable, 'is a SVGTransformable'); | 37 predicate((x) => x is svg.Transformable, 'is a svg.Transformable'); |
| 38 var isSVGLocatable = predicate((x) => x is SVGLocatable, 'is a SVGLocatable'); | 38 var isSvgLocatable = |
| 39 var isSVGNumber = predicate((x) => x is SVGNumber, 'is a SVGNumber'); | 39 predicate((x) => x is svg.Locatable, 'is a svg.Locatable'); |
| 40 var isSVGRect = predicate((x) => x is SVGRect, 'is a SVGRect'); | 40 var isSvgNumber = predicate((x) => x is svg.Number, 'is a svg.Number'); |
| 41 var isSvgRect = predicate((x) => x is svg.Rect, 'is a svg.Rect'); |
| 41 | 42 |
| 42 test('rect_isChecks', () { | 43 test('rect_isChecks', () { |
| 43 var div = insertTestDiv(); | 44 var div = insertTestDiv(); |
| 44 var r = document.query('#rect1'); | 45 var r = document.query('#rect1'); |
| 45 | 46 |
| 46 // Direct inheritance chain | 47 // Direct inheritance chain |
| 47 expect(r, isSVGElement); | 48 expect(r, isSvgElement); |
| 48 expect(r, isElement); | 49 expect(r, isElement); |
| 49 expect(r, isNode); | 50 expect(r, isNode); |
| 50 | 51 |
| 51 // Other implemented interfaces. | 52 // Other implemented interfaces. |
| 52 expect(r, isSVGTests); | 53 expect(r, isSvgTests); |
| 53 expect(r, isSVGLangSpace); | 54 expect(r, isSvgLangSpace); |
| 54 expect(r, isSVGExternalResourcesRequired); | 55 expect(r, isSvgExternalResourcesRequired); |
| 55 expect(r, isSVGStylable); | 56 expect(r, isSvgStylable); |
| 56 expect(r, isSVGTransformable); | 57 expect(r, isSvgTransformable); |
| 57 expect(r, isSVGLocatable); | 58 expect(r, isSvgLocatable); |
| 58 | 59 |
| 59 // Interfaces not implemented. | 60 // Interfaces not implemented. |
| 60 expect(r, isNot(isSVGNumber)); | 61 expect(r, isNot(isSvgNumber)); |
| 61 expect(r, isNot(isSVGRect)); | 62 expect(r, isNot(isSvgRect)); |
| 62 expect(r, isNot(isSVGSVGElement)); | 63 expect(r, isNot(isSvgSvgElement)); |
| 63 | 64 |
| 64 div.remove(); | 65 div.remove(); |
| 65 }); | 66 }); |
| 66 } | 67 } |
| OLD | NEW |