OLD | NEW |
1 description("Test rgba() color parsing results"); | 1 description("Test rgba() color parsing results"); |
2 | 2 |
3 var ctx = document.createElement('canvas').getContext('2d'); | 3 var ctx = document.createElement('canvas').getContext('2d'); |
4 | 4 |
5 function parse(rgba) { | 5 function parse(rgba) { |
6 ctx.globalCompositeOperation = 'copy'; | 6 ctx.globalCompositeOperation = 'copy'; |
7 ctx.fillStyle = '#666'; | 7 ctx.fillStyle = '#666'; |
8 ctx.fillStyle = rgba; | 8 ctx.fillStyle = rgba; |
9 ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); | 9 ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); |
10 var idata = ctx.getImageData(0, 0, 1, 1); | 10 var idata = ctx.getImageData(0, 0, 1, 1); |
(...skipping 21 matching lines...) Expand all Loading... |
32 shouldBe("parse('rgba(0, 0, 0, -0.10)')", "'RGBA[0, 0, 0, 0]'"); | 32 shouldBe("parse('rgba(0, 0, 0, -0.10)')", "'RGBA[0, 0, 0, 0]'"); |
33 shouldBe("parse('rgba(0, 0, 0, -5.0)')", "'RGBA[0, 0, 0, 0]'"); | 33 shouldBe("parse('rgba(0, 0, 0, -5.0)')", "'RGBA[0, 0, 0, 0]'"); |
34 shouldBe("parse('rgba(0, 0, 0, 5.0)')", "'RGBA[0, 0, 0, 255]'"); | 34 shouldBe("parse('rgba(0, 0, 0, 5.0)')", "'RGBA[0, 0, 0, 255]'"); |
35 shouldBe("parse('rgba(0, 0, 0, -1)')", "'RGBA[0, 0, 0, 0]'"); | 35 shouldBe("parse('rgba(0, 0, 0, -1)')", "'RGBA[0, 0, 0, 0]'"); |
36 shouldBe("parse('rgba(0, 0, 0, 0)')", "'RGBA[0, 0, 0, 0]'"); | 36 shouldBe("parse('rgba(0, 0, 0, 0)')", "'RGBA[0, 0, 0, 0]'"); |
37 shouldBe("parse('rgba(0, 0, 0, 2)')", "'RGBA[0, 0, 0, 255]'"); | 37 shouldBe("parse('rgba(0, 0, 0, 2)')", "'RGBA[0, 0, 0, 255]'"); |
38 shouldBe("parse('rgba(0, 0, 0, 2.0)')", "'RGBA[0, 0, 0, 255]'"); | 38 shouldBe("parse('rgba(0, 0, 0, 2.0)')", "'RGBA[0, 0, 0, 255]'"); |
39 shouldBe("parse('rgba(0, 0, 0, 0.0)')", "'RGBA[0, 0, 0, 0]'"); | 39 shouldBe("parse('rgba(0, 0, 0, 0.0)')", "'RGBA[0, 0, 0, 0]'"); |
40 shouldBe("parse('rgba(0, 0, 0, 00.0)')", "'RGBA[0, 0, 0, 0]'"); | 40 shouldBe("parse('rgba(0, 0, 0, 00.0)')", "'RGBA[0, 0, 0, 0]'"); |
41 shouldBe("parse('rgba(0, 0, 0, 0.00)')", "'RGBA[0, 0, 0, 0]'"); | 41 shouldBe("parse('rgba(0, 0, 0, 0.00)')", "'RGBA[0, 0, 0, 0]'"); |
42 shouldBe("parse('rgba(0, 0, 0, .1)')", "'RGBA[0, 0, 0, 25]'"); | 42 shouldBe("parse('rgba(0, 0, 0, .1)')", "'RGBA[0, 0, 0, 26]'"); |
43 shouldBe("parse('rgba(0, 0, 0, .2)')", "'RGBA[0, 0, 0, 51]'"); | 43 shouldBe("parse('rgba(0, 0, 0, .2)')", "'RGBA[0, 0, 0, 51]'"); |
44 shouldBe("parse('rgba(0, 0, 0, .3)')", "'RGBA[0, 0, 0, 76]'"); | 44 shouldBe("parse('rgba(0, 0, 0, .3)')", "'RGBA[0, 0, 0, 77]'"); |
45 shouldBe("parse('rgba(0, 0, 0, .4)')", "'RGBA[0, 0, 0, 102]'"); | 45 shouldBe("parse('rgba(0, 0, 0, .4)')", "'RGBA[0, 0, 0, 102]'"); |
46 shouldBe("parse('rgba(0, 0, 0, .5)')", "'RGBA[0, 0, 0, 127]'"); | 46 shouldBe("parse('rgba(0, 0, 0, .5)')", "'RGBA[0, 0, 0, 128]'"); |
47 shouldBe("parse('rgba(0, 0, 0, .6)')", "'RGBA[0, 0, 0, 153]'"); | 47 shouldBe("parse('rgba(0, 0, 0, .6)')", "'RGBA[0, 0, 0, 153]'"); |
48 shouldBe("parse('rgba(0, 0, 0, .7)')", "'RGBA[0, 0, 0, 179]'"); | 48 shouldBe("parse('rgba(0, 0, 0, .7)')", "'RGBA[0, 0, 0, 179]'"); |
49 shouldBe("parse('rgba(0, 0, 0, .8)')", "'RGBA[0, 0, 0, 204]'"); | 49 shouldBe("parse('rgba(0, 0, 0, .8)')", "'RGBA[0, 0, 0, 204]'"); |
50 shouldBe("parse('rgba(0, 0, 0, .9)')", "'RGBA[0, 0, 0, 230]'"); | 50 shouldBe("parse('rgba(0, 0, 0, .9)')", "'RGBA[0, 0, 0, 230]'"); |
51 shouldBe("parse('rgba(0, 0, 0, 0.1)')", "'RGBA[0, 0, 0, 25]'"); | 51 shouldBe("parse('rgba(0, 0, 0, 0.1)')", "'RGBA[0, 0, 0, 26]'"); |
52 shouldBe("parse('rgba(0, 0, 0, 0.2)')", "'RGBA[0, 0, 0, 51]'"); | 52 shouldBe("parse('rgba(0, 0, 0, 0.2)')", "'RGBA[0, 0, 0, 51]'"); |
53 shouldBe("parse('rgba(0, 0, 0, 0.3)')", "'RGBA[0, 0, 0, 76]'"); | 53 shouldBe("parse('rgba(0, 0, 0, 0.3)')", "'RGBA[0, 0, 0, 77]'"); |
54 shouldBe("parse('rgba(0, 0, 0, 0.4)')", "'RGBA[0, 0, 0, 102]'"); | 54 shouldBe("parse('rgba(0, 0, 0, 0.4)')", "'RGBA[0, 0, 0, 102]'"); |
55 shouldBe("parse('rgba(0, 0, 0, 0.5)')", "'RGBA[0, 0, 0, 127]'"); | 55 shouldBe("parse('rgba(0, 0, 0, 0.5)')", "'RGBA[0, 0, 0, 128]'"); |
56 shouldBe("parse('rgba(0, 0, 0, 0.6)')", "'RGBA[0, 0, 0, 153]'"); | 56 shouldBe("parse('rgba(0, 0, 0, 0.6)')", "'RGBA[0, 0, 0, 153]'"); |
57 shouldBe("parse('rgba(0, 0, 0, 0.7)')", "'RGBA[0, 0, 0, 179]'"); | 57 shouldBe("parse('rgba(0, 0, 0, 0.7)')", "'RGBA[0, 0, 0, 179]'"); |
58 shouldBe("parse('rgba(0, 0, 0, 0.8)')", "'RGBA[0, 0, 0, 204]'"); | 58 shouldBe("parse('rgba(0, 0, 0, 0.8)')", "'RGBA[0, 0, 0, 204]'"); |
59 shouldBe("parse('rgba(0, 0, 0, 0.9)')", "'RGBA[0, 0, 0, 230]'"); | 59 shouldBe("parse('rgba(0, 0, 0, 0.9)')", "'RGBA[0, 0, 0, 230]'"); |
60 shouldBe("parse('rgba(0, 0, 0, 1.0)')", "'RGBA[0, 0, 0, 255]'"); | 60 shouldBe("parse('rgba(0, 0, 0, 1.0)')", "'RGBA[0, 0, 0, 255]'"); |
61 shouldBe("parse('rgba(0, 0, 0, 0.10)')", "'RGBA[0, 0, 0, 25]'"); | 61 shouldBe("parse('rgba(0, 0, 0, 0.10)')", "'RGBA[0, 0, 0, 26]'"); |
62 shouldBe("parse('rgba(0, 0, 0, 0.20)')", "'RGBA[0, 0, 0, 51]'"); | 62 shouldBe("parse('rgba(0, 0, 0, 0.20)')", "'RGBA[0, 0, 0, 51]'"); |
63 shouldBe("parse('rgba(0, 0, 0, 0.30)')", "'RGBA[0, 0, 0, 76]'"); | 63 shouldBe("parse('rgba(0, 0, 0, 0.30)')", "'RGBA[0, 0, 0, 77]'"); |
64 shouldBe("parse('rgba(0, 0, 0, 0.40)')", "'RGBA[0, 0, 0, 102]'"); | 64 shouldBe("parse('rgba(0, 0, 0, 0.40)')", "'RGBA[0, 0, 0, 102]'"); |
65 shouldBe("parse('rgba(0, 0, 0, 0.50)')", "'RGBA[0, 0, 0, 127]'"); | 65 shouldBe("parse('rgba(0, 0, 0, 0.50)')", "'RGBA[0, 0, 0, 128]'"); |
66 shouldBe("parse('rgba(0, 0, 0, 0.60)')", "'RGBA[0, 0, 0, 153]'"); | 66 shouldBe("parse('rgba(0, 0, 0, 0.60)')", "'RGBA[0, 0, 0, 153]'"); |
67 shouldBe("parse('rgba(0, 0, 0, 0.70)')", "'RGBA[0, 0, 0, 179]'"); | 67 shouldBe("parse('rgba(0, 0, 0, 0.70)')", "'RGBA[0, 0, 0, 179]'"); |
68 shouldBe("parse('rgba(0, 0, 0, 0.80)')", "'RGBA[0, 0, 0, 204]'"); | 68 shouldBe("parse('rgba(0, 0, 0, 0.80)')", "'RGBA[0, 0, 0, 204]'"); |
69 shouldBe("parse('rgba(0, 0, 0, 0.90)')", "'RGBA[0, 0, 0, 230]'"); | 69 shouldBe("parse('rgba(0, 0, 0, 0.90)')", "'RGBA[0, 0, 0, 230]'"); |
70 shouldBe("parse('rgba(0, 0, 0, 1.00)')", "'RGBA[0, 0, 0, 255]'"); | 70 shouldBe("parse('rgba(0, 0, 0, 1.00)')", "'RGBA[0, 0, 0, 255]'"); |
71 shouldBe("parse('rgba(0, 0, 0, .10)')", "'RGBA[0, 0, 0, 25]'"); | 71 shouldBe("parse('rgba(0, 0, 0, .10)')", "'RGBA[0, 0, 0, 26]'"); |
72 shouldBe("parse('rgba(0, 0, 0, .20)')", "'RGBA[0, 0, 0, 51]'"); | 72 shouldBe("parse('rgba(0, 0, 0, .20)')", "'RGBA[0, 0, 0, 51]'"); |
73 shouldBe("parse('rgba(0, 0, 0, .30)')", "'RGBA[0, 0, 0, 76]'"); | 73 shouldBe("parse('rgba(0, 0, 0, .30)')", "'RGBA[0, 0, 0, 77]'"); |
74 shouldBe("parse('rgba(0, 0, 0, .40)')", "'RGBA[0, 0, 0, 102]'"); | 74 shouldBe("parse('rgba(0, 0, 0, .40)')", "'RGBA[0, 0, 0, 102]'"); |
75 shouldBe("parse('rgba(0, 0, 0, .50)')", "'RGBA[0, 0, 0, 127]'"); | 75 shouldBe("parse('rgba(0, 0, 0, .50)')", "'RGBA[0, 0, 0, 128]'"); |
76 shouldBe("parse('rgba(0, 0, 0, .60)')", "'RGBA[0, 0, 0, 153]'"); | 76 shouldBe("parse('rgba(0, 0, 0, .60)')", "'RGBA[0, 0, 0, 153]'"); |
77 shouldBe("parse('rgba(0, 0, 0, .70)')", "'RGBA[0, 0, 0, 179]'"); | 77 shouldBe("parse('rgba(0, 0, 0, .70)')", "'RGBA[0, 0, 0, 179]'"); |
78 shouldBe("parse('rgba(0, 0, 0, .80)')", "'RGBA[0, 0, 0, 204]'"); | 78 shouldBe("parse('rgba(0, 0, 0, .80)')", "'RGBA[0, 0, 0, 204]'"); |
79 shouldBe("parse('rgba(0, 0, 0, .90)')", "'RGBA[0, 0, 0, 230]'"); | 79 shouldBe("parse('rgba(0, 0, 0, .90)')", "'RGBA[0, 0, 0, 230]'"); |
80 shouldBe("parse('rgba(0, 0, 0, 0.10000000000000000000000)')", "'RGBA[0, 0, 0, 25
]'"); | 80 shouldBe("parse('rgba(0, 0, 0, 0.10000000000000000000000)')", "'RGBA[0, 0, 0, 26
]'"); |
81 shouldBe("parse('rgba(0, 0, 0, 0.20000000000000000000000)')", "'RGBA[0, 0, 0, 51
]'"); | 81 shouldBe("parse('rgba(0, 0, 0, 0.20000000000000000000000)')", "'RGBA[0, 0, 0, 51
]'"); |
82 shouldBe("parse('rgba(0, 0, 0, 0.30000000000000000000000)')", "'RGBA[0, 0, 0, 76
]'"); | 82 shouldBe("parse('rgba(0, 0, 0, 0.30000000000000000000000)')", "'RGBA[0, 0, 0, 77
]'"); |
83 shouldBe("parse('rgba(0, 0, 0, 0.40000000000000000000000)')", "'RGBA[0, 0, 0, 10
2]'"); | 83 shouldBe("parse('rgba(0, 0, 0, 0.40000000000000000000000)')", "'RGBA[0, 0, 0, 10
2]'"); |
84 shouldBe("parse('rgba(0, 0, 0, 0.50000000000000000000000)')", "'RGBA[0, 0, 0, 12
7]'"); | 84 shouldBe("parse('rgba(0, 0, 0, 0.50000000000000000000000)')", "'RGBA[0, 0, 0, 12
8]'"); |
85 shouldBe("parse('rgba(0, 0, 0, 0.60000000000000000000000)')", "'RGBA[0, 0, 0, 15
3]'"); | 85 shouldBe("parse('rgba(0, 0, 0, 0.60000000000000000000000)')", "'RGBA[0, 0, 0, 15
3]'"); |
86 shouldBe("parse('rgba(0, 0, 0, 0.70000000000000000000000)')", "'RGBA[0, 0, 0, 17
9]'"); | 86 shouldBe("parse('rgba(0, 0, 0, 0.70000000000000000000000)')", "'RGBA[0, 0, 0, 17
9]'"); |
87 shouldBe("parse('rgba(0, 0, 0, 0.80000000000000000000000)')", "'RGBA[0, 0, 0, 20
4]'"); | 87 shouldBe("parse('rgba(0, 0, 0, 0.80000000000000000000000)')", "'RGBA[0, 0, 0, 20
4]'"); |
88 shouldBe("parse('rgba(0, 0, 0, 0.90000000000000000000000)')", "'RGBA[0, 0, 0, 23
0]'"); | 88 shouldBe("parse('rgba(0, 0, 0, 0.90000000000000000000000)')", "'RGBA[0, 0, 0, 23
0]'"); |
89 shouldBe("parse('rgba(0, 0, 0, 1.00000000000000000000000)')", "'RGBA[0, 0, 0, 25
5]'"); | 89 shouldBe("parse('rgba(0, 0, 0, 1.00000000000000000000000)')", "'RGBA[0, 0, 0, 25
5]'"); |
90 shouldBe("parse('rgba(0, 0, 0, 0.990)')", "'RGBA[0, 0, 0, 253]'"); | 90 shouldBe("parse('rgba(0, 0, 0, 0.990)')", "'RGBA[0, 0, 0, 252]'"); |
91 shouldBe("parse('rgba(0, 0, 0, 0.991)')", "'RGBA[0, 0, 0, 253]'"); | 91 shouldBe("parse('rgba(0, 0, 0, 0.991)')", "'RGBA[0, 0, 0, 253]'"); |
92 shouldBe("parse('rgba(0, 0, 0, 0.992)')", "'RGBA[0, 0, 0, 253]'"); | 92 shouldBe("parse('rgba(0, 0, 0, 0.992)')", "'RGBA[0, 0, 0, 253]'"); |
93 shouldBe("parse('rgba(0, 0, 0, 0.993)')", "'RGBA[0, 0, 0, 254]'"); | 93 shouldBe("parse('rgba(0, 0, 0, 0.993)')", "'RGBA[0, 0, 0, 253]'"); |
94 shouldBe("parse('rgba(0, 0, 0, 0.994)')", "'RGBA[0, 0, 0, 254]'"); | 94 shouldBe("parse('rgba(0, 0, 0, 0.994)')", "'RGBA[0, 0, 0, 253]'"); |
95 shouldBe("parse('rgba(0, 0, 0, 0.995)')", "'RGBA[0, 0, 0, 254]'"); | 95 shouldBe("parse('rgba(0, 0, 0, 0.995)')", "'RGBA[0, 0, 0, 254]'"); |
96 shouldBe("parse('rgba(0, 0, 0, 0.996)')", "'RGBA[0, 0, 0, 254]'"); | 96 shouldBe("parse('rgba(0, 0, 0, 0.996)')", "'RGBA[0, 0, 0, 254]'"); |
97 shouldBe("parse('rgba(0, 0, 0, 0.997)')", "'RGBA[0, 0, 0, 255]'"); | 97 shouldBe("parse('rgba(0, 0, 0, 0.997)')", "'RGBA[0, 0, 0, 254]'"); |
98 shouldBe("parse('rgba(0, 0, 0, 0.998)')", "'RGBA[0, 0, 0, 255]'"); | 98 shouldBe("parse('rgba(0, 0, 0, 0.998)')", "'RGBA[0, 0, 0, 254]'"); |
99 shouldBe("parse('rgba(0, 0, 0, 0.999)')", "'RGBA[0, 0, 0, 255]'"); | 99 shouldBe("parse('rgba(0, 0, 0, 0.999)')", "'RGBA[0, 0, 0, 255]'"); |
OLD | NEW |