background-size-composition.html (3439B)
1 <!DOCTYPE html> 2 <meta charset="UTF-8"> 3 <title>background-size composition</title> 4 <link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-size"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/css/support/interpolation-testcommon.js"></script> 8 <style> 9 .target { 10 background-image: url(), url(); 11 } 12 </style> 13 <body> 14 <script> 15 test_composition({ 16 property: 'background-size', 17 underlying: '40px 40px', 18 addFrom: '60px 60px, 260px 260px', 19 addTo: '160px 160px', 20 }, [ 21 {at: -0.25, expect: '75px 75px, 325px 325px'}, 22 {at: 0, expect: '100px 100px, 300px 300px'}, 23 {at: 0.25, expect: '125px 125px, 275px 275px'}, 24 {at: 0.5, expect: '150px 150px, 250px 250px'}, 25 {at: 0.75, expect: '175px 175px, 225px 225px'}, 26 {at: 1, expect: '200px 200px, 200px 200px'}, 27 {at: 1.25, expect: '225px 225px, 175px 175px'}, 28 ]); 29 30 test_composition({ 31 property: 'background-size', 32 underlying: '20% 40%', 33 addFrom: '40px 80px, 180% 160%', 34 addTo: '80% 40%', 35 }, [ 36 {at: -0.25, expect: 'calc(50px + 0%) calc(100px + 30%), 225% 230%'}, 37 {at: 0, expect: 'calc(40px + 20%) calc(80px + 40%), 200% 200%'}, 38 {at: 0.25, expect: 'calc(30px + 40%) calc(60px + 50%), 175% 170%'}, 39 {at: 0.5, expect: 'calc(20px + 60%) calc(40px + 60%), 150% 140%'}, 40 {at: 0.75, expect: 'calc(10px + 80%) calc(20px + 70%), 125% 110%'}, 41 {at: 1, expect: '100% 80%, 100% 80%'}, 42 {at: 1.25, expect: 'calc(-10px + 120%) calc(-20px + 90%), 75% 50%'}, 43 ]); 44 45 test_composition({ 46 property: 'background-size', 47 underlying: '40px 40px', 48 replaceFrom: '100px 100px', 49 addTo: '160px 160px', 50 }, [ 51 {at: -0.25, expect: '75px 75px, 75px 75px'}, 52 {at: 0, expect: '100px 100px, 100px 100px'}, 53 {at: 0.25, expect: '125px 125px, 125px 125px'}, 54 {at: 0.5, expect: '150px 150px, 150px 150px'}, 55 {at: 0.75, expect: '175px 175px, 175px 175px'}, 56 {at: 1, expect: '200px 200px, 200px 200px'}, 57 {at: 1.25, expect: '225px 225px, 225px 225px'}, 58 ]); 59 60 test_composition({ 61 property: 'background-size', 62 underlying: '40px 40px', 63 addFrom: '60px 60px', 64 replaceTo: '200px 200px', 65 }, [ 66 {at: -0.25, expect: '75px 75px, 75px 75px'}, 67 {at: 0, expect: '100px 100px, 100px 100px'}, 68 {at: 0.25, expect: '125px 125px, 125px 125px'}, 69 {at: 0.5, expect: '150px 150px, 150px 150px'}, 70 {at: 0.75, expect: '175px 175px, 175px 175px'}, 71 {at: 1, expect: '200px 200px, 200px 200px'}, 72 {at: 1.25, expect: '225px 225px, 225px 225px'}, 73 ]); 74 75 test_composition({ 76 property: 'background-size', 77 underlying: 'auto, contain', 78 addFrom: '100px 150px', 79 replaceTo: '200px 250px', 80 }, [ 81 {at: -0.25, expect: '75px 125px, 75px 125px'}, 82 {at: 0, expect: '100px 150px, 100px 150px'}, 83 {at: 0.25, expect: '125px 175px, 125px 175px'}, 84 {at: 0.5, expect: '150px 200px, 150px 200px'}, 85 {at: 0.75, expect: '175px 225px, 175px 225px'}, 86 {at: 1, expect: '200px 250px, 200px 250px'}, 87 {at: 1.25, expect: '225px 275px, 225px 275px'}, 88 ]); 89 90 test_composition({ 91 property: 'background-size', 92 underlying: 'auto 100px, contain', 93 addFrom: neutralKeyframe, 94 replaceTo: 'auto 200px, contain', 95 }, [ 96 {at: -0.25, expect: 'auto 75px, contain'}, 97 {at: 0, expect: 'auto 100px, contain'}, 98 {at: 0.25, expect: 'auto 125px, contain'}, 99 {at: 0.5, expect: 'auto 150px, contain'}, 100 {at: 0.75, expect: 'auto 175px, contain'}, 101 {at: 1, expect: 'auto 200px, contain'}, 102 {at: 1.25, expect: 'auto 225px, contain'}, 103 ]); 104 </script> 105 </body>