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 <script> | |
20 description("This test ensures WebGL implementations correctly implement drawing
bufferWidth/Height."); | |
21 | |
22 debug(""); | |
23 | |
24 var wtu = WebGLTestUtils; | |
25 var err; | |
26 var maxSize; | |
27 var canvas = document.createElement("canvas"); | |
28 var gl = wtu.create3DContext(canvas); | |
29 if (!gl) { | |
30 testFailed("context does not exist"); | |
31 } else { | |
32 testPassed("context exists"); | |
33 | |
34 debug(""); | |
35 debug("Checking drawingBufferWidth/drawingBufferHeight"); | |
36 | |
37 // Check that a canvas with no width or height is 300x150 pixels | |
38 shouldBe('gl.drawingBufferWidth', 'canvas.width'); | |
39 shouldBe('gl.drawingBufferHeight', 'canvas.height'); | |
40 | |
41 // Check that changing the canvas size to something too large falls back to re
asonable values. | |
42 maxSize = gl.getParameter(gl.MAX_VIEWPORT_DIMS); | |
43 shouldBeTrue('maxSize[0] > 0'); | |
44 shouldBeTrue('maxSize[1] > 0'); | |
45 | |
46 // debug("MAX_VIEWPORT_DIMS = " + maxSize[0] + "x" + maxSize[1]); | |
47 canvas.width = maxSize[0] * 4; | |
48 canvas.height = maxSize[1] * 4; | |
49 shouldBeTrue('gl.drawingBufferWidth > 0'); | |
50 shouldBeTrue('gl.drawingBufferHeight > 0'); | |
51 shouldBeTrue('gl.drawingBufferWidth <= maxSize[0]'); | |
52 shouldBeTrue('gl.drawingBufferHeight <= maxSize[1]'); | |
53 shouldBe('gl.getError()', 'gl.NO_ERROR'); | |
54 } | |
55 debug("") | |
56 successfullyParsed = true; | |
57 </script> | |
58 <script src="../resources/js-test-post.js"></script> | |
59 </body> | |
60 </html> | |
OLD | NEW |