Bug 1398038 - Add tests for extended offset syntax; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Wed, 18 Oct 2017 14:12:17 +0900
changeset 683762 67073a66a7319d7b5f7b7e246cffba9e336def6f
parent 683761 e097916729f275508a306e757925d62cb1a6cb25
child 683763 7b0b16ddc8c3ca29012441d332085a1703a3c8fc
push id85456
push userbmo:bbirtles@mozilla.com
push dateFri, 20 Oct 2017 06:31:55 +0000
reviewershiro
bugs1398038
milestone58.0a1
Bug 1398038 - Add tests for extended offset syntax; r?hiro MozReview-Commit-ID: JE2BbSBT48e
testing/web-platform/meta/web-animations/interfaces/Animatable/animate.html.ini
testing/web-platform/meta/web-animations/interfaces/KeyframeEffect/constructor.html.ini
testing/web-platform/meta/web-animations/interfaces/KeyframeEffect/setKeyframes.html.ini
testing/web-platform/tests/web-animations/resources/keyframe-tests.js
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/web-animations/interfaces/Animatable/animate.html.ini
@@ -0,0 +1,26 @@
+[animate.html]
+  type: testharness
+  [Element.animate() accepts a property-indexed keyframe with a single offset]
+    expected: FAIL
+  [Element.animate() accepts a property-indexed keyframe with an array of offsets]
+    expected: FAIL
+  [Element.animate() accepts a property-indexed keyframe with an array of offsets that is too short]
+    expected: FAIL
+  [Element.animate() accepts a property-indexed keyframe with an array of offsets that is too long]
+    expected: FAIL
+  [Element.animate() accepts a property-indexed keyframe with an array of offsets with an embedded null value]
+    expected: FAIL
+  [Element.animate() accepts a property-indexed keyframe with an array of offsets with a trailing null value]
+    expected: FAIL
+  [Element.animate() accepts a property-indexed keyframe with an array of offsets with leading and trailing null values]
+    expected: FAIL
+  [Element.animate() accepts a property-indexed keyframe with an array of offsets with adjacent null values]
+    expected: FAIL
+  [Element.animate() accepts a property-indexed keyframe with an array of offsets that is not strictly ascending in the unused part of the array]
+    expected: FAIL
+  [Element.animate() does not accept property-indexed keyframes not loosely sorted by offset]
+    expected: FAIL
+  [Element.animate() does not accept property-indexed keyframes not loosely sorted by offset even though not all offsets are specified]
+    expected: FAIL
+  [Element.animate() does not accept property-indexed keyframes with offsets out of range]
+    expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/web-animations/interfaces/KeyframeEffect/constructor.html.ini
@@ -0,0 +1,26 @@
+[constructor.html]
+  type: testharness
+  [a KeyframeEffectReadOnly can be constructed with a property-indexed keyframe with a single offset]
+    expected: FAIL
+  [a KeyframeEffectReadOnly can be constructed with a property-indexed keyframe with an array of offsets]
+    expected: FAIL
+  [a KeyframeEffectReadOnly can be constructed with a property-indexed keyframe with an array of offsets that is too short]
+    expected: FAIL
+  [a KeyframeEffectReadOnly can be constructed with a property-indexed keyframe with an array of offsets that is too long]
+    expected: FAIL
+  [a KeyframeEffectReadOnly can be constructed with a property-indexed keyframe with an array of offsets with an embedded null value]
+    expected: FAIL
+  [a KeyframeEffectReadOnly can be constructed with a property-indexed keyframe with an array of offsets with a trailing null value]
+    expected: FAIL
+  [a KeyframeEffectReadOnly can be constructed with a property-indexed keyframe with an array of offsets with leading and trailing null values]
+    expected: FAIL
+  [a KeyframeEffectReadOnly can be constructed with a property-indexed keyframe with an array of offsets with adjacent null values]
+    expected: FAIL
+  [a KeyframeEffectReadOnly can be constructed with a property-indexed keyframe with an array of offsets that is not strictly ascending in the unused part of the array]
+    expected: FAIL
+  [KeyframeEffectReadOnly constructor throws with property-indexed keyframes not loosely sorted by offset]
+    expected: FAIL
+  [KeyframeEffectReadOnly constructor throws with property-indexed keyframes not loosely sorted by offset even though not all offsets are specified]
+    expected: FAIL
+  [KeyframeEffectReadOnly constructor throws with property-indexed keyframes with offsets out of range]
+    expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/web-animations/interfaces/KeyframeEffect/setKeyframes.html.ini
@@ -0,0 +1,26 @@
+[setKeyframes.html]
+  type: testharness
+  [Keyframes can be replaced with a property-indexed keyframe with a single offset]
+    expected: FAIL
+  [Keyframes can be replaced with a property-indexed keyframe with an array of offsets]
+    expected: FAIL
+  [Keyframes can be replaced with a property-indexed keyframe with an array of offsets that is too short]
+    expected: FAIL
+  [Keyframes can be replaced with a property-indexed keyframe with an array of offsets that is too long]
+    expected: FAIL
+  [Keyframes can be replaced with a property-indexed keyframe with an array of offsets with an embedded null value]
+    expected: FAIL
+  [Keyframes can be replaced with a property-indexed keyframe with an array of offsets with a trailing null value]
+    expected: FAIL
+  [Keyframes can be replaced with a property-indexed keyframe with an array of offsets with leading and trailing null values]
+    expected: FAIL
+  [Keyframes can be replaced with a property-indexed keyframe with an array of offsets with adjacent null values]
+    expected: FAIL
+  [Keyframes can be replaced with a property-indexed keyframe with an array of offsets that is not strictly ascending in the unused part of the array]
+    expected: FAIL
+  [KeyframeEffect constructor throws with property-indexed keyframes not loosely sorted by offset]
+    expected: FAIL
+  [KeyframeEffect constructor throws with property-indexed keyframes not loosely sorted by offset even though not all offsets are specified]
+    expected: FAIL
+  [KeyframeEffect constructor throws with property-indexed keyframes with offsets out of range]
+    expected: FAIL
--- a/testing/web-platform/tests/web-animations/resources/keyframe-tests.js
+++ b/testing/web-platform/tests/web-animations/resources/keyframe-tests.js
@@ -153,16 +153,118 @@ const gKeyframesTests = [
   {
     desc:   'a one property two value property-indexed keyframes specification'
             + ' where the second value is invalid',
     input:  { left: ['10px', 'invalid'] },
     output: [keyframe(computedOffset(0), { left: '10px' }),
              keyframe(computedOffset(1), {})]
   },
 
+  // ----------- Property-indexed keyframes: offset handling -----------
+
+  {
+    desc:   'a property-indexed keyframe with a single offset',
+    input:  { left: ['10px', '20px', '30px'], offset: 0.5 },
+    output: [keyframe(offset(0.5),          { left: '10px' }),
+             keyframe(computedOffset(0.75), { left: '20px' }),
+             keyframe(computedOffset(1),    { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an array of offsets',
+    input:  { left: ['10px', '20px', '30px'], offset: [ 0.1, 0.25, 0.8 ] },
+    output: [keyframe(offset(0.1),  { left: '10px' }),
+             keyframe(offset(0.25), { left: '20px' }),
+             keyframe(offset(0.8),  { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an array of offsets that is too'
+            + ' short',
+    input:  { left: ['10px', '20px', '30px'], offset: [ 0, 0.25 ] },
+    output: [keyframe(offset(0),         { left: '10px' }),
+             keyframe(offset(0.25),      { left: '20px' }),
+             keyframe(computedOffset(1), { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an array of offsets that is too'
+            + ' long',
+    input:  { left: ['10px', '20px', '30px'],
+              offset: [ 0, 0.25, 0.5, 0.75, 1 ] },
+    output: [keyframe(offset(0),    { left: '10px' }),
+             keyframe(offset(0.25), { left: '20px' }),
+             keyframe(offset(0.5),  { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an empty array of offsets',
+    input:  { left: ['10px', '20px', '30px'], offset: [] },
+    output: [keyframe(computedOffset(0),   { left: '10px' }),
+             keyframe(computedOffset(0.5), { left: '20px' }),
+             keyframe(computedOffset(1),   { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an array of offsets with an'
+            + ' embedded null value',
+    input:  { left: ['10px', '20px', '30px'],
+              offset: [ 0, null, 0.5 ] },
+    output: [keyframe(offset(0),            { left: '10px' }),
+             keyframe(computedOffset(0.25), { left: '20px' }),
+             keyframe(offset(0.5),          { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an array of offsets with a'
+            + ' trailing null value',
+    input:  { left: ['10px', '20px', '30px'],
+              offset: [ 0, 0.25, null ] },
+    output: [keyframe(offset(0),           { left: '10px' }),
+             keyframe(offset(0.25),        { left: '20px' }),
+             keyframe(computedOffset(1), { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an array of offsets with leading'
+            + ' and trailing null values',
+    input:  { left: ['10px', '20px', '30px'],
+              offset: [ null, 0.25, null ] },
+    output: [keyframe(computedOffset(0), { left: '10px' }),
+             keyframe(offset(0.25),      { left: '20px' }),
+             keyframe(computedOffset(1), { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an array of offsets with'
+            + ' adjacent null values',
+    input:  { left: ['10px', '20px', '30px'],
+              offset: [ null, null, 0.5 ] },
+    output: [keyframe(computedOffset(0),    { left: '10px' }),
+             keyframe(computedOffset(0.25), { left: '20px' }),
+             keyframe(offset(0.5),          { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an array of offsets with'
+            + ' all null values (and too many at that)',
+    input:  { left: ['10px', '20px', '30px'],
+              offset: [ null, null, null, null, null ] },
+    output: [keyframe(computedOffset(0),   { left: '10px' }),
+             keyframe(computedOffset(0.5), { left: '20px' }),
+             keyframe(computedOffset(1),   { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with a single null offset',
+    input:  { left: ['10px', '20px', '30px'], offset: null },
+    output: [keyframe(computedOffset(0),   { left: '10px' }),
+             keyframe(computedOffset(0.5), { left: '20px' }),
+             keyframe(computedOffset(1),   { left: '30px' })],
+  },
+  {
+    desc:   'a property-indexed keyframe with an array of offsets that is not'
+            + ' strictly ascending in the unused part of the array',
+    input:  { left: ['10px', '20px', '30px'],
+              offset: [ 0, 0.2, 0.8, 0.6 ] },
+    output: [keyframe(offset(0),   { left: '10px' }),
+             keyframe(offset(0.2), { left: '20px' }),
+             keyframe(offset(0.8), { left: '30px' })],
+  },
+
   // ----------- Keyframe sequence: property handling -----------
 
   {
     desc:   'a one property one keyframe sequence',
     input:  [{ offset: 1, left: '10px' }],
     output: [keyframe(offset(1), { left: '10px' })],
   },
   {
@@ -395,16 +497,29 @@ const gInvalidKeyframesTests = [
   },
   {
     desc:  'keyframes with an out-of-bounded negative offset',
     input: [ { opacity: 0 },
              { opacity: 0.5, offset: -1 },
              { opacity: 1 } ],
   },
   {
+    desc:  'property-indexed keyframes not loosely sorted by offset',
+    input: { opacity: [ 0, 1 ], offset: [ 1, 0 ] },
+  },
+  {
+    desc:  'property-indexed keyframes not loosely sorted by offset even'
+           + ' though not all offsets are specified',
+    input: { opacity: [ 0, 0.5, 1 ], offset: [ 0.5, 0 ] },
+  },
+  {
+    desc:  'property-indexed keyframes with offsets out of range',
+    input: { opacity: [ 0, 0.5, 1 ], offset: [ 0, 1.1 ] },
+  },
+  {
     desc:  'keyframes not loosely sorted by offset',
     input: [ { opacity: 0, offset: 1 },
              { opacity: 1, offset: 0 } ],
   },
   {
     desc:  'property-indexed keyframes with an invalid easing value',
     input: { opacity: [ 0, 0.5, 1 ],
              easing: 'inherit' },