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

Unified Diff: third_party/WebKit/LayoutTests/svg/animations/script-tests/animate-path-animation-cC-sS-inverse.js

Issue 1417593003: Use getAttribute in path animation tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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: third_party/WebKit/LayoutTests/svg/animations/script-tests/animate-path-animation-cC-sS-inverse.js
diff --git a/third_party/WebKit/LayoutTests/svg/animations/script-tests/animate-path-animation-cC-sS-inverse.js b/third_party/WebKit/LayoutTests/svg/animations/script-tests/animate-path-animation-cC-sS-inverse.js
index 13cfe6a59186b6de3fd090d32aeea6bacc884fc9..75c6e711276555da9ee4c48f44ba24fbe5d18084 100644
--- a/third_party/WebKit/LayoutTests/svg/animations/script-tests/animate-path-animation-cC-sS-inverse.js
+++ b/third_party/WebKit/LayoutTests/svg/animations/script-tests/animate-path-animation-cC-sS-inverse.js
@@ -4,7 +4,7 @@ createSVGTestCase();
// Setup test document
var path = createSVGElement("path");
path.setAttribute("id", "path");
-path.setAttribute("d", "M -20 -20 c 0 40 0 40 40 40 s 40 0 0 -40 z");
+path.setAttribute("d", "M -20 -20 c 0 40 0 40 40 40 s 40 0 0 -40 Z");
path.setAttribute("fill", "green");
path.setAttribute("onclick", "executeTest()");
path.setAttribute("transform", "translate(50, 50)");
@@ -12,7 +12,7 @@ path.setAttribute("transform", "translate(50, 50)");
var animate = createSVGElement("animate");
animate.setAttribute("id", "animation");
animate.setAttribute("attributeName", "d");
-animate.setAttribute("from", "M -20 -20 c 0 40 0 40 40 40 s 40 0 0 -40 z");
+animate.setAttribute("from", "M -20 -20 c 0 40 0 40 40 40 s 40 0 0 -40 Z");
animate.setAttribute("to", "M -20 -20 C 20 -20 20 -20 20 20 S 20 40 -20 20 Z");
animate.setAttribute("begin", "click");
animate.setAttribute("dur", "4s");
@@ -20,109 +20,21 @@ path.appendChild(animate);
rootSVGElement.appendChild(path);
// Setup animation test
-function checkBaseVal() {
- shouldBe("path.pathSegList.numberOfItems", "4");
- shouldBeEqualToString("path.pathSegList.getItem(0).pathSegTypeAsLetter", "M");
- shouldBe("path.pathSegList.getItem(0).x", "-20");
- shouldBe("path.pathSegList.getItem(0).y", "-20");
- shouldBeEqualToString("path.pathSegList.getItem(1).pathSegTypeAsLetter", "c");
- shouldBe("path.pathSegList.getItem(1).x", "40");
- shouldBe("path.pathSegList.getItem(1).y", "40");
- shouldBe("path.pathSegList.getItem(1).x1", "0");
- shouldBe("path.pathSegList.getItem(1).y1", "40");
- shouldBe("path.pathSegList.getItem(1).x2", "0");
- shouldBe("path.pathSegList.getItem(1).y2", "40");
- shouldBeEqualToString("path.pathSegList.getItem(2).pathSegTypeAsLetter", "s");
- shouldBe("path.pathSegList.getItem(2).x", "0");
- shouldBe("path.pathSegList.getItem(2).y", "-40");
- shouldBe("path.pathSegList.getItem(2).x2", "40");
- shouldBe("path.pathSegList.getItem(2).y2", "0");
- shouldBeEqualToString("path.pathSegList.getItem(3).pathSegTypeAsLetter", "Z");
-}
-
function sample1() {
// Check initial/end conditions
- shouldBe("path.animatedPathSegList.numberOfItems", "4");
- shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-20");
- shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "c");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "40");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "40");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "0");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "40");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x2", "0");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y2", "40");
- shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "s");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "0");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "-40");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x2", "40");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y2", "0");
- shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
- checkBaseVal();
+ shouldBeEqualToString("path.getAttribute('d')", "M -20 -20 c 0 40 0 40 40 40 s 40 0 0 -40 Z");
}
function sample2() {
- shouldBe("path.animatedPathSegList.numberOfItems", "4");
- shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-20");
- shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "c");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "40");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "40");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "10");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "30");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x2", "10");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y2", "30");
- shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "s");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-10");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "-30");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x2", "30");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y2", "5");
- shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
- checkBaseVal();
+ shouldBeEqualToString("path.getAttribute('d')", "M -20 -20 c 10 30 10 30 40 40 s 30 5 -10 -30 Z");
}
function sample3() {
- shouldBe("path.animatedPathSegList.numberOfItems", "4");
- shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-20");
- shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "C");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "10");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "-10");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x2", "10");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y2", "-10");
- shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "S");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-10");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "10");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x2", "30");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y2", "35");
- shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
- checkBaseVal();
+ shouldBeEqualToString("path.getAttribute('d')", "M -20 -20 C 10 -10 10 -10 20 20 S 30 35 -10 10 Z");
}
function sample4() {
- shouldBe("path.animatedPathSegList.numberOfItems", "4");
- shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-20");
- shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "C");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "-20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x2", "20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y2", "-20");
- shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "S");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x2", "20");
- shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y2", "40");
- shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
- checkBaseVal();
+ shouldBeEqualToString("path.getAttribute('d')", "M -20 -20 C 19.99 -19.99 19.99 -19.99 20 20 S 20.01 39.995 -19.99 19.99 Z");
}
function executeTest() {

Powered by Google App Engine
This is Rietveld 408576698