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

Side by Side Diff: LayoutTests/svg/dom/SVGSVGElement-intersection-enclosure.html

Issue 185333004: [SVG] Refactor getIntersectionList() and getEnclosureList() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Copyright notice update. Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/svg/dom/SVGSVGElement-intersection-enclosure-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6
7 <body onload="run_test()">
8 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
9 <g id="container" transform="translate(50, 50)">
10 <g id="subcontainer">
11 </g>
12 </g>
13 </svg>
14 <p id="description"></p>
15 <div id="console"></div>
16
17 <script>
18 jsTestIsAsync = true;
19 var svg = document.getElementById('svg');
20 var container = document.getElementById('container');
21 var subcontainer = document.getElementById('subcontainer');
22
23 for (var i = 0; i < 10; i++) {
24 for (var j = 0; j < 10; j++) {
25 var r = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
26 r.setAttribute('x', i * 10 + 1);
27 r.setAttribute('y', j * 10 + 1);
28 r.setAttribute('width', 8);
29 r.setAttribute('height', 8);
30 r.setAttribute('fill', 'green');
31 if (j < 5)
32 container.appendChild(r);
33 else
34 subcontainer.appendChild(r);
35 }
36 }
37
38 var rect = svg.createSVGRect();
39 var reference_element;
40
41 function check_enclosure_and_intersection(ref_id, e1, i1, e2, i2) {
42 reference_element = ref_id ? document.getElementById(ref_id) : null;
43
44 debug('');
45 rect.x = rect.y = 50;
46 rect.width = rect.height = 100;
47 debug('rect: [' + rect.x + ' ' + rect.y + ' '
48 + (rect.x + rect.width) + ' ' + (rect.y + rect.height) + ']');
49 debug('referenceElement: ' + ref_id);
50 shouldBe('svg.getEnclosureList(rect, reference_element).length', e1 + '');
51 shouldBe('svg.getIntersectionList(rect, reference_element).length',i1 + '' );
52
53 debug('');
54 rect.x = rect.y = 55;
55 rect.width = rect.height = 90;
56 debug('rect: [' + rect.x + ' ' + rect.y + ' '
57 + (rect.x + rect.width) + ' ' + (rect.y + rect.height) + ']');
58 debug('referenceElement: ' + ref_id);
59 shouldBe('svg.getEnclosureList(rect, reference_element).length', e2 + '');
60 shouldBe('svg.getIntersectionList(rect, reference_element).length', i2 + ' ');
61 }
62
63 function run_test() {
64 description("Verify SVGSVGElement's getIntersectionList() " +
65 "and getEnclosureList() behavior.");
66
67 check_enclosure_and_intersection(null, 100, 100, 64, 100);
68 check_enclosure_and_intersection('container', 100, 100, 64, 100);
69 check_enclosure_and_intersection('subcontainer', 50, 50, 32, 50);
70
71 debug('');
72 debug('Zooming should not affect the results.');
73 if (window.eventSender) {
74 eventSender.zoomPageIn();
75 eventSender.zoomPageIn();
76 eventSender.zoomPageIn();
77 }
78 check_enclosure_and_intersection(null, 100, 100, 64, 100);
79 check_enclosure_and_intersection('container', 100, 100, 64, 100);
80 check_enclosure_and_intersection('subcontainer', 50, 50, 32, 50);
81
82 debug('');
83 debug('But a viewbox transform should.');
84 svg.setAttribute('viewBox', '0 0 150 150');
85 check_enclosure_and_intersection(null, 36, 49, 25, 36);
86 check_enclosure_and_intersection('container', 36, 49, 25, 36);
87 check_enclosure_and_intersection('subcontainer', 6, 14, 0, 6);
88
89 debug('');
90 finishJSTest();
91 }
92 </script>
93 </body>
94 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/svg/dom/SVGSVGElement-intersection-enclosure-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698