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

Side by Side Diff: LayoutTests/paint/invalidation/spv2/canvas-putImageData-expected.html

Issue 1302183007: Convert some text-based-repaint tests for spv2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months 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 <!-- Test for https://bugs.webkit.org/show_bug.cgi?id=46319 --> 1 <!-- Test for https://bugs.webkit.org/show_bug.cgi?id=46319 -->
2 <head> 2 <head>
3 <script src="resources/text-based-repaint.js"></script>
4 </head> 3 </head>
5 <body> 4 <body>
6 <canvas id="canvas" width="100" height="100"></canvas> 5 <canvas id="canvas" width="100" height="100"></canvas>
7 <script> 6 <script>
8 var canvas = document.getElementById('canvas'); 7 var canvas = document.getElementById('canvas');
9 var ctx = canvas.getContext('2d'); 8 var ctx = canvas.getContext('2d');
10 9
11 // prepare imagedata 10 // prepare imagedata
12 ctx.fillStyle = "rgb(255, 0, 0)"; ctx.fillRect(0, 0, 100, 100); // red b ackground 11 ctx.fillStyle = "rgb(255, 0, 0)"; ctx.fillRect(0, 0, 100, 100); // red b ackground
13 ctx.fillStyle = "rgb(0, 255, 0)"; ctx.fillRect(10, 10, 10, 10); // inset green square 12 ctx.fillStyle = "rgb(0, 255, 0)"; ctx.fillRect(10, 10, 10, 10); // inset green square
14 var imageDataGreen = ctx.getImageData(10, 10, 10, 10); 13 var imageDataGreen = ctx.getImageData(10, 10, 10, 10);
15 var imageDataRedWithInsetGreen = ctx.getImageData(0, 0, 30, 30); 14 var imageDataRedWithInsetGreen = ctx.getImageData(0, 0, 30, 30);
16 15
17 // clear canvas to dark green 16 // clear canvas to dark green
18 ctx.fillStyle = "rgb(0, 128, 0)"; 17 ctx.fillStyle = "rgb(0, 128, 0)";
19 ctx.fillRect(0, 0, 100, 100); 18 ctx.fillRect(0, 0, 100, 100);
20 19
21 // fill target locations with dark red 20 // fill target locations with dark red
22 ctx.fillStyle = "rgb(128, 0, 0)"; 21 ctx.fillStyle = "rgb(128, 0, 0)";
23 ctx.fillRect(0, 0, 10, 10); 22 ctx.fillRect(0, 0, 10, 10);
24 ctx.fillRect(40, 40, 10, 10); 23 ctx.fillRect(40, 40, 10, 10);
25 ctx.fillRect(80, 80, 10, 10); 24 ctx.fillRect(80, 80, 10, 10);
26 window.testIsAsync = true;
27
28 function repaintTest()
29 {
30 // patch up red squares with putImageData
31 ctx.putImageData(imageDataGreen, 0, 0);
32 ctx.putImageData(imageDataGreen, 40, 40);
33 ctx.putImageData(imageDataRedWithInsetGreen, 70, 70, 10, 10, 10, 10) ;
34 // Because canvas invalidations are processed at the end of the curr ent task,
35 // the repaint test has to end in a subsequent task in order to capt ure the repaint.
36 setTimeout(finishRepaintTest, 0);
37 }
38 25
39 window.onload = runRepaintTest; 26 // patch up red squares with putImageData
27 ctx.putImageData(imageDataGreen, 0, 0);
28 ctx.putImageData(imageDataGreen, 40, 40);
29 ctx.putImageData(imageDataRedWithInsetGreen, 70, 70, 10, 10, 10, 10);
40 </script> 30 </script>
41 </body> 31 </body>
OLDNEW
« no previous file with comments | « LayoutTests/paint/invalidation/spv2/canvas-putImageData.html ('k') | LayoutTests/paint/invalidation/spv2/canvas-resize.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698