Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: LayoutTests/fast/canvas/script-tests/canvas-currentColor.js

Issue 408813007: Remove non-standard API entry points in CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove some unnecessary mac/virtual/gpu baselines Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 description("Test that CanvasRenderingContext2D supports the 'currentColor' valu e."); 1 description("Test that CanvasRenderingContext2D supports the 'currentColor' valu e.");
2 2
3 canvas = document.createElement('canvas'); 3 canvas = document.createElement('canvas');
4 canvas.width = 100; 4 canvas.width = 100;
5 canvas.height = 100; 5 canvas.height = 100;
6 ctx = canvas.getContext('2d'); 6 ctx = canvas.getContext('2d');
7 7
8 function attachCanvasToDocument() { 8 function attachCanvasToDocument() {
9 document.body.appendChild(canvas); 9 document.body.appendChild(canvas);
10 return document.body.parentNode != null; 10 return document.body.parentNode != null;
(...skipping 19 matching lines...) Expand all
30 return '' + data[0] + ',' + data[1] + ',' + data[2] + ',' + data[3]; 30 return '' + data[0] + ',' + data[1] + ',' + data[2] + ',' + data[3];
31 } 31 }
32 32
33 // First we test with the canvas out-of-document, 'currentColor' should mean bla ck 33 // First we test with the canvas out-of-document, 'currentColor' should mean bla ck
34 shouldBe("ctx.shadowColor = '#f00'; ctx.shadowColor", "'#ff0000'"); 34 shouldBe("ctx.shadowColor = '#f00'; ctx.shadowColor", "'#ff0000'");
35 shouldBe("ctx.shadowColor = 'currentColor'; ctx.shadowColor", "'#000000'"); 35 shouldBe("ctx.shadowColor = 'currentColor'; ctx.shadowColor", "'#000000'");
36 shouldBe("ctx.fillStyle = '#f00'; ctx.fillStyle", "'#ff0000'"); 36 shouldBe("ctx.fillStyle = '#f00'; ctx.fillStyle", "'#ff0000'");
37 shouldBe("ctx.fillStyle = 'currentColor'; ctx.fillStyle", "'#000000'"); 37 shouldBe("ctx.fillStyle = 'currentColor'; ctx.fillStyle", "'#000000'");
38 shouldBe("ctx.strokeStyle = '#f00'; ctx.strokeStyle", "'#ff0000'"); 38 shouldBe("ctx.strokeStyle = '#f00'; ctx.strokeStyle", "'#ff0000'");
39 shouldBe("ctx.strokeStyle = 'currentColor'; ctx.strokeStyle", "'#000000'"); 39 shouldBe("ctx.strokeStyle = 'currentColor'; ctx.strokeStyle", "'#000000'");
40 shouldBe("ctx.setShadow(0, 0, 0, '#f00'); ctx.shadowColor", "'#ff0000'");
41 shouldBe("ctx.setShadow(0, 0, 0, 'currentColor'); ctx.shadowColor", "'#000000'") ;
42 shouldBe("ctx.setShadow(0, 0, 0, '#f00', 0.0); ctx.shadowColor", "'rgba(255, 0, 0, 0)'");
43 shouldBe("ctx.setShadow(0, 0, 0, 'currentColor', 0.0); ctx.shadowColor", "'rgba( 0, 0, 0, 0)'");
44 shouldBe("ctx.setStrokeColor('#f00'); ctx.strokeStyle", "'#ff0000'");
45 shouldBe("ctx.setStrokeColor('currentColor'); ctx.strokeStyle", "'#000000'");
46 shouldBe("ctx.setStrokeColor('#f00', 0.0); ctx.strokeStyle", "'rgba(255, 0, 0, 0 )'");
47 shouldBe("ctx.setStrokeColor('currentColor', 0.0); ctx.strokeStyle", "'rgba(0, 0 , 0, 0)'");
48 shouldBe("ctx.setFillColor('#f00'); ctx.fillStyle", "'#ff0000'");
49 shouldBe("ctx.setFillColor('currentColor'); ctx.fillStyle", "'#000000'");
50 shouldBe("ctx.setFillColor('#f00', 0.0); ctx.fillStyle", "'rgba(255, 0, 0, 0)'") ;
51 shouldBe("ctx.setFillColor('currentColor', 0.0); ctx.fillStyle", "'rgba(0, 0, 0, 0)'");
52 shouldBe("tryLinearGradientColor('#f00')", "'255,0,0,255'"); 40 shouldBe("tryLinearGradientColor('#f00')", "'255,0,0,255'");
53 shouldBe("tryLinearGradientColor('currentColor')", "'0,0,0,255'"); 41 shouldBe("tryLinearGradientColor('currentColor')", "'0,0,0,255'");
54 shouldBe("tryRadialGradientColor('#f00')", "'255,0,0,255'"); 42 shouldBe("tryRadialGradientColor('#f00')", "'255,0,0,255'");
55 shouldBe("tryRadialGradientColor('currentColor')", "'0,0,0,255'"); 43 shouldBe("tryRadialGradientColor('currentColor')", "'0,0,0,255'");
56 44
57 // Attach to the document and set the canvas's color to #123456 45 // Attach to the document and set the canvas's color to #123456
58 shouldBe("attachCanvasToDocument()", "true"); 46 shouldBe("attachCanvasToDocument()", "true");
59 shouldBe("canvas.style.color = '#123456'; canvas.style.color", "'rgb(18, 52, 86) '"); 47 shouldBe("canvas.style.color = '#123456'; canvas.style.color", "'rgb(18, 52, 86) '");
60 48
61 // 'currentColor' should now mean #123456 49 // 'currentColor' should now mean #123456
62 shouldBe("ctx.shadowColor = '#f00'; ctx.shadowColor", "'#ff0000'"); 50 shouldBe("ctx.shadowColor = '#f00'; ctx.shadowColor", "'#ff0000'");
63 shouldBe("ctx.shadowColor = 'currentColor'; ctx.shadowColor", "'#123456'"); 51 shouldBe("ctx.shadowColor = 'currentColor'; ctx.shadowColor", "'#123456'");
64 shouldBe("ctx.fillStyle = '#f00'; ctx.fillStyle", "'#ff0000'"); 52 shouldBe("ctx.fillStyle = '#f00'; ctx.fillStyle", "'#ff0000'");
65 shouldBe("ctx.fillStyle = 'currentColor'; ctx.fillStyle", "'#123456'"); 53 shouldBe("ctx.fillStyle = 'currentColor'; ctx.fillStyle", "'#123456'");
66 shouldBe("ctx.strokeStyle = '#f00'; ctx.strokeStyle", "'#ff0000'"); 54 shouldBe("ctx.strokeStyle = '#f00'; ctx.strokeStyle", "'#ff0000'");
67 shouldBe("ctx.strokeStyle = 'currentColor'; ctx.strokeStyle", "'#123456'"); 55 shouldBe("ctx.strokeStyle = 'currentColor'; ctx.strokeStyle", "'#123456'");
68 shouldBe("ctx.setShadow(0, 0, 0, '#f00'); ctx.shadowColor", "'#ff0000'");
69 shouldBe("ctx.setShadow(0, 0, 0, 'currentColor'); ctx.shadowColor", "'#123456'") ;
70 shouldBe("ctx.setShadow(0, 0, 0, '#f00', 0.0); ctx.shadowColor", "'rgba(255, 0, 0, 0)'");
71 shouldBe("ctx.setShadow(0, 0, 0, 'currentColor', 0.0); ctx.shadowColor", "'rgba( 18, 52, 86, 0)'");
72 shouldBe("ctx.setStrokeColor('#f00'); ctx.strokeStyle", "'#ff0000'");
73 shouldBe("ctx.setStrokeColor('currentColor'); ctx.strokeStyle", "'#123456'");
74 shouldBe("ctx.setStrokeColor('#f00', 0.0); ctx.strokeStyle", "'rgba(255, 0, 0, 0 )'");
75 shouldBe("ctx.setStrokeColor('currentColor', 0.0); ctx.strokeStyle", "'rgba(18, 52, 86, 0)'");
76 shouldBe("ctx.setFillColor('#f00'); ctx.fillStyle", "'#ff0000'");
77 shouldBe("ctx.setFillColor('currentColor'); ctx.fillStyle", "'#123456'");
78 shouldBe("ctx.setFillColor('#f00', 0.0); ctx.fillStyle", "'rgba(255, 0, 0, 0)'") ;
79 shouldBe("ctx.setFillColor('currentColor', 0.0); ctx.fillStyle", "'rgba(18, 52, 86, 0)'");
80 shouldBe("tryLinearGradientColor('#f00')", "'255,0,0,255'"); 56 shouldBe("tryLinearGradientColor('#f00')", "'255,0,0,255'");
81 shouldBe("tryLinearGradientColor('currentColor')", "'0,0,0,255'"); 57 shouldBe("tryLinearGradientColor('currentColor')", "'0,0,0,255'");
82 shouldBe("tryRadialGradientColor('#f00')", "'255,0,0,255'"); 58 shouldBe("tryRadialGradientColor('#f00')", "'255,0,0,255'");
83 shouldBe("tryRadialGradientColor('currentColor')", "'0,0,0,255'"); 59 shouldBe("tryRadialGradientColor('currentColor')", "'0,0,0,255'");
84 60
85 // Last but not least, verify that we're case insensitive 61 // Last but not least, verify that we're case insensitive
86 shouldBe("ctx.shadowColor = '#f00'; ctx.shadowColor", "'#ff0000'"); 62 shouldBe("ctx.shadowColor = '#f00'; ctx.shadowColor", "'#ff0000'");
87 shouldBe("ctx.shadowColor = 'CURRENTCOLOR'; ctx.shadowColor", "'#123456'"); 63 shouldBe("ctx.shadowColor = 'CURRENTCOLOR'; ctx.shadowColor", "'#123456'");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698