Bug 1259285 - Part2. Add web-platform test for visibility handling. r?birtles draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Wed, 20 Apr 2016 09:05:34 +0900
changeset 353815 d4ced7df2673a5c4a11e6f761b9ace6f652cb73f
parent 353814 85015c91ebc2f9f561825cfc5a4b7af72b27f79c
child 518892 0cbdef4acff9f438fbee0d3969ce6d3083838f59
push id15958
push usermantaroh@gmail.com
push dateWed, 20 Apr 2016 00:08:28 +0000
reviewersbirtles
bugs1259285
milestone48.0a1
Bug 1259285 - Part2. Add web-platform test for visibility handling. r?birtles MozReview-Commit-ID: JBu3wbthUp3
testing/web-platform/tests/web-animations/keyframe-effect/keyframe-handling.html
--- a/testing/web-platform/tests/web-animations/keyframe-effect/keyframe-handling.html
+++ b/testing/web-platform/tests/web-animations/keyframe-effect/keyframe-handling.html
@@ -65,11 +65,51 @@ test(function(t) {
                 + ' overlap point should be used as interval startpoint');
   anim.currentTime = 750;
   assert_equals(getComputedStyle(div).opacity, '0.85',
                 'After the overlap point, the last keyframe from the'
                 + ' overlap point should be used as interval startpoint');
 }, 'Overlapping keyframes between 0 and 1 use the appropriate value on each'
    + ' side of the overlap point');
 
+test(function(t) {
+  var div = createDiv(t);
+  var anim = div.animate({ visibility: ['hidden','visible'] },
+                         { duration: 100 * MS_PER_SEC, fill: 'both' });
+
+  anim.currentTime = 0;
+  assert_equals(getComputedStyle(div).visibility, 'hidden',
+                'Visibility when progress = 0.');
+
+  anim.currentTime = 10 * MS_PER_SEC + 1;
+  assert_equals(getComputedStyle(div).visibility, 'visible',
+                'Visibility when progress > 0 due to linear easing.');
+
+  anim.finish();
+  assert_equals(getComputedStyle(div).visibility, 'visible',
+                'Visibility when progress = 1.');
+
+}, "Test visibility clamping behavior.");
+
+test(function(t) {
+  var div = createDiv(t);
+  var anim = div.animate({ visibility: ['hidden', 'visible'] },
+                         { duration: 100 * MS_PER_SEC, fill: 'both',
+                           easing: 'cubic-bezier(0.25, -0.6, 0, 0.5)' });
+
+  anim.currentTime = 0;
+  assert_equals(getComputedStyle(div).visibility, 'hidden',
+                'Visibility when progress = 0.');
+
+  // Timing function is below zero. So we expected visibility is hidden.
+  anim.currentTime = 10 * MS_PER_SEC + 1;
+  assert_equals(getComputedStyle(div).visibility, 'hidden',
+                'Visibility when progress < 0 due to cubic-bezier easing.');
+
+  anim.currentTime = 60 * MS_PER_SEC;
+  assert_equals(getComputedStyle(div).visibility, 'visible',
+                'Visibility when progress > 0 due to cubic-bezier easing.');
+
+}, "Test visibility clamping behavior with an easing that has a negative component");
+
 done();
 </script>
 </body>