integer_interpolation_round_half_002.html (1049B)
1 <!doctype html> 2 <title>Testing if integer interpolation is rounded towards positive infinity</title> 3 <link rel="author" title="Joonghun Park" href="pjh0718@gmail.com"> 4 <link rel="help" href="https://drafts.csswg.org/css-values-4/#combine-integers"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <style> 8 9 #anim-target { 10 animation: anim-z 4s steps(4) forwards 1; 11 animation-delay: -1s; 12 animation-play-state: paused; 13 } 14 15 @keyframes anim-z { 16 from { 17 z-index: -2; 18 } 19 20 to { 21 z-index: 0; 22 } 23 } 24 25 </style> 26 <div id="anim-target"></div> 27 <script> 28 var test_description = "Integer interpolation should be rounded towards positive infinity"; 29 test( 30 t => { 31 const target = document.getElementById("anim-target"); 32 const z_index_value = Number.parseFloat(getComputedStyle(target).getPropertyValue('z-index')); 33 34 assert_equals(z_index_value, -1, "Interpolation result for z-index should be rounded towards positive infinity"); 35 }, 36 test_description 37 ); 38 </script>