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

Unified Diff: LayoutTests/svg/animations/script-tests/animate-css-xml-attributeType.js

Issue 896773002: [svg2] Make 'x' and 'y' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: circling back towards patchset #1 again Created 5 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/animations/script-tests/animate-css-xml-attributeType.js
diff --git a/LayoutTests/svg/animations/script-tests/animate-css-xml-attributeType.js b/LayoutTests/svg/animations/script-tests/animate-css-xml-attributeType.js
index 2a3f6a3fd301e73baa90ef7eb9e503b3e23e3297..e87d52b6e35b269c74a889a82c855da18a5d9e12 100644
--- a/LayoutTests/svg/animations/script-tests/animate-css-xml-attributeType.js
+++ b/LayoutTests/svg/animations/script-tests/animate-css-xml-attributeType.js
@@ -2,61 +2,59 @@ description("Tests that XML and CSS attributeTypes can be switched between.");
createSVGTestCase();
// Setup test document
-var rect = createSVGElement("rect");
-rect.setAttribute("id", "rect");
-rect.setAttribute("x", "100");
-rect.setAttribute("width", "100");
-rect.setAttribute("height", "100");
-rect.setAttribute("fill", "green");
-rect.setAttribute("onclick", "executeTest()");
+var polygon = createSVGElement("polygon");
fs 2015/02/06 11:54:00 Land this separately so that it's obivous that the
Erik Dahlström (inactive) 2015/02/06 13:19:53 Done.
+polygon.setAttribute("id", "polygon");
+polygon.setAttribute("points", "100 0 200 0 200 100 100 100");
+polygon.setAttribute("fill", "green");
+polygon.setAttribute("onclick", "executeTest()");
var set = createSVGElement("set");
set.setAttribute("id", "set");
-set.setAttribute("attributeName", "x");
+set.setAttribute("attributeName", "points");
set.setAttribute("attributeType", "XML");
-set.setAttribute("to", "300");
+set.setAttribute("to", "300 0 400 0 400 100 300 100");
set.setAttribute("begin", "click");
-rect.appendChild(set);
-rootSVGElement.appendChild(rect);
+polygon.appendChild(set);
+rootSVGElement.appendChild(polygon);
// Setup animation test
function sample1() {
- shouldBeCloseEnough("rect.x.animVal.value", "100");
- shouldBe("rect.x.baseVal.value", "100");
+ shouldBeCloseEnough("polygon.animatedPoints.getItem(0).x", "100");
+ shouldBe("polygon.points.getItem(0).x", "100");
}
function sample2() {
- shouldBeCloseEnough("rect.x.animVal.value", "300");
+ shouldBeCloseEnough("polygon.animatedPoints.getItem(0).x", "300");
// change the animationType to CSS which is invalid.
set.setAttribute("attributeType", "CSS");
}
function sample3() {
// verify that the animation resets.
- shouldBeCloseEnough("rect.x.animVal.value", "100");
+ shouldBeCloseEnough("polygon.animatedPoints.getItem(0).x", "100");
// change the animation to a CSS animatable value.
set.setAttribute("attributeName", "opacity");
set.setAttribute("to", "0.8");
}
function sample4() {
- shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.8");
+ shouldBeCloseEnough("parseFloat(getComputedStyle(polygon).opacity)", "0.8");
// change the animation to a non-CSS animatable value.
- set.setAttribute("attributeName", "x");
- set.setAttribute("to", "200");
+ set.setAttribute("attributeName", "points");
+ set.setAttribute("to", "200 0 300 0 300 100 200 100");
}
function sample5() {
// verify that the animation does not run.
- shouldBeCloseEnough("rect.x.animVal.value", "100");
- shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "1.0");
+ shouldBeCloseEnough("polygon.animatedPoints.getItem(0).x", "100");
+ shouldBeCloseEnough("parseFloat(getComputedStyle(polygon).opacity)", "1.0");
// change the animationType to XML which is valid.
set.setAttribute("attributeType", "XML");
}
function sample6() {
- shouldBeCloseEnough("rect.x.animVal.value", "200");
- shouldBe("rect.x.baseVal.value", "100");
+ shouldBeCloseEnough("polygon.animatedPoints.getItem(0).x", "200");
+ shouldBe("polygon.points.getItem(0).x", "100");
}
function executeTest() {

Powered by Google App Engine
This is Rietveld 408576698