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

Side by Side Diff: LayoutTests/fast/svg/getbbox.html

Issue 357943002: Fixup for test (was missing a closing tag). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <title>getBBox tests</title> 2 <title>getBBox tests</title>
3 <script src=../../resources/testharness.js></script> 3 <script src=../../resources/testharness.js></script>
4 <script src=../../resources/testharnessreport.js></script> 4 <script src=../../resources/testharnessreport.js></script>
5 <div id="testcontainer"> 5 <div id="testcontainer">
6 <svg width="1" height="1" visibility="hidden"> 6 <svg width="1" height="1" visibility="hidden">
7 <g id="g1"> 7 <g id="g1">
8 <polygon id="p1" fill="none" stroke="red" /> 8 <polygon id="p1" fill="none" stroke="red" />
9 <rect id="r1" x="50" y="50" width="50" height="50" fill="green" /> 9 <rect id="r1" x="50" y="50" width="50" height="50" fill="green" />
10 </g> 10 </g>
11 <g id="g2"> 11 <g id="g2">
12 <rect id="r2" x="50" y="50" width="50" height="50" fill="green" /> 12 <rect id="r2" x="50" y="50" width="50" height="50" fill="green" />
13 <rect id="r3" x="20" y="20" width="20" height="0" fill="red" /> 13 <rect id="r3" x="20" y="20" width="20" height="0" fill="red" />
14 <rect id="r4" x="120" y="20" width="20" height="20" fill="blue" style="displ ay:none" /> 14 <rect id="r4" x="120" y="20" width="20" height="20" fill="blue" style="displ ay:none" />
15 <ellipse id="c1" cx="20" cy="120" rx="0" ry="20" fill="black" /> 15 <ellipse id="c1" cx="20" cy="120" rx="0" ry="20" fill="black" />
16 <g> 16 <g>
17 <rect id="r5" x="120" y="120" width="-1" height="100" fill="cyan" /> 17 <rect id="r5" x="120" y="120" width="-1" height="100" fill="cyan" />
18 </g> 18 </g>
19 </g> 19 </g>
20 <g id="g3"> 20 <g id="g3">
21 <path id="p2" fill="none" stroke="red" /> 21 <path id="p2" fill="none" stroke="red" />
22 <rect id="r6" x="50" y="50" width="50" height="50" fill="green" /> 22 <rect id="r6" x="50" y="50" width="50" height="50" fill="green" />
23 <!-- The following path should be included in the bbox. --> 23 <!-- The following path should be included in the bbox. -->
24 <path d="" 24 <path d=""/>
25 </g> 25 </g>
26 <g id="g4"> 26 <g id="g4">
27 <polyline id="p3" fill="none" stroke="red" /> 27 <polyline id="p3" fill="none" stroke="red" />
28 <rect id="r7" x="50" y="50" width="50" height="50" fill="green" /> 28 <rect id="r7" x="50" y="50" width="50" height="50" fill="green" />
29 </g> 29 </g>
30 <g id="g5"> 30 <g id="g5">
31 <path id="p4" d="M3"/> 31 <path id="p4" d="M3"/>
32 <rect id="r8" x="50" y="50" width="50" height="50" fill="green" /> 32 <rect id="r8" x="50" y="50" width="50" height="50" fill="green" />
33 </g> 33 </g>
34 <g id="g6"> 34 <g id="g6">
35 <polygon id="p5" points="47" fill="none" stroke="red" /> 35 <polygon id="p5" points="47" fill="none" stroke="red" />
36 <rect id="r9" x="50" y="50" width="50" height="50" fill="green" /> 36 <rect id="r9" x="50" y="50" width="50" height="50" fill="green" />
37 </g> 37 </g>
38 <g id="g7"> 38 <g id="g7">
39 <polyline id="p6" points="47" fill="none" stroke="red" /> 39 <polyline id="p6" points="47" fill="none" stroke="red" />
40 <rect id="r10" x="50" y="50" width="50" height="50" fill="green" /> 40 <rect id="r10" x="50" y="50" width="50" height="50" fill="green" />
41 </g> 41 </g>
42 <g id="g8">
43 <path id="p7" d="M40 20h0" fill="none" stroke="red" />
44 <rect id="r11" x="50" y="50" width="50" height="50" fill="green" />
45 </g>
42 </svg> 46 </svg>
43 </div> 47 </div>
44 <div id=log></div> 48 <div id=log></div>
45 <script> 49 <script>
46 var EPSILON = Math.pow(2, -24); // float epsilon 50 var EPSILON = Math.pow(2, -24); // float epsilon
47 51
48 function assert_rect_approx_equals(rect, expected, epsilon) { 52 function assert_rect_approx_equals(rect, expected, epsilon) {
49 assert_approx_equals(rect.x, expected.x, epsilon, "x"); 53 assert_approx_equals(rect.x, expected.x, epsilon, "x");
50 assert_approx_equals(rect.y, expected.y, epsilon, "y"); 54 assert_approx_equals(rect.y, expected.y, epsilon, "y");
51 assert_approx_equals(rect.width, expected.width, epsilon, "width"); 55 assert_approx_equals(rect.width, expected.width, epsilon, "width");
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 }, "path with only invalid segments doesn't contribute to parent bbox"); 88 }, "path with only invalid segments doesn't contribute to parent bbox");
85 test(function() { 89 test(function() {
86 assert_rect_approx_equals(document.getElementById("g4").getBBox(), docum ent.getElementById("r7").getBBox(), EPSILON); 90 assert_rect_approx_equals(document.getElementById("g4").getBBox(), docum ent.getElementById("r7").getBBox(), EPSILON);
87 }, "polyline doesn't contribute to parent bbox"); 91 }, "polyline doesn't contribute to parent bbox");
88 test(function() { 92 test(function() {
89 assert_rect_approx_equals(document.getElementById("g6").getBBox(), docum ent.getElementById("r9").getBBox(), EPSILON); 93 assert_rect_approx_equals(document.getElementById("g6").getBBox(), docum ent.getElementById("r9").getBBox(), EPSILON);
90 }, "polygon with no valid points doesn't contribute to parent bbox"); 94 }, "polygon with no valid points doesn't contribute to parent bbox");
91 test(function() { 95 test(function() {
92 assert_rect_approx_equals(document.getElementById("g7").getBBox(), docum ent.getElementById("r10").getBBox(), EPSILON); 96 assert_rect_approx_equals(document.getElementById("g7").getBBox(), docum ent.getElementById("r10").getBBox(), EPSILON);
93 }, "polyline with no valid points doesn't contribute to parent bbox"); 97 }, "polyline with no valid points doesn't contribute to parent bbox");
98 test(function() {
99 assert_rect_approx_equals(document.getElementById("p7").getBBox(), {"x": 40, "y":20, "width":0, "height":0 }, EPSILON);
100 }, "getBBox on path with no height");
101 test(function() {
102 assert_rect_approx_equals(document.getElementById("g8").getBBox(), {"x": 40, "y":20, "width":60, "height":80 }, EPSILON);
103 }, "path with no height should contribute to parent bbox");
94 104
95 </script> 105 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698