OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
2 "http://www.w3.org/TR/html4/loose.dtd"> | 2 "http://www.w3.org/TR/html4/loose.dtd"> |
3 <html> | 3 <html> |
4 <head> | 4 <head> |
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6 <title>WebGL Canvas Conformance Tests</title> | 6 <title>WebGL Canvas Conformance Tests</title> |
7 <script src="resources/desktop-gl-constants.js" type="text/javascript"></script> | 7 <script src="resources/desktop-gl-constants.js" type="text/javascript"></script> |
8 <script src="../../../resources/js-test.js"></script> | 8 <script src="../../../resources/js-test.js"></script> |
| 9 <script src="../../../resources/run-after-display.js"></script> |
9 <script src="resources/webgl-test.js"></script> | 10 <script src="resources/webgl-test.js"></script> |
10 </head> | 11 </head> |
11 <body> | 12 <body> |
12 <div id="description"></div> | 13 <div id="description"></div> |
13 <div id="console"></div> | 14 <div id="console"></div> |
14 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas> | 15 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas> |
15 <canvas id="canvas2d" width="40" height="40"> </canvas> | 16 <canvas id="canvas2d" width="40" height="40"> </canvas> |
16 <script> | 17 <script> |
17 if (window.initNonKhronosFramework) { | 18 if (window.initNonKhronosFramework) { |
18 window.initNonKhronosFramework(true); | 19 window.initNonKhronosFramework(true); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 127 |
127 checkCanvasContentIs(0, 0, 0, 0); | 128 checkCanvasContentIs(0, 0, 0, 0); |
128 shouldBe('getViewport()', '"0,0,300,150"'); | 129 shouldBe('getViewport()', '"0,0,300,150"'); |
129 | 130 |
130 // Change the display size of the canvas and check | 131 // Change the display size of the canvas and check |
131 // the viewport size does not change. | 132 // the viewport size does not change. |
132 debug(""); | 133 debug(""); |
133 debug("change display size of canvas and see that viewport does not change"); | 134 debug("change display size of canvas and see that viewport does not change"); |
134 canvas.style.width = "100px"; | 135 canvas.style.width = "100px"; |
135 canvas.style.height = "25px"; | 136 canvas.style.height = "25px"; |
136 var intervalId; | 137 runAfterDisplay(function() { |
137 intervalId = window.setInterval(function() { | 138 shouldBe('canvas.clientWidth', '100'); |
138 if (window.testRunner) | 139 shouldBe('canvas.clientHeight', '25'); |
139 testRunner.display(); | 140 shouldBe('getViewport()', '"0,0,300,150"'); |
140 if (canvas.clientWidth == 100 && | 141 shouldBe('canvas.width', '300'); |
141 canvas.clientHeight == 25) { | 142 shouldBe('canvas.height', '150'); |
142 window.clearInterval(intervalId); | |
143 shouldBe('getViewport()', '"0,0,300,150"'); | |
144 shouldBe('canvas.width', '300'); | |
145 shouldBe('canvas.height', '150'); | |
146 | 143 |
147 // Change the actual size of the canvas | 144 // Change the actual size of the canvas |
148 // Check that the viewport does not change. | 145 // Check that the viewport does not change. |
149 // Check that the clear color does not change. | 146 // Check that the clear color does not change. |
150 // Check that the color mask does not change. | 147 // Check that the color mask does not change. |
151 debug(""); | 148 debug(""); |
152 debug("change the actual size of the canvas and see that the viewport does
not change"); | 149 debug("change the actual size of the canvas and see that the viewport does n
ot change"); |
153 gl.clearColor(0.25, 0.5, 0.75, 1); | 150 gl.clearColor(0.25, 0.5, 0.75, 1); |
154 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); | 151 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); |
155 checkCanvasContentIs(64, 128, 192, 255); | 152 checkCanvasContentIs(64, 128, 192, 255); |
156 gl.colorMask(0,0,0,0); | 153 gl.colorMask(0,0,0,0); |
157 canvas.width = 400; | 154 canvas.width = 400; |
158 canvas.height = 10; | 155 canvas.height = 10; |
159 | 156 |
160 var v = gl.getParameter(gl.COLOR_CLEAR_VALUE); | 157 var v = gl.getParameter(gl.COLOR_CLEAR_VALUE); |
161 assertMsg(isAboutEqual(v[0], 0.25) && | 158 assertMsg(isAboutEqual(v[0], 0.25) && |
162 isAboutEqual(v[1], 0.5) && | 159 isAboutEqual(v[1], 0.5) && |
163 isAboutEqual(v[2], 0.75) && | 160 isAboutEqual(v[2], 0.75) && |
164 isAboutEqual(v[3], 1), | 161 isAboutEqual(v[3], 1), |
165 "gl.clearColor should not change after canvas resize"); | 162 "gl.clearColor should not change after canvas resize"); |
166 v = gl.getParameter(gl.COLOR_WRITEMASK); | 163 v = gl.getParameter(gl.COLOR_WRITEMASK); |
167 assertMsg(isAboutEqual(v[0], 0) && | 164 assertMsg(isAboutEqual(v[0], 0) && |
168 isAboutEqual(v[1], 0) && | 165 isAboutEqual(v[1], 0) && |
169 isAboutEqual(v[2], 0) && | 166 isAboutEqual(v[2], 0) && |
170 isAboutEqual(v[3], 0), | 167 isAboutEqual(v[3], 0), |
171 "gl.colorMask should not change after canvas resize"); | 168 "gl.colorMask should not change after canvas resize"); |
172 shouldBe('getViewport()', '"0,0,300,150"'); | 169 shouldBe('getViewport()', '"0,0,300,150"'); |
173 checkCanvasContentIs(0, 0, 0, 0); | 170 checkCanvasContentIs(0, 0, 0, 0); |
174 | 171 |
175 debug(""); | 172 debug(""); |
176 | 173 |
177 finishJSTest(); | 174 finishJSTest(); |
178 } | 175 }); |
179 }, 1000/30); | |
180 } | 176 } |
181 | 177 |
182 </script> | 178 </script> |
183 <script> | 179 <script> |
184 </script> | 180 </script> |
185 | 181 |
186 </body> | 182 </body> |
187 </html> | 183 </html> |
OLD | NEW |