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

Unified 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, 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
Index: LayoutTests/svg/dom/SVGSVGElement-intersection-enclosure.html
diff --git a/LayoutTests/svg/dom/SVGSVGElement-intersection-enclosure.html b/LayoutTests/svg/dom/SVGSVGElement-intersection-enclosure.html
new file mode 100644
index 0000000000000000000000000000000000000000..cdad938525fd9f10ccb06a885e956fc14839dc6e
--- /dev/null
+++ b/LayoutTests/svg/dom/SVGSVGElement-intersection-enclosure.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../resources/js-test.js"></script>
+</head>
+
+<body onload="run_test()">
+ <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+ <g id="container" transform="translate(50, 50)">
+ </g>
+ </svg>
+ <p id="description"></p>
+ <div id="console"></div>
+
+ <script>
+ jsTestIsAsync = true;
+ var svg = document.getElementById('svg');
+ var container = document.getElementById('container');
+
+ for (var i = 0; i < 10; i++) {
+ for (var j = 0; j < 10; j++) {
+ var r = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
+ r.setAttribute('x', i * 10 + 1);
+ r.setAttribute('y', j * 10 + 1);
+ r.setAttribute('width', 8);
+ r.setAttribute('height', 8);
+ r.setAttribute('fill', 'green');
+ container.appendChild(r);
+ }
+ }
+
+ var rect = svg.createSVGRect();
+
+ function check_enclosure_and_intersection(e1, i1, e2, i2) {
+ debug('');
+ rect.x = rect.y = 50;
+ rect.width = rect.height = 100;
+ debug('rect: [' + rect.x + ' ' + rect.y + ' '
+ + (rect.x + rect.width) + ' ' + (rect.y + rect.height) + ']');
+ shouldBe('svg.getEnclosureList(rect, null).length', e1 + '');
+ shouldBe('svg.getIntersectionList(rect, null).length',i1 + '');
+
+ debug('');
+ rect.x = rect.y = 55;
+ rect.width = rect.height = 90;
+ debug('rect: [' + rect.x + ' ' + rect.y + ' '
+ + (rect.x + rect.width) + ' ' + (rect.y + rect.height) + ']');
+ shouldBe('svg.getEnclosureList(rect, null).length', e2 + '');
+ shouldBe('svg.getIntersectionList(rect, null).length', i2 + '');
+ }
+
+ function run_test() {
+ description("Verify SVGSVGElement's getIntersectionList() " +
+ "and getEnclosureList() behavior.");
+
+ check_enclosure_and_intersection(100, 100, 64, 100);
+
+ debug('');
+ debug('Zooming should not affect the results.');
+ if (window.eventSender) {
+ eventSender.zoomPageIn();
+ eventSender.zoomPageIn();
+ eventSender.zoomPageIn();
+ }
+ check_enclosure_and_intersection(100, 100, 64, 100);
+
+ debug('');
+ debug('But a viewbox transform should.');
+ svg.setAttribute('viewBox', '0 0 150 150');
+ check_enclosure_and_intersection(36, 49, 25, 36);
+
+ debug('');
+ finishJSTest();
+ }
+ </script>
+</body>
+</html>
« 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