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

Unified Diff: LayoutTests/svg/animations/script-tests/animate-color-rgba-calcMode-discrete.js

Issue 700843006: Don't require getPropertyCSSValue in svg tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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-color-rgba-calcMode-discrete.js
diff --git a/LayoutTests/svg/animations/script-tests/animate-color-rgba-calcMode-discrete.js b/LayoutTests/svg/animations/script-tests/animate-color-rgba-calcMode-discrete.js
index 1e92e32f1c94067e04035f0903719295c863a6aa..aab0ecc71790fd091c83bb4985a5b45f27262e0b 100644
--- a/LayoutTests/svg/animations/script-tests/animate-color-rgba-calcMode-discrete.js
+++ b/LayoutTests/svg/animations/script-tests/animate-color-rgba-calcMode-discrete.js
@@ -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

Powered by Google App Engine
This is Rietveld 408576698