Commit 8713c42b authored by timloh@chromium.org's avatar timloh@chromium.org

Don't require getPropertyCSSValue in svg tests

As getPropertyCSSValue is no longer web-exposed we shouldn't require it
in tests so we can delete the interface.

BUG=428595

Review URL: https://codereview.chromium.org/700843006

git-svn-id: svn://svn.chromium.org/blink/trunk@185080 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3bc62e1e
......@@ -5,30 +5,30 @@ Test calcMode discrete with from-to animation on colors with alpha channel. You
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS parseAlphaFromColor() is 0.4
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS parseAlphaFromColor() is 0.6
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS parseAlphaFromColor() is 0.6
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS parseAlphaFromColor() is 0.8
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS parseAlphaFromColor() is 0.8
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS parseAlphaFromColor() is 0.4
PASS colors[0] is 0
PASS colors[1] is 255
PASS colors[2] is 255
PASS colors[3] is 0.4
PASS colors[0] is 255
PASS colors[1] is 0
PASS colors[2] is 0
PASS colors[3] is 0.6
PASS colors[0] is 255
PASS colors[1] is 0
PASS colors[2] is 0
PASS colors[3] is 0.6
PASS colors[0] is 0
PASS colors[1] is 255
PASS colors[2] is 255
PASS colors[3] is 0.8
PASS colors[0] is 0
PASS colors[1] is 255
PASS colors[2] is 255
PASS colors[3] is 0.8
PASS colors[0] is 0
PASS colors[1] is 255
PASS colors[2] is 255
PASS colors[3] is 0.4
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -9,9 +9,9 @@ PASS rect.x.animVal.value is 100
PASS rect.x.baseVal.value is 100
PASS rect.x.animVal.value is 300
PASS rect.x.animVal.value is 100
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0.8
PASS parseFloat(getComputedStyle(rect).opacity) is 0.8
PASS rect.x.animVal.value is 100
FAIL getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) should be close to 1. Was 0.800000011920929.
FAIL parseFloat(getComputedStyle(rect).opacity) should be close to 1. Was 0.800000011920929.
PASS rect.x.animVal.value is 200
PASS rect.x.baseVal.value is 100
PASS successfullyParsed is true
......
......@@ -6,12 +6,12 @@ This tests scripting a CSS property while animation is running
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0.25
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0.25
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0.5
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0.5
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0.5
PASS parseFloat(getComputedStyle(rect).opacity) is 0
PASS parseFloat(getComputedStyle(rect).opacity) is 0.25
PASS parseFloat(getComputedStyle(rect).opacity) is 0.25
PASS parseFloat(getComputedStyle(rect).opacity) is 0.5
PASS parseFloat(getComputedStyle(rect).opacity) is 0.5
PASS parseFloat(getComputedStyle(rect).opacity) is 0.5
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -6,12 +6,12 @@ This tests scripting a CSS property while animation is running
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0.25
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0.25
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0.5
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 1
PASS getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 1
PASS parseFloat(getComputedStyle(rect).opacity) is 0
PASS parseFloat(getComputedStyle(rect).opacity) is 0.25
PASS parseFloat(getComputedStyle(rect).opacity) is 0.25
PASS parseFloat(getComputedStyle(rect).opacity) is 0.5
PASS parseFloat(getComputedStyle(rect).opacity) is 1
PASS parseFloat(getComputedStyle(rect).opacity) is 1
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -21,19 +21,12 @@ animate.setAttribute("calcMode", "discrete");
rect.appendChild(animate);
rootSVGElement.appendChild(rect);
function parseAlphaFromColor() {
// As alpha is not exposed via CSS OM, we have to parse it from the color string, to be able
// to use shouldBeCloseEnough() - otherwise we can't allow tolerances, and this test is flaky.
colorString = getComputedStyle(rect).getPropertyValue('color');
return colorString.replace(/rgba.*\,/, "").replace(/\)$/, "");
}
function expectRGBAColor(red, green, blue, alpha) {
rgbColor = getComputedStyle(rect).getPropertyCSSValue('color').getRGBColorValue();
shouldBeCloseEnough("rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "" + red, 1);
shouldBeCloseEnough("rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "" + green, 1);
shouldBeCloseEnough("rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "" + blue, 1);
shouldBeCloseEnough("parseAlphaFromColor()", "" + alpha, 0.1);
colors = getComputedStyle(rect).color.replace("rgba(", "").replace(")", "").split(",");
shouldBeCloseEnough("colors[0]", "" + red, 1);
shouldBeCloseEnough("colors[1]", "" + green, 1);
shouldBeCloseEnough("colors[2]", "" + blue, 1);
shouldBeCloseEnough("colors[3]", "" + alpha, 0.1);
}
// Setup animation test
......
......@@ -40,7 +40,7 @@ function sample3() {
}
function sample4() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.8");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.8");
// change the animation to a non-CSS animatable value.
set.setAttribute("attributeName", "x");
set.setAttribute("to", "200");
......@@ -49,7 +49,7 @@ function sample4() {
function sample5() {
// verify that the animation does not run.
shouldBeCloseEnough("rect.x.animVal.value", "100");
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "1.0");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "1.0");
// change the animationType to XML which is valid.
set.setAttribute("attributeType", "XML");
}
......
......@@ -3,24 +3,24 @@ embedSVGTestCase("resources/change-css-property-while-animating-fill-freeze.svg"
// Setup animation test
function sample1() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0");
}
function sample2() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.25");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.25");
rect.setAttribute("opacity", "1");
}
function sample3() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.25");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.25");
}
function sample4() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.5");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.5");
}
function sample5() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.5");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.5");
}
function executeTest() {
......
......@@ -3,24 +3,24 @@ embedSVGTestCase("resources/change-css-property-while-animating-fill-remove.svg"
// Setup animation test
function sample1() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0");
}
function sample2() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.25");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.25");
rect.setAttribute("opacity", "1");
}
function sample3() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.25");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.25");
}
function sample4() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.5");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.5");
}
function sample5() {
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "1");
shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "1");
}
function executeTest() {
......
......@@ -26,9 +26,7 @@
if (!propertiesToTest[name])
continue;
var value = style.getPropertyValue(name);
var cssValue = style.getPropertyCSSValue(name);
debugLog(elementId + ": style.getPropertyValue(" + name + ") : " + value);
debugLog(elementId + ": style.getPropertyCSSValue(" + name + ") : " + cssValue);
}
}
......
......@@ -20,7 +20,7 @@ function parseGlyphOrientationHelper(property, angleValue, expectedValue)
if (expectedValue == "auto") {
shouldBe("computedStyle.getPropertyValue('" + property + "')", '"auto"');
} else {
shouldBe("computedStyle.getPropertyCSSValue('" + property + "').getFloatValue(CSSPrimitiveValue.CSS_DEG)", "" + expectedValue);
shouldBe("parseFloat(computedStyle.getPropertyValue('" + property + "'))", "" + expectedValue);
}
debug("");
......
......@@ -8,37 +8,17 @@
<div id="console"/>
<script><![CDATA[
SVG_NS = 'http://www.w3.org/2000/svg';
var color1, color2;
var systemColorRed, systemColorGreen, systemColorBlue;
var computedStyleText, computedStyleDiv;
function checkSystemColor(id1, id2, systemColor)
{
var textElement = document.getElementById(id1);
var computedStyleText = textElement.ownerDocument.defaultView.getComputedStyle(textElement);
computedStyleText = textElement.ownerDocument.defaultView.getComputedStyle(textElement);
var divElement = document.getElementById(id2);
var computedStyleDiv = divElement.ownerDocument.defaultView.getComputedStyle(divElement);
color1 = computedStyleText.getPropertyValue('fill');
var re = new RegExp("rgba?\\(([^, ]*), ([^, ]*), ([^, ]*)(?:, )?([^, ]*)\\)");
color1Components = re.exec(color1);
color2 = computedStyleDiv.getPropertyCSSValue('color').getRGBColorValue();
systemColorRed = color2.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
systemColorGreen = color2.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
systemColorBlue = color2.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
computedStyleDiv = divElement.ownerDocument.defaultView.getComputedStyle(divElement);
debug('Testing system color' + systemColor);
shouldBe("parseInt(color1Components[1])", "systemColorRed");
shouldBe("parseInt(color1Components[2])", "systemColorGreen");
shouldBe("parseInt(color1Components[3])", "systemColorBlue");
color1 = computedStyleText.getPropertyValue('stroke');
color1Components = re.exec(color1);
shouldBe("parseInt(color1Components[1])", "systemColorRed");
shouldBe("parseInt(color1Components[2])", "systemColorGreen");
shouldBe("parseInt(color1Components[3])", "systemColorBlue");
shouldBe("computedStyleText.fill", "computedStyleDiv.color");
shouldBe("computedStyleText.stroke", "computedStyleDiv.color");
}
description('Test that fill and stroke properties accept system colors');
......
......@@ -15,8 +15,7 @@
function checkTransformOrigin(eltID, expectedValue) {
var rect = document.getElementById(eltID);
var cssValue = window.getComputedStyle(rect, null).getPropertyCSSValue("-webkit-transform-origin");
var actualValue = (cssValue) ? cssValue.cssText : "<no value>";
var actualValue = getComputedStyle(rect).webkitTransformOrigin;
resultString += (actualValue == expectedValue) ? "PASS " : "FAIL ";
resultString += eltID + " transformOrigin, expected \"" + expectedValue + "\" actual \"" + actualValue + "\"\n";
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment