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

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: Build fix. 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
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>
11 </svg>
12 <p id="description"></p>
13 <div id="console"></div>
14
15 <script>
16 jsTestIsAsync = true;
17 var svg = document.getElementById('svg');
18 var container = document.getElementById('container');
19
20 for (var i = 0; i < 10; i++) {
21 for (var j = 0; j < 10; j++) {
22 var r = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
23 r.setAttribute('x', i * 10 + 1);
24 r.setAttribute('y', j * 10 + 1);
25 r.setAttribute('width', 8);
26 r.setAttribute('height', 8);
27 r.setAttribute('fill', 'green');
28 container.appendChild(r);
29 }
30 }
31
32 var rect = svg.createSVGRect();
33
34 function check_enclosure_and_intersection(e1, i1, e2, i2) {
35 debug('');
36 rect.x = rect.y = 50;
37 rect.width = rect.height = 100;
38 debug('rect: [' + rect.x + ' ' + rect.y + ' '
39 + (rect.x + rect.width) + ' ' + (rect.y + rect.height) + ']');
40 shouldBe('svg.getEnclosureList(rect, null).length', e1 + '');
41 shouldBe('svg.getIntersectionList(rect, null).length',i1 + '');
42
43 debug('');
44 rect.x = rect.y = 55;
45 rect.width = rect.height = 90;
46 debug('rect: [' + rect.x + ' ' + rect.y + ' '
47 + (rect.x + rect.width) + ' ' + (rect.y + rect.height) + ']');
48 shouldBe('svg.getEnclosureList(rect, null).length', e2 + '');
49 shouldBe('svg.getIntersectionList(rect, null).length', i2 + '');
50 }
51
52 function run_test() {
53 description("Verify SVGSVGElement's getIntersectionList() " +
54 "and getEnclosureList() behavior.");
55
56 check_enclosure_and_intersection(100, 100, 64, 100);
57
58 debug('');
59 debug('Zooming should not affect the results.');
60 if (window.eventSender) {
61 eventSender.zoomPageIn();
62 eventSender.zoomPageIn();
63 eventSender.zoomPageIn();
64 }
65 check_enclosure_and_intersection(100, 100, 64, 100);
66
67 debug('');
68 debug('But a viewbox transform should.');
69 svg.setAttribute('viewBox', '0 0 150 150');
70 check_enclosure_and_intersection(36, 49, 25, 36);
71
72 debug('');
73 finishJSTest();
74 }
75 </script>
76 </body>
77 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/svg/dom/SVGSVGElement-intersection-enclosure-expected.txt » ('j') | Source/core/svg/SVGElement.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698