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

Side by Side Diff: LayoutTests/svg/hittest/svg-ellipse.xhtml

Issue 62943002: Implement SVGGeometryElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update copyrights Created 7 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
OLDNEW
1 <html xmlns='http://www.w3.org/1999/xhtml'> 1 <html xmlns='http://www.w3.org/1999/xhtml'>
2 <head> 2 <head>
3 <style> 3 <style>
4 #svgRoot { 4 #svgRoot {
5 margin: 0px; 5 margin: 0px;
6 padding: 0px; 6 padding: 0px;
7 position: absolute; 7 position: absolute;
8 top: 0px; 8 top: 0px;
9 left: 0px; 9 left: 0px;
10 } 10 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 {x: 275, y: 250}, // outer stroke 49 {x: 275, y: 250}, // outer stroke
50 {x: 300, y: 200} // inner stroke 50 {x: 300, y: 200} // inner stroke
51 ]; 51 ];
52 52
53 var pointsNotOnEllipseStroke = [ 53 var pointsNotOnEllipseStroke = [
54 {x: 375, y: 375}, // outside ellipse 54 {x: 375, y: 375}, // outside ellipse
55 {x: 0, y: 0}, // outside ellipse 55 {x: 0, y: 0}, // outside ellipse
56 {x: 150, y: 150} // inside ellipse 56 {x: 150, y: 150} // inside ellipse
57 ]; 57 ];
58 58
59 resultString += "Testing isPointInFill/isPointInStroke\n";
pdr. 2013/11/09 00:20:08 I don't think we have sufficient test coverage of
60 var mySVGPoint = ellipseElement.ownerSVGElement.createSVGPoint();
61 pointsInEllipse.forEach( function(point) {
62 mySVGPoint.x = point.x;
63 mySVGPoint.y = point.y;
64 var pass = ellipseElement.isPointInFill(mySVGPoint);
65 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse contains point at (" + point.x + ", " + point.y + ")\n";
66 });
67 pointsNotInEllipse.forEach( function(point) {
68 mySVGPoint.x = point.x;
69 mySVGPoint.y = point.y;
70 var pass = ellipseElement.isPointInFill(mySVGPoint) == false;
71 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse does not contain point at (" + point.x + ", " + point.y + ")\n";
72 });
73
74 pointsOnEllipseStroke.forEach( function(point) {
75 mySVGPoint.x = point.x;
76 mySVGPoint.y = point.y;
77 var pass = ellipseElement.isPointInStroke(mySVGPoint);
78 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse stroke contains p oint at (" + point.x + ", " + point.y + ")\n";
79 });
80 pointsNotOnEllipseStroke.forEach( function(point) {
81 mySVGPoint.x = point.x;
82 mySVGPoint.y = point.y;
83 var pass = ellipseElement.isPointInStroke(mySVGPoint) == false;
84 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse stroke does not c ontain point at (" + point.x + ", " + point.y + ")\n";
85 });
86
87 resultString += "Testing elementFromPoint\n";
59 ellipseElement.style.setProperty("pointer-events", "visibleFill"); // only c apture events on the fill 88 ellipseElement.style.setProperty("pointer-events", "visibleFill"); // only c apture events on the fill
60 pointsInEllipse.forEach( function(point) { 89 pointsInEllipse.forEach( function(point) {
61 var pass = (ellipseElement == document.elementFromPoint(point.x, point.y )); 90 var pass = (ellipseElement == document.elementFromPoint(point.x, point.y ));
62 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse contains point at (" + point.x + ", " + point.y + ")\n"; 91 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse contains point at (" + point.x + ", " + point.y + ")\n";
63 }); 92 });
64 pointsNotInEllipse.forEach( function(point) { 93 pointsNotInEllipse.forEach( function(point) {
65 var pass = (ellipseElement != document.elementFromPoint(point.x, point.y )); 94 var pass = (ellipseElement != document.elementFromPoint(point.x, point.y ));
66 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse does not contain point at (" + point.x + ", " + point.y + ")\n"; 95 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse does not contain point at (" + point.x + ", " + point.y + ")\n";
67 }); 96 });
68 97
69 ellipseElement.style.setProperty("pointer-events", "visibleStroke"); // only capture events on the stroke 98 ellipseElement.style.setProperty("pointer-events", "visibleStroke"); // only capture events on the stroke
70 pointsOnEllipseStroke.forEach( function(point) { 99 pointsOnEllipseStroke.forEach( function(point) {
71 var pass = (ellipseElement == document.elementFromPoint(point.x, point.y )); 100 var pass = (ellipseElement == document.elementFromPoint(point.x, point.y ));
72 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse stroke contains p oint at (" + point.x + ", " + point.y + ")\n"; 101 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse stroke contains p oint at (" + point.x + ", " + point.y + ")\n";
73 }); 102 });
74 pointsNotOnEllipseStroke.forEach( function(point) { 103 pointsNotOnEllipseStroke.forEach( function(point) {
75 var pass = (ellipseElement != document.elementFromPoint(point.x, point.y )); 104 var pass = (ellipseElement != document.elementFromPoint(point.x, point.y ));
76 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse stroke does not c ontain point at (" + point.x + ", " + point.y + ")\n"; 105 resultString += ((pass) ? "PASS" : "FAIL") + " ellipse stroke does not c ontain point at (" + point.x + ", " + point.y + ")\n";
77 }); 106 });
78 document.getElementById("console").innerHTML = resultString; 107 document.getElementById("console").innerHTML = resultString;
79 ]]></script> 108 ]]></script>
80 </body> 109 </body>
81 </html> 110 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698