OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
3 Use of this source code is governed by a BSD-style license that can be | |
4 found in the LICENSE file. | |
5 --> | |
6 <!DOCTYPE html> | |
7 <html> | |
8 <head> | |
9 <meta charset="utf-8"> | |
10 <title>WebGL Canvas Conformance Tests</title> | |
11 <link rel="stylesheet" href="../resources/js-test-style.css"/> | |
12 <script src="../resources/js-test-pre.js"></script> | |
13 <script src="resources/webgl-test.js"></script> | |
14 <script src="resources/webgl-test-utils.js"></script> | |
15 </head> | |
16 <body> | |
17 <div id="description"></div> | |
18 <div id="console"></div> | |
19 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas> | |
20 <script> | |
21 description("This test ensures WebGL implementations correctly implement drawing
bufferWidth/Height with compositing."); | |
22 | |
23 debug(""); | |
24 | |
25 var wtu = WebGLTestUtils; | |
26 var err; | |
27 var maxSize; | |
28 var canvas = document.getElementById("canvas"); | |
29 var gl = wtu.create3DContext(canvas); | |
30 if (!gl) { | |
31 testFailed("context does not exist"); | |
32 } else { | |
33 testPassed("context exists"); | |
34 | |
35 debug(""); | |
36 debug("Checking drawingBufferWidth/drawingBufferHeight"); | |
37 | |
38 // Check that a canvas with no width or height is 300x150 pixels | |
39 shouldBe('gl.drawingBufferWidth', 'canvas.width'); | |
40 shouldBe('gl.drawingBufferHeight', 'canvas.height'); | |
41 | |
42 // Check that changing the canvas size to something too large falls back to re
asonable values. | |
43 maxSize = gl.getParameter(gl.MAX_VIEWPORT_DIMS); | |
44 shouldBeTrue('maxSize[0] > 0'); | |
45 shouldBeTrue('maxSize[1] > 0'); | |
46 | |
47 // debug("MAX_VIEWPORT_DIMS = " + maxSize[0] + "x" + maxSize[1]); | |
48 canvas.width = maxSize[0] * 4; | |
49 canvas.height = maxSize[1] * 4; | |
50 shouldBeTrue('gl.drawingBufferWidth > 0'); | |
51 shouldBeTrue('gl.drawingBufferHeight > 0'); | |
52 shouldBeTrue('gl.drawingBufferWidth <= maxSize[0]'); | |
53 shouldBeTrue('gl.drawingBufferHeight <= maxSize[1]'); | |
54 shouldBe('gl.getError()', 'gl.NO_ERROR'); | |
55 } | |
56 debug("") | |
57 successfullyParsed = true; | |
58 </script> | |
59 <script src="../resources/js-test-post.js"></script> | |
60 </body> | |
61 </html> | |
OLD | NEW |