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

Unified Diff: LayoutTests/svg/dom/undefined-null.html

Issue 159973005: Add tests for |undefined| and |null| in SVG interfaces (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tweak Created 6 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/svg/dom/undefined-null-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/dom/undefined-null.html
diff --git a/LayoutTests/svg/dom/undefined-null.html b/LayoutTests/svg/dom/undefined-null.html
new file mode 100644
index 0000000000000000000000000000000000000000..9b55cb382d7a536b8cfed52a611aeb61f6933195
--- /dev/null
+++ b/LayoutTests/svg/dom/undefined-null.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<svg>
+ <circle></circle>
+ <text></text>
+</svg>
+<script>
+description(
+ 'Check that |undefined| and |null| arguments do not cause crashes, ' +
+ 'but do throw exceptions.');
+
+var svg = document.querySelector('svg');
+var circle = document.querySelector('circle');
+var text = document.querySelector('text');
+
+var matrix = svg.createSVGMatrix();
+var point = svg.createSVGPoint();
+var rect = svg.createSVGRect();
+
+
+debug('SVGGeometryElement');
+// SVGGeometryElement is an abstract class: instantiate object of derived class
+
+debug('');
+debug('isPointInFill(SVGPoint point)');
+shouldNotThrow('circle.isPointInFill(point)');
+// shouldThrow('circle.isPointInFill(undefined)'); // CRASH
+// shouldThrow('circle.isPointInFill(null)'); // CRASH
+
+debug('');
+debug('isPointInStroke(SVGPoint point)');
+shouldNotThrow('circle.isPointInStroke(point)');
+// shouldThrow('circle.isPointInStroke(undefined)'); // CRASH
+// shouldThrow('circle.isPointInStroke(null)'); // CRASH
+
+
+debug('');
+debug('');
+debug('SVGSVGElement');
+
+debug('');
+debug('getIntersectionList(SVGRect rect, SVGElement? referenceElement)');
+shouldNotThrow('svg.getIntersectionList(rect, svg)');
+// shouldThrow('svg.getIntersectionList(undefined, svg)'); // CRASH
+shouldThrow('svg.getIntersectionList(null, svg)');
+shouldNotThrow('svg.getIntersectionList(rect, undefined)');
+shouldNotThrow('svg.getIntersectionList(rect, null)');
+
+debug('');
+debug('getEnclosureList(SVGRect rect, SVGElement? referenceElement)');
+shouldNotThrow('svg.getEnclosureList(rect, svg)');
+// shouldThrow('svg.getEnclosureList(undefined, svg)'); // CRASH
+shouldThrow('svg.getEnclosureList(null, svg)');
+shouldNotThrow('svg.getEnclosureList(rect, undefined)');
+shouldNotThrow('svg.getEnclosureList(rect, null)');
+
+debug('');
+debug('checkIntersection(SVGElement element, SVGRect rect)');
+shouldNotThrow('svg.checkIntersection(svg, rect)');
+// shouldThrow('svg.checkIntersection(undefined, rect)'); // FAIL
+shouldThrow('svg.checkIntersection(null, rect)');
+// shouldThrow('svg.checkIntersection(svg, undefined)'); // CRASH
+shouldThrow('svg.checkIntersection(svg, null)');
+
+debug('');
+debug('checkEnclosure(SVGElement element, SVGRect rect)');
+shouldNotThrow('svg.checkEnclosure(svg, rect)');
+// shouldThrow('svg.checkEnclosure(undefined, rect)'); // FAIL
+shouldThrow('svg.checkEnclosure(null, rect)');
+// shouldThrow('svg.checkEnclosure(svg, undefined)'); // CRASH
+shouldThrow('svg.checkEnclosure(svg, null)');
+
+debug('');
+debug('SVGTransform createSVGTransformFromMatrix([Default=Undefined] optional SVGMatrix matrix)');
+// shouldNotThrow('svg.createSVGTransformFromMatrix()'); // FAIL
+shouldNotThrow('svg.createSVGTransformFromMatrix(matrix)');
+shouldThrow('svg.createSVGTransformFromMatrix(undefined)');
+shouldThrow('svg.createSVGTransformFromMatrix(null)');
+
+
+debug('');
+debug('');
+debug('SVGTextContentElement');
+
+debug('');
+debug('getCharNumAtPosition(SVGPoint point)');
+shouldNotThrow('text.getCharNumAtPosition(point)');
+// shouldThrow('text.getCharNumAtPosition(undefined)'); // CRASH
+shouldThrow('text.getCharNumAtPosition(null)');
+
+</script>
« no previous file with comments | « no previous file | LayoutTests/svg/dom/undefined-null-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698