| OLD | NEW |
| 1 library SVG3Test; | 1 library SVG3Test; |
| 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' as svg; | 5 import 'dart:svg' as svg; |
| 6 | 6 |
| 7 // Test that SVG elements have the operations advertised through all the IDL | 7 // Test that SVG elements have the operations advertised through all the IDL |
| 8 // interfaces. This is a 'duck typing' test, and does not explicitly use 'is' | 8 // interfaces. This is a 'duck typing' test, and does not explicitly use 'is' |
| 9 // checks on the expected interfaces (that is in SVGTest2). | 9 // checks on the expected interfaces (that is in SVGTest2). |
| 10 | 10 |
| 11 main() { | 11 main() { |
| 12 | 12 |
| 13 var isString = predicate((x) => x is String, 'is a String'); | 13 var isString = predicate((x) => x is String, 'is a String'); |
| 14 var isStringList = predicate((x) => x is List<String>, 'is a List<String>'); | 14 var isStringList = predicate((x) => x is List<String>, 'is a List<String>'); |
| 15 var isSvgMatrix = predicate((x) => x is svg.Matrix, 'is a svg.Matrix'); | 15 var isSvgMatrix = predicate((x) => x is svg.Matrix, 'is a svg.Matrix'); |
| 16 var isSvgAnimatedBoolean = | 16 var isSvgAnimatedBoolean = |
| 17 predicate((x) => x is svg.AnimatedBoolean, 'is an svg.AnimatedBoolean'); | 17 predicate((x) => x is svg.AnimatedBoolean, 'is an svg.AnimatedBoolean'); |
| 18 var isSvgAnimatedString = | 18 var isSvgAnimatedString = |
| 19 predicate((x) => x is svg.AnimatedString, 'is an svg.AnimatedString'); | 19 predicate((x) => x is svg.AnimatedString, 'is an svg.AnimatedString'); |
| 20 var isSvgRect = predicate((x) => x is svg.Rect, 'is a svg.Rect'); | 20 var isSvgRect = predicate((x) => x is svg.Rect, 'is a svg.Rect'); |
| 21 var isSvgAnimatedTransformList = | 21 var isSvgAnimatedTransformList = |
| 22 predicate((x) => x is svg.AnimatedTransformList, | 22 predicate((x) => x is svg.AnimatedTransformList, |
| 23 'is an svg.AnimatedTransformList'); | 23 'is an svg.AnimatedTransformList'); |
| 24 var isCSSStyleDeclaration = | 24 var isCSSStyleDeclaration = |
| 25 predicate((x) => x is CSSStyleDeclaration, 'is a CSSStyleDeclaration'); | 25 predicate((x) => x is CSSStyleDeclaration, 'is a CSSStyleDeclaration'); |
| 26 var isCSSValue = predicate((x) => x is CSSValue, 'is a CSSValue'); | 26 var isCSSValue = predicate((x) => x is CSSValue, 'is a CSSValue'); |
| 27 | 27 |
| 28 insertTestDiv() { | 28 insertTestDiv() { |
| 29 var element = new Element.tag('div'); | 29 var element = new Element.tag('div'); |
| 30 element.innerHTML = r''' | 30 element.innerHtml = r''' |
| 31 <svg id='svg1' width='200' height='100'> | 31 <svg id='svg1' width='200' height='100'> |
| 32 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> | 32 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> |
| 33 </svg> | 33 </svg> |
| 34 '''; | 34 '''; |
| 35 document.body.nodes.add(element); | 35 document.body.nodes.add(element); |
| 36 return element; | 36 return element; |
| 37 } | 37 } |
| 38 | 38 |
| 39 useHtmlConfiguration(); | 39 useHtmlConfiguration(); |
| 40 | 40 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 * Verifies that [e] supports the operations on the svg.Locatable interface. | 98 * Verifies that [e] supports the operations on the svg.Locatable interface. |
| 99 */ | 99 */ |
| 100 checkSvgLocatable(e) { | 100 checkSvgLocatable(e) { |
| 101 var v1 = e.farthestViewportElement; | 101 var v1 = e.farthestViewportElement; |
| 102 var v2 = e.nearestViewportElement; | 102 var v2 = e.nearestViewportElement; |
| 103 expect(v1, same(v2)); | 103 expect(v1, same(v2)); |
| 104 | 104 |
| 105 var bbox = e.getBBox(); | 105 var bbox = e.getBBox(); |
| 106 expect(bbox, isSvgRect); | 106 expect(bbox, isSvgRect); |
| 107 | 107 |
| 108 var ctm = e.getCTM(); | 108 var ctm = e.getCtm(); |
| 109 expect(ctm, isSvgMatrix); | 109 expect(ctm, isSvgMatrix); |
| 110 | 110 |
| 111 var sctm = e.getScreenCTM(); | 111 var sctm = e.getScreenCtm(); |
| 112 expect(sctm, isSvgMatrix); | 112 expect(sctm, isSvgMatrix); |
| 113 | 113 |
| 114 var xf2e = e.getTransformToElement(e); | 114 var xf2e = e.getTransformToElement(e); |
| 115 expect(xf2e, isSvgMatrix); | 115 expect(xf2e, isSvgMatrix); |
| 116 } | 116 } |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * Verifies that [e] supports the operations on the svg.Transformable | 119 * Verifies that [e] supports the operations on the svg.Transformable |
| 120 * interface. | 120 * interface. |
| 121 */ | 121 */ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 135 | 135 |
| 136 testRect('rect_SvgTests', checkSvgTests); | 136 testRect('rect_SvgTests', checkSvgTests); |
| 137 testRect('rect_SvgLangSpace', checkSvgLangSpace); | 137 testRect('rect_SvgLangSpace', checkSvgLangSpace); |
| 138 testRect('rect_SvgExternalResourcesRequired', | 138 testRect('rect_SvgExternalResourcesRequired', |
| 139 checkSvgExternalResourcesRequired); | 139 checkSvgExternalResourcesRequired); |
| 140 testRect('rect_SvgStylable', checkSvgStylable); | 140 testRect('rect_SvgStylable', checkSvgStylable); |
| 141 testRect('rect_SvgLocatable', checkSvgLocatable); | 141 testRect('rect_SvgLocatable', checkSvgLocatable); |
| 142 testRect('rect_SvgTransformable', checkSvgTransformable); | 142 testRect('rect_SvgTransformable', checkSvgTransformable); |
| 143 | 143 |
| 144 } | 144 } |
| OLD | NEW |