| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../../http/tests/inspector/elements-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 var colors = [ | 8 var colors = [ |
| 9 // Each of these is red. Some may need to be clipped to [0, 255]. | 9 // Each of these is red. Some may need to be clipped to [0, 255]. |
| 10 'red', | 10 'red', |
| 11 '#F00', | 11 '#F00', |
| 12 'rgb(255,0,0)', | 12 'rgb(255,0,0)', |
| 13 'rgb(300,0,0)', // clipped to rgb(255,0,0) | 13 'rgb(300,0,0)', // clipped to rgb(255,0,0) |
| 14 'rgb(255,-10,0)', // clipped to rgb(255,0,0) | 14 'rgb(255,-10,0)', // clipped to rgb(255,0,0) |
| 15 'rgb(110%, 0%, 0%)', // clipped to rgb(100%,0%,0%) | 15 'rgb(110%, 0%, 0%)', // clipped to rgb(100%,0%,0%) |
| 16 | 16 |
| 17 // Each of these are valid | 17 // Each of these are valid |
| 18 'rgba(0,0,0,0.5)', | 18 'rgba(0,0,0,0.5)', |
| 19 'hsl(-120, 100%, 50%)', | 19 'hsl(-120, 100%, 50%)', |
| 20 'hsl(-120, 200%, 200%)', // clipped to hsl(240,100%,100%) | 20 'hsl(-120, 200%, 200%)', // clipped to hsl(240,100%,100%) |
| 21 'hsl(-120, -200%, -200%)', // clipped to hsl(240,100%,100%) | 21 'hsl(-120, -200%, -200%)', // clipped to hsl(240,100%,100%) |
| 22 'hsla(-120, -200%, -200%, -5)', // clipped to hsla(0,0%,0%,0) | 22 'hsla(-120, -200%, -200%, -5)', // clipped to hsla(0,0%,0%,0) |
| 23 'hsla(240,100%,50%,0.05)', | 23 'hsla(240,100%,50%,0.05)', |
| 24 'hsl(200.5,0%,50%)', | 24 'hsl(200.5,0%,50%)', |
| 25 'hsla(200,1.5%,50%,1)', | 25 'hsla(200,1.5%,50%,1)', |
| 26 'rgba(0,0,0,.5)', |
| 27 'hsla(.5,.5%,.5%,.5)', |
| 28 'hsla(100.5,50.5%,50.5%,.5)', |
| 26 | 29 |
| 27 // Each of these has their alpha clipped [0.0, 1.0]. | 30 // Each of these has their alpha clipped [0.0, 1.0]. |
| 28 'rgba(255, 0, 0, -5)', // clipped to rgba(255,0,0,0) | 31 'rgba(255, 0, 0, -5)', // clipped to rgba(255,0,0,0) |
| 29 'rgba(255, 0, 0, 5)', // clipped to rgba(255,0,0,1) | 32 'rgba(255, 0, 0, 5)', // clipped to rgba(255,0,0,1) |
| 30 ]; | 33 ]; |
| 31 | 34 |
| 32 var invalidColors = [ | 35 var invalidColors = [ |
| 33 // An invalid color, eg a value for a shorthand like 'border' which can
have a color | 36 // An invalid color, eg a value for a shorthand like 'border' which can
have a color |
| 34 'none', | 37 'none', |
| 35 '#0000', | 38 '#0000', |
| 36 '#00000', | 39 '#00000', |
| 37 '#ggg', | 40 '#ggg', |
| 38 'rgb(a,b,c)', | 41 'rgb(a,b,c)', |
| 39 'rgb(a,b,c,d)', | 42 'rgb(a,b,c,d)', |
| 40 'rgb(1,1,1.2)', | 43 'rgb(1,1,1.2)', |
| 41 'rgba(0,0,0,1%)', | 44 'rgba(0,0,0,1%)', |
| 45 'rgba(0,0,0,)', |
| 42 'hsl(0,0,0)', | 46 'hsl(0,0,0)', |
| 43 'hsl(0%, 0%, 0%)', | 47 'hsl(0%, 0%, 0%)', |
| 48 'hsla(0,,0,1)', |
| 44 'hsl(0, 0%, 0)', | 49 'hsl(0, 0%, 0)', |
| 45 'hsl(a,b,c)', | 50 'hsl(a,b,c)', |
| 46 'hsla(0,0,0,0)', | 51 'hsla(0,0,0,0)', |
| 47 'hsla' | 52 'hsla' |
| 48 ]; | 53 ]; |
| 49 | 54 |
| 50 InspectorTest.runTestSuite([ | 55 InspectorTest.runTestSuite([ |
| 51 function testColors(next) | 56 function testColors(next) |
| 52 { | 57 { |
| 53 for (var i = 0; i < colors.length; ++i) | 58 for (var i = 0; i < colors.length; ++i) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 </script> | 110 </script> |
| 106 </head> | 111 </head> |
| 107 | 112 |
| 108 <body onload="runTest()"> | 113 <body onload="runTest()"> |
| 109 <p> | 114 <p> |
| 110 Tests that the displayed string for colors correctly handles clipped CSS values
and RGB percentages. | 115 Tests that the displayed string for colors correctly handles clipped CSS values
and RGB percentages. |
| 111 </p> | 116 </p> |
| 112 | 117 |
| 113 </body> | 118 </body> |
| 114 </html> | 119 </html> |
| OLD | NEW |