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

Side by Side Diff: third_party/WebKit/LayoutTests/animations/svg-attribute-interpolation/resources/interpolation-test.js

Issue 1419733009: Web Animations: Add SVGNumberListInterpolationType (Closed) Base URL: ssh://pony.syd/usr/local/google/home/alancutter/repos/chromium/src@_svgRectInterpolationType
Patch Set: Fix responsive test derp Created 5 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 /* Copyright 2015 The Chromium Authors. All rights reserved. 1 /* Copyright 2015 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 * 4 *
5 * Exported function: 5 * Exported function:
6 * - assertAttributeInterpolation({property, from, to, [fromComposite], [toComp osite], [underlying]}, [{at: fraction, is: value}]) 6 * - assertAttributeInterpolation({property, from, to, [fromComposite], [toComp osite], [underlying]}, [{at: fraction, is: value}])
7 * Constructs a test case for each fraction that asserts the expected val ue 7 * Constructs a test case for each fraction that asserts the expected val ue
8 * equals the value produced by interpolation between from and to composi ted 8 * equals the value produced by interpolation between from and to composi ted
9 * onto underlying by fromComposite and toComposite respectively using 9 * onto underlying by fromComposite and toComposite respectively using
10 * SMIL and Web Animations. 10 * SMIL and Web Animations.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 112
113 function serializeSVGLengthList(numberList) { 113 function serializeSVGLengthList(numberList) {
114 var elements = []; 114 var elements = [];
115 for (var index = 0; index < numberList.numberOfItems; ++index) 115 for (var index = 0; index < numberList.numberOfItems; ++index)
116 elements.push(numberList.getItem(index).value); 116 elements.push(numberList.getItem(index).value);
117 return String(elements); 117 return String(elements);
118 } 118 }
119 119
120 function serializeSVGNumberList(numberList) { 120 function serializeSVGNumberList(numberList) {
121 var elements = []; 121 return Array.from(numberList).map(number => number.value).join(', ');
122 for (var index = 0; index < numberList.numberOfItems; ++index)
123 elements.push(numberList.getItem(index).value);
124 return String(elements);
125 } 122 }
126 123
127 function serializeSVGPointList(pointList) { 124 function serializeSVGPointList(pointList) {
128 var elements = []; 125 var elements = [];
129 for (var index = 0; index < pointList.numberOfItems; ++index) { 126 for (var index = 0; index < pointList.numberOfItems; ++index) {
130 var point = pointList.getItem(index); 127 var point = pointList.getItem(index);
131 elements.push(point.x); 128 elements.push(point.x);
132 elements.push(point.y); 129 elements.push(point.y);
133 } 130 }
134 return String(elements); 131 return String(elements);
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 assertionCode += 394 assertionCode +=
398 ` from: '${params.from}',\n` + 395 ` from: '${params.from}',\n` +
399 ` fromComposite: '${params.fromComposite}',\n`; 396 ` fromComposite: '${params.fromComposite}',\n`;
400 } 397 }
401 398
402 if (isNeutralKeyframe(params.to)) { 399 if (isNeutralKeyframe(params.to)) {
403 assertionCode += ` to: neutralKeyframe,\n`; 400 assertionCode += ` to: neutralKeyframe,\n`;
404 } else { 401 } else {
405 assertionCode += 402 assertionCode +=
406 ` to: '${params.to}',\n` + 403 ` to: '${params.to}',\n` +
407 ` fromComposite: '${params.fromComposite}',\n`; 404 ` toComposite: '${params.toComposite}',\n`;
408 } 405 }
409 406
410 assertionCode += `\n}, [\n`; 407 assertionCode += `}, [\n`;
411 408
412 rebaseline.appendChild(document.createTextNode(assertionCode)); 409 rebaseline.appendChild(document.createTextNode(assertionCode));
413 var rebaselineExpectation = document.createTextNode(''); 410 var rebaselineExpectation = document.createTextNode('');
414 rebaseline.appendChild(rebaselineExpectation); 411 rebaseline.appendChild(rebaselineExpectation);
415 rebaseline.appendChild(document.createTextNode(']);\n\n')); 412 rebaseline.appendChild(document.createTextNode(']);\n\n'));
416 } 413 }
417 414
418 for (var method of ['SMIL', 'Web Animations']) { 415 for (var method of ['SMIL', 'Web Animations']) {
419 if (method === 'SMIL' && params.fromComposite !== params.toComposite) { 416 if (method === 'SMIL' && params.fromComposite !== params.toComposite) {
420 continue; 417 continue;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 }).then(() => { 468 }).then(() => {
472 var asyncHandle = async_test('This test uses interpolation-test.js.') 469 var asyncHandle = async_test('This test uses interpolation-test.js.')
473 requestAnimationFrame(() => { 470 requestAnimationFrame(() => {
474 runTests().then(() => asyncHandle.done()); 471 runTests().then(() => asyncHandle.done());
475 }); 472 });
476 }); 473 });
477 474
478 window.assertAttributeInterpolation = assertAttributeInterpolation; 475 window.assertAttributeInterpolation = assertAttributeInterpolation;
479 window.neutralKeyframe = neutralKeyframe; 476 window.neutralKeyframe = neutralKeyframe;
480 })(); 477 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698