tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / fast / canvas / script-tests / canvas-color-clamping.js
1 description("Test that color values are properly clamped (R, G, B should be 0-255), alpha 0.0-1.0");
2
3 var ctx = document.createElement('canvas').getContext('2d');
4
5 shouldBe("ctx.shadowColor = 'rgba(0,0,0,0)'; ctx.shadowColor", "'rgba(0, 0, 0, 0)'");
6 shouldBe("ctx.shadowColor = 'rgb(0,0,0)'; ctx.shadowColor", "'#000000'");
7 shouldBe("ctx.shadowColor = 'rgb(0,999,0)'; ctx.shadowColor", "'#00ff00'");
8 shouldBe("ctx.shadowColor = 'rgb(0,999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999,0)'; ctx.shadowColor", "'#00ff00'");
9 shouldBe("ctx.shadowColor = 'rgb(0,0,256)'; ctx.shadowColor", "'#0000ff'");
10 shouldBe("ctx.shadowColor = 'rgb(999999999999999999999999,0,-9999999999999999999999999999)'; ctx.shadowColor", "'#ff0000'");
11 shouldBe("ctx.shadowColor = 'rgba(9999999999999999999999999999999999999999999999999999999999999999999999999999999999,9,0,1)'; ctx.shadowColor", "'#ff0900'");
12 shouldBe("ctx.shadowColor = 'rgba(9999999999999999999999999999999999999999999999999999999999999999999999999999999999,9,0,-99999999999999999999999999999999999999)'; ctx.shadowColor", "'rgba(255, 9, 0, 0)'");
13 shouldBe("ctx.shadowColor = 'rgba(7,9999999999999999999999999999999999999999999999999999999999999999999999999999999999,0,99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)'; ctx.shadowColor", "'#07ff00'");
14 shouldBe("ctx.shadowColor = 'rgba(-7,9999999999999999999999999999999999999999999999999999999999999999999999999999999999,0,99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)'; ctx.shadowColor", "'#00ff00'");
15 shouldBe("ctx.shadowColor = 'rgba(0%,100%,0%,0.4)'; ctx.shadowColor", "'rgba(0, 255, 0, 0.4)'");