OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <meta charset="utf-8"> |
| 3 <style> |
| 4 .target { |
| 5 border: 3px solid skyblue; |
| 6 width: 100px; |
| 7 height: 100px; |
| 8 background-image: linear-gradient(to right, coral, coral); |
| 9 background-size: 20px 20px; |
| 10 background-repeat: no-repeat; |
| 11 display: inline-block; |
| 12 } |
| 13 |
| 14 .replica { |
| 15 margin-right: 10px; |
| 16 } |
| 17 </style> |
| 18 <body> |
| 19 <script src="../testharness/testharness.js"></script> |
| 20 <script src="../testharness/testharnessreport.js"></script> |
| 21 <script src="resources/interpolation-test.js"></script> |
| 22 <script> |
| 23 |
| 24 // left-top |
| 25 assertInterpolation({ |
| 26 property: 'background-position', |
| 27 from: 'center center', |
| 28 to: 'left 20px top 20px', |
| 29 }, [ |
| 30 {at: 0, is: 'center center'}, |
| 31 {at: 0.25, is: 'calc(37.5% + 5px) calc(37.5% + 5px)'}, |
| 32 {at: 0.50, is: 'calc(25% + 10px) calc(25% + 10px)'}, |
| 33 {at: 0.75, is: 'calc(12.5% + 15px) calc(12.5% + 15px)'}, |
| 34 {at: 1, is: 'left 20px top 20px'}, |
| 35 ]); |
| 36 |
| 37 // center-top |
| 38 assertInterpolation({ |
| 39 property: 'background-position', |
| 40 from: 'center center', |
| 41 to: 'center top 20px', |
| 42 }, [ |
| 43 {at: 0, is: 'center center'}, |
| 44 {at: 0.25, is: '50% calc(37.5% + 5px)'}, |
| 45 {at: 0.50, is: '50% calc(25% + 10px)'}, |
| 46 {at: 0.75, is: '50% calc(12.5% + 15px)'}, |
| 47 {at: 1, is: 'center top 20px'}, |
| 48 ]); |
| 49 |
| 50 // right-top |
| 51 assertInterpolation({ |
| 52 property: 'background-position', |
| 53 from: 'center center', |
| 54 to: 'right 20px top 20px', |
| 55 }, [ |
| 56 {at: 0, is: 'center center'}, |
| 57 {at: 0.25, is: 'calc(37.5% + ((100% - 20px) * 0.25)) calc(37.5% + 5px)'}, |
| 58 {at: 0.50, is: 'calc(25% + ((100% - 20px) * 0.5)) calc(25% + 10px)'}, |
| 59 {at: 0.75, is: 'calc(12.5% + ((100% - 20px) * 0.75)) calc(12.5% + 15px)'}, |
| 60 {at: 1, is: 'right 20px top 20px'}, |
| 61 ]); |
| 62 |
| 63 // left-center |
| 64 assertInterpolation({ |
| 65 property: 'background-position', |
| 66 from: 'center center', |
| 67 to: 'left 20px center', |
| 68 }, [ |
| 69 {at: 0, is: 'center center'}, |
| 70 {at: 0.25, is: 'calc(37.5% + 5px) 50%'}, |
| 71 {at: 0.50, is: 'calc(25% + 10px) 50%'}, |
| 72 {at: 0.75, is: 'calc(12.5% + 15px) 50%'}, |
| 73 {at: 1, is: 'left 20px center'}, |
| 74 ]); |
| 75 |
| 76 // center-center |
| 77 assertInterpolation({ |
| 78 property: 'background-position', |
| 79 from: 'center center', |
| 80 to: 'center center', |
| 81 }, [ |
| 82 {at: 0, is: 'center center'}, |
| 83 {at: 0.25, is: '50% 50%'}, |
| 84 {at: 0.50, is: '50% 50%'}, |
| 85 {at: 0.75, is: '50% 50%'}, |
| 86 {at: 1, is: 'center center'} |
| 87 ]); |
| 88 |
| 89 // right-center |
| 90 assertInterpolation({ |
| 91 property: 'background-position', |
| 92 from: 'center center', |
| 93 to: 'right 20px center', |
| 94 }, [ |
| 95 {at: 0, is: 'center center'}, |
| 96 {at: 0.25, is: 'calc(37.5% + ((100% - 20px) * 0.25)) 50%'}, |
| 97 {at: 0.50, is: 'calc(25% + ((100% - 20px) * 0.5)) 50%'}, |
| 98 {at: 0.75, is: 'calc(12.5% + ((100% - 20px) * 0.75)) 50%'}, |
| 99 {at: 1, is: 'right 20px center'}, |
| 100 ]); |
| 101 |
| 102 // left-bottom |
| 103 assertInterpolation({ |
| 104 property: 'background-position', |
| 105 from: 'center center', |
| 106 to: 'left 20px bottom 20px', |
| 107 }, [ |
| 108 {at: 0, is: 'center center'}, |
| 109 {at: 0.25, is: 'calc(37.5% + 5px) calc(37.5% + ((100% - 20px) * 0.25))'}, |
| 110 {at: 0.50, is: 'calc(25% + 10px) calc(25% + ((100% - 20px) * 0.5))'}, |
| 111 {at: 0.75, is: 'calc(12.5% + 15px) calc(12.5% + ((100% - 20px) * 0.75))'}, |
| 112 {at: 1, is: 'left 20px bottom 20px'}, |
| 113 ]); |
| 114 |
| 115 // center-bottom |
| 116 assertInterpolation({ |
| 117 property: 'background-position', |
| 118 from: 'center center', |
| 119 to: 'center bottom 20px', |
| 120 }, [ |
| 121 {at: 0, is: 'center center'}, |
| 122 {at: 0.25, is: '50% calc(37.5% + ((100% - 20px) * 0.25))'}, |
| 123 {at: 0.50, is: '50% calc(25% + ((100% - 20px) * 0.5))'}, |
| 124 {at: 0.75, is: '50% calc(12.5% + ((100% - 20px) * 0.75))'}, |
| 125 {at: 1, is: 'center bottom 20px'}, |
| 126 ]); |
| 127 |
| 128 // right-bottom |
| 129 assertInterpolation({ |
| 130 property: 'background-position', |
| 131 from: 'center center', |
| 132 to: 'right 20px bottom 20px', |
| 133 }, [ |
| 134 {at: 0, is: 'center center'}, |
| 135 {at: 0.25, is: 'calc(37.5% + ((100% - 20px) * 0.25)) calc(37.5% + ((100% - 2
0px) * 0.25))'}, |
| 136 {at: 0.50, is: 'calc(25% + ((100% - 20px) * 0.5)) calc(25% + ((100% - 20px)
* 0.5))'}, |
| 137 {at: 0.75, is: 'calc(12.5% + ((100% - 20px) * 0.75)) calc(12.5% + ((100% - 2
0px) * 0.75))'}, |
| 138 {at: 1, is: 'right 20px bottom 20px'}, |
| 139 ]); |
| 140 |
| 141 </script> |
| 142 </body> |
OLD | NEW |