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

Side by Side Diff: LayoutTests/svg/dom/SVGPathSegList-xml-dom-synchronization.xhtml

Issue 205263004: Convert svg repaint tests to pixel test only repaint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove fixedpos 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
1 <html xmlns="http://www.w3.org/1999/xhtml"> 1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head> 2 <head>
3 <script>window.enablePixelTesting = true;</script> 3 <script>window.enablePixelTesting = true;</script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 <script src="../../fast/repaint/resources/repaint.js"></script> 5 <script src="../../fast/repaint/resources/text-based-repaint.js"></script>
6 <script type="text/javascript"> 6 <script type="text/javascript">
7 function repaintTest() { 7 function repaintTest() {
8 window.jsTestIsAsync = true; 8 window.jsTestIsAsync = true;
9 if (window.testRunner) 9 if (window.testRunner)
10 testRunner.waitUntilDone(); 10 testRunner.waitUntilDone();
11 11
12 path = document.getElementById("path"); 12 path = document.getElementById("path");
13 shouldBe("path.pathSegList.numberOfItems", "3"); 13 shouldBe("path.pathSegList.numberOfItems", "3");
14 14
15 // Check initial 'd' attribute value. 15 // Check initial 'd' attribute value.
16 shouldBeEqualToString("path.getAttribute('d').formatDAttribute()", "M 20 0 0 L 100 0 L 100 100"); 16 shouldBeEqualToString("path.getAttribute('d').formatDAttribute()", "M 20 0 0 L 100 0 L 100 100");
17 17
18 // Append one item, check 'd' attribute changed. 18 // Append one item, check 'd' attribute changed.
19 path.pathSegList.appendItem(path.createSVGPathSegLinetoAbs(0, 100)); 19 path.pathSegList.appendItem(path.createSVGPathSegLinetoAbs(0, 100));
20 shouldBeEqualToString("path.getAttribute('d').formatDAttribute()", "M 20 0 0 L 100 0 L 100 100 L 0 100"); 20 shouldBeEqualToString("path.getAttribute('d').formatDAttribute()", "M 20 0 0 L 100 0 L 100 100 L 0 100");
21 21
22 // Modify first item, check 'd' attribute changed. 22 // Modify first item, check 'd' attribute changed.
23 path.pathSegList.getItem(0).x -= 100; 23 path.pathSegList.getItem(0).x -= 100;
24 shouldBeEqualToString("path.getAttribute('d').formatDAttribute()", "M 10 0 0 L 100 0 L 100 100 L 0 100"); 24 shouldBeEqualToString("path.getAttribute('d').formatDAttribute()", "M 10 0 0 L 100 0 L 100 100 L 0 100");
25 25
26 // Modify first item, check 'd' attribute changed, now a green rectangle should be visible. 26 // Modify first item, check 'd' attribute changed, now a green rectangle should be visible.
27 path.pathSegList.getItem(0).x -= 100; 27 path.pathSegList.getItem(0).x -= 100;
28 shouldBeEqualToString("path.getAttribute('d').formatDAttribute()", "M 0 0 L 100 0 L 100 100 L 0 100"); 28 shouldBeEqualToString("path.getAttribute('d').formatDAttribute()", "M 0 0 L 100 0 L 100 100 L 0 100");
29 29
30 finishJSTest(); 30 finishJSTest();
31 } 31 }
32 </script> 32 </script>
33 </head> 33 </head>
34 <body onload="runRepaintTest()"> 34 <body onload="runRepaintAndPixelTest()">
35 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> 35 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
36 <path id="path" fill="green" transform="translate(10 10)" d="M 200 0 L 100 0 L 100 100"/> 36 <path id="path" fill="green" transform="translate(10 10)" d="M 200 0 L 100 0 L 100 100"/>
37 </svg> 37 </svg>
38 38
39 <p id="description"></p> 39 <p id="description"></p>
40 <div id="console"></div> 40 <div id="console"></div>
41 <script type="text/javascript"> 41 <script type="text/javascript">
42 <![CDATA[ 42 <![CDATA[
43 description("This is a test how SVGLengthList reacts to XML DOM modification s."); 43 description("This is a test how SVGLengthList reacts to XML DOM modification s.");
44 44
45 // Extend String prototype, to offer a function, that formats the d attribut e in the same way across browsers 45 // Extend String prototype, to offer a function, that formats the d attribut e in the same way across browsers
46 String.prototype.formatDAttribute = function() { 46 String.prototype.formatDAttribute = function() {
47 return this.replace(/,/g, " ") // Remove Firefox commas 47 return this.replace(/,/g, " ") // Remove Firefox commas
48 .replace(/([A-Z])/g, " $1 ") // "M 100 0L 50 0" -> " M 100 0 L 50 0" 48 .replace(/([A-Z])/g, " $1 ") // "M 100 0L 50 0" -> " M 100 0 L 50 0"
49 .replace(/^\s/, "") // " M 100 0" -> "M 100 0" 49 .replace(/^\s/, "") // " M 100 0" -> "M 100 0"
50 .replace(/\s\s/g, " "); // If there was already whitespa ce between coordinates & commands, fix it up again. 50 .replace(/\s\s/g, " "); // If there was already whitespa ce between coordinates & commands, fix it up again.
51 } 51 }
52 ]]> 52 ]]>
53 </script> 53 </script>
54 </body> 54 </body>
55 </html> 55 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698