Bug 1369614 - Add stroke length type wpt. r?hiro draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Fri, 21 Jul 2017 19:19:55 +0900
changeset 612997 400e4acb582c77180ce45be7ce0328e52fd16e13
parent 612996 23519079cba0f75e479b248d42993df47f361bf0
child 638571 bb704373573a9c835d06246702eebddbb251b334
push id69678
push userbmo:mantaroh@gmail.com
push dateFri, 21 Jul 2017 10:20:49 +0000
reviewershiro
bugs1369614
milestone56.0a1
Bug 1369614 - Add stroke length type wpt. r?hiro MozReview-Commit-ID: EIY4tLNHQIk
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/web-animations/animation-model/animation-types/property-list.js
testing/web-platform/tests/web-animations/animation-model/animation-types/property-types.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -220358,17 +220358,17 @@
    "55100f7d505bc8cbc966ced0d1337ed78534a553",
    "testharness"
   ],
   "web-animations/animation-model/animation-types/property-list.js": [
    "31ad7b4aa12e4485f95545b087779cabb56c696c",
    "support"
   ],
   "web-animations/animation-model/animation-types/property-types.js": [
-   "750c9270292478d09cf176a5e489043a6707e726",
+   "2dd0c93e02c6e3a144281b604e8a1a265c031e2e",
    "support"
   ],
   "web-animations/animation-model/combining-effects/effect-composition.html": [
    "8ac06085132d822e908d48de4c1109b66323f19f",
    "testharness"
   ],
   "web-animations/animation-model/keyframe-effects/effect-value-context.html": [
    "10d9ee521240475a1729c2facfcea8b50342614e",
--- a/testing/web-platform/tests/web-animations/animation-model/animation-types/property-list.js
+++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/property-list.js
@@ -1233,18 +1233,17 @@ var gCSSProperties = {
     // https://svgwg.org/svg2-draft/painting.html#StrokeDasharrayProperty
     types: [
       'dasharray',
       { type: 'discrete', options: [ [ 'none', '10, 20' ] ] }
     ]
   },
   'stroke-dashoffset': {
     // https://svgwg.org/svg2-draft/painting.html#StrokeDashoffsetProperty
-    types: [
-    ]
+    types: [ 'strokeLength' ]
   },
   'stroke-linecap': {
     // https://svgwg.org/svg2-draft/painting.html#StrokeLinecapProperty
     types: [
       { type: 'discrete', options: [ [ 'round', 'square' ] ] }
     ]
   },
   'stroke-linejoin': {
@@ -1261,18 +1260,17 @@ var gCSSProperties = {
     types: [ 'positiveNumber' ]
   },
   'stroke-opacity': {
     // https://svgwg.org/svg2-draft/painting.html#StrokeOpacityProperty
     types: [ 'opacity' ]
   },
   'stroke-width': {
     // https://svgwg.org/svg2-draft/painting.html#StrokeWidthProperty
-    types: [
-    ]
+    types: [ 'strokeLength' ]
   },
   'table-layout': {
     // https://drafts.csswg.org/css-tables/#propdef-table-layout
     types: [
       { type: 'discrete', options: [ [ 'auto', 'fixed' ] ] }
     ]
   },
   'text-align': {
--- a/testing/web-platform/tests/web-animations/animation-model/animation-types/property-types.js
+++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/property-types.js
@@ -1707,16 +1707,54 @@ const rectType = {
     this.testAdditionOrAccumulation(property, setup, 'add');
   },
 
   testAccumulation: function(property, setup) {
     this.testAdditionOrAccumulation(property, setup, 'accumulate');
   },
 }
 
+// stroke-width / stroke-dashoffset: <percentage> | <length> | <number> | inherit
+const strokeLengthType = {
+  testInterpolation: function(property, setup) {
+    percentageType.testInterpolation(property, setup);
+
+    test(function(t) {
+      var idlName = propertyToIDL(property);
+      var target = createTestElement(t, setup);
+      var animation = target.animate({ [idlName]: [1.1, 1.5] },
+                                     { duration: 1000, fill: 'both' });
+      testAnimationSamples(animation, idlName,
+                           [{ time: 500,  expected: '1.3' }]);
+    }, property + ' supports animating as a positive number');
+  },
+
+  testAdditionOrAccumulation: function(property, setup, composite) {
+    test(function(t) {
+      var idlName = propertyToIDL(property);
+      var target = createTestElement(t, setup);
+      target.style[idlName] = 5;
+      var animation = target.animate({ [idlName]: [1, 2] },
+                                     { duration: 1000, composite: composite });
+      testAnimationSamples(
+        animation, idlName,
+        [{ time: 0, expected: '6' }]);
+    }, property + ': supports animating as positive number with ' +
+       composite + ' composite');
+  },
+
+  testAddition: function(property, setup) {
+    this.testAdditionOrAccumulation(property, setup, 'add');
+  },
+
+  testAccumulation: function(property, setup) {
+    this.testAdditionOrAccumulation(property, setup, 'accumulate');
+  },
+}
+
 // stroke-dasharray: none | [ <length> | <percentage> | <number> ]*
 const dasharrayType = {
   testInterpolation: function(property, setup) {
     percentageType.testInterpolation(property, setup);
     positiveNumberType.testInterpolation(property, setup);
 
     test(function(t) {
       var idlName = propertyToIDL(property);
@@ -1834,10 +1872,11 @@ const types = {
   transformList: transformListType,
   visibility: visibilityType,
   boxShadowList: boxShadowListType,
   textShadowList: textShadowListType,
   rect: rectType,
   position: positionType,
   dasharray: dasharrayType,
   fontStretch: fontStretchType,
+  strokeLength: strokeLengthType,
 };