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

Side by Side Diff: LayoutTests/svg/animations/resources/SVGAnimationTestCase.js

Issue 114373004: Remove the SVGColor and SVGPaint DOM interfaces (were deprecated). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: text diff fix Created 7 years 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
OLDNEW
1 // Inspired by Layoutests/animations/animation-test-helpers.js 1 // Inspired by Layoutests/animations/animation-test-helpers.js
2 // Modified to work with SVG and together with LayoutTests/svg/dynamic-updates/r esources/SVGTestCase.js 2 // Modified to work with SVG and together with LayoutTests/svg/dynamic-updates/r esources/SVGTestCase.js
3 3
4 function isCloseEnough(actual, desired, tolerance) { 4 function isCloseEnough(actual, desired, tolerance) {
5 var diff = Math.abs(actual - desired); 5 var diff = Math.abs(actual - desired);
6 return diff <= tolerance; 6 return diff <= tolerance;
7 } 7 }
8 8
9 function shouldBeCloseEnough(_a, _b, tolerance) { 9 function shouldBeCloseEnough(_a, _b, tolerance) {
10 if (typeof tolerance != "number") 10 if (typeof tolerance != "number")
(...skipping 28 matching lines...) Expand all
39 shouldBeCloseEnough(actualMatrix + ".f", expectedF, tolerance); 39 shouldBeCloseEnough(actualMatrix + ".f", expectedF, tolerance);
40 } 40 }
41 41
42 function expectTranslationMatrix(actualMatrix, expectedE, expectedF, tolerance) { 42 function expectTranslationMatrix(actualMatrix, expectedE, expectedF, tolerance) {
43 shouldBeCloseEnough(actualMatrix + ".e", expectedE, tolerance); 43 shouldBeCloseEnough(actualMatrix + ".e", expectedE, tolerance);
44 shouldBeCloseEnough(actualMatrix + ".f", expectedF, tolerance); 44 shouldBeCloseEnough(actualMatrix + ".f", expectedF, tolerance);
45 } 45 }
46 46
47 function expectColor(element, red, green, blue, property) { 47 function expectColor(element, red, green, blue, property) {
48 if (typeof property != "string") 48 if (typeof property != "string")
49 color = getComputedStyle(element).getPropertyCSSValue("color").getRGBCol orValue(); 49 color = getComputedStyle(element).getPropertyValue("color");
50 else { 50 else
51 fillPaint = getComputedStyle(element).getPropertyCSSValue(property); 51 color = getComputedStyle(element).getPropertyValue(property);
52 color = getComputedStyle(element).getPropertyCSSValue(property).rgbColor ; 52
53 } 53 var re = new RegExp("rgba?\\(([^, ]*), ([^, ]*), ([^, ]*)(?:, )?([^, ]*)\\)" );
54 colorComponents = re.exec(color);
54 55
55 // Allow a tolerance of 1 for color values, as they are integers. 56 // Allow a tolerance of 1 for color values, as they are integers.
56 shouldBeCloseEnough("color.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "" + red, 1); 57 shouldBeCloseEnough("colorComponents[1]", "" + red, 1);
57 shouldBeCloseEnough("color.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) ", "" + green, 1); 58 shouldBeCloseEnough("colorComponents[2]", "" + green, 1);
58 shouldBeCloseEnough("color.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)" , "" + blue, 1); 59 shouldBeCloseEnough("colorComponents[3]", "" + blue, 1);
59 } 60 }
60 61
61 function expectFillColor(element, red, green, blue) { 62 function expectFillColor(element, red, green, blue) {
62 expectColor(element, red, green, blue, "fill"); 63 expectColor(element, red, green, blue, "fill");
63 } 64 }
64 65
65 function moveAnimationTimelineAndSample(index) { 66 function moveAnimationTimelineAndSample(index) {
66 var animationId = expectedResults[index][0]; 67 var animationId = expectedResults[index][0];
67 var time = expectedResults[index][1]; 68 var time = expectedResults[index][1];
68 var sampleCallback = expectedResults[index][2]; 69 var sampleCallback = expectedResults[index][2];
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 135 }
135 136
136 // Pause animations, we'll drive them manually. 137 // Pause animations, we'll drive them manually.
137 rootSVGElement.pauseAnimations(); 138 rootSVGElement.pauseAnimations();
138 139
139 if (window.testRunner) 140 if (window.testRunner)
140 setTimeout(sampleAnimation, 0); 141 setTimeout(sampleAnimation, 0);
141 else 142 else
142 setTimeout(sampleAnimation, 50); 143 setTimeout(sampleAnimation, 50);
143 } 144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698