OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body onload="runRepaintTest()"> | 2 <body onload="runRepaintTest()"> |
3 <span id="description" style="color: white"> | 3 <span id="description" style="color: white"> |
4 This test is only useful as a pixel test. You should see two rows with 4 canvase s in each. The top row of canvases should have a black background, the bottom ro w should have a dark blue background. | 4 This test is only useful as a pixel test. You should see two rows with 4 canvase s in each. The top row of canvases should have a black background, the bottom ro w should have a dark blue background. |
5 The canvases in the first two rows should have a single triangle. The canvases o n the left should have two triangles superimposed on top of each other. | 5 The canvases in the first two rows should have a single triangle. The canvases o n the left should have three triangles superimposed on top of each other. |
6 If multisampling is supported, the odd columns should have smooth edges instead of jagged stair-stepping. | 6 If multisampling is supported, the odd columns should have smooth edges instead of jagged stair-stepping. |
7 </span> | 7 </span> |
8 <br> | 8 <br> |
9 <style> | 9 <style> |
10 canvas { | 10 canvas { |
11 outline: 1px solid blue; | 11 outline: 1px solid blue; |
12 } | 12 } |
13 body { | 13 body { |
14 background-color: darkblue; | 14 background-color: darkblue; |
15 } | 15 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 106 |
107 // draw | 107 // draw |
108 gl.drawArrays(gl.TRIANGLES, 0, 3); | 108 gl.drawArrays(gl.TRIANGLES, 0, 3); |
109 } | 109 } |
110 | 110 |
111 function drawAll(offset) { | 111 function drawAll(offset) { |
112 for (var i=0; i<8; ++i) | 112 for (var i=0; i<8; ++i) |
113 draw(ctxs[i], offset); | 113 draw(ctxs[i], offset); |
114 } | 114 } |
115 | 115 |
116 drawAll(0); | 116 function repaintOnVisiblePage() { |
117 | 117 // Check if WebGL draws this frame correctly, because WebGL implementation |
118 function repaintTest() { | 118 // clears temporary cache when page is hidden. |
119 drawAll(50); | 119 drawAll(60); |
120 if (window.testRunner) { | 120 if (window.testRunner) { |
121 testRunner.notifyDone(); | 121 testRunner.notifyDone(); |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 function SetPageVisible() { | |
Ken Russell (switch to Gerrit)
2014/07/08 23:18:24
Please use consistent capitalization: setPageVisib
| |
126 if (window.testRunner) { | |
127 testRunner.setPageVisibility("visible"); | |
128 testRunner.displayAsyncThen(repaintOnVisiblePage); | |
129 } else { | |
130 setTimeout(repaintOnVisiblePage, 50); | |
131 } | |
132 } | |
133 | |
134 function repaintOnHiddenPage() { | |
135 if (window.testRunner) { | |
136 testRunner.setPageVisibility("hidden"); | |
137 } | |
138 // Although page is hidden, WebGL must draw this frame. | |
139 drawAll(30); | |
140 // testRunner.displayAsyncThen doesn't work when page is hidden. | |
141 setTimeout(SetPageVisible, 50); | |
142 } | |
143 | |
125 function runRepaintTest() { | 144 function runRepaintTest() { |
145 drawAll(0); | |
126 if (window.testRunner) { | 146 if (window.testRunner) { |
127 testRunner.waitUntilDone(); | 147 testRunner.waitUntilDone(); |
128 testRunner.displayAsyncThen(repaintTest); | 148 testRunner.displayAsyncThen(repaintOnHiddenPage); |
129 } else { | 149 } else { |
130 setTimeout(repaintTest, 100); | 150 setTimeout(repaintOnHiddenPage, 50); |
131 } | 151 } |
132 } | 152 } |
133 </script> | 153 </script> |
OLD | NEW |