Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / framebuffer-bindings-unaffected-on-resize.html
blob099018530361ba53077780088d3b18370fda42fe
2 <!DOCTYPE html>
3 <html>
4 <head>
5 <meta charset="utf-8">
6 <title>Verifies that GL framebuffer bindings do not change when canvas is resized</title>
7 <script src="../../../resources/js-test.js"></script>
8 <script src="resources/webgl-test.js"></script>
9 <script src="resources/webgl-test-utils.js"></script>
10 </head>
11 <body>
12 <canvas id="example" width="4px" height="4px"></canvas>
13 <div id="description"></div>
14 <div id="console"></div>
15 <script>
16 description("Verifies that GL framebuffer bindings do not change when canvas is resized");
18 if (window.initNonKhronosFramework) {
19 window.initNonKhronosFramework(true);
22 var err;
23 var wtu = WebGLTestUtils;
24 var canvas = document.getElementById("example");
25 var gl = wtu.create3DContext(canvas);
26 var green = [0, 255, 0, 255];
27 var blue = [0, 0, 255, 255];
28 var fboSize = 2;
29 shouldBeTrue("fboSize < canvas.width");
30 var fbo = gl.createFramebuffer();
31 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
32 var fboTex = gl.createTexture();
33 gl.activeTexture(gl.TEXTURE1);
34 gl.bindTexture(gl.TEXTURE_2D, fboTex);
35 gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, fboTex, 0);
36 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, fboSize, fboSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
37 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
38 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
39 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
40 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
41 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
43 function checkFBO(color, msg) {
44 wtu.checkCanvasRect(gl, 0, 0, fboSize, fboSize, color, msg);
45 wtu.checkCanvasRect(gl, fboSize, fboSize, fboSize, fboSize, [0, 0, 0, 0], "area outside fbo should be transparent black");
48 // The FBO is 2x2 and it's bound so clearing should clear a 2x2 area
49 // and calling read pixels should read the clear color in that 2x2 area
50 // and 0,0,0,0 outside that area.
52 // If the FBO is no longer bound because of a WebGL implementation error
53 // then likely the clear will clear the backbuffer and reading outside
54 // the 2x2 area will not be 0,0,0,0
56 function test() {
57 gl.clearColor(0, 0, 1, 1);
58 gl.clear(gl.COLOR_BUFFER_BIT);
59 checkFBO(blue, "should be blue");
60 gl.clearColor(0, 1, 0, 1);
61 gl.clear(gl.COLOR_BUFFER_BIT);
62 checkFBO(green, "should be green");
65 debug("test before resizing canvas");
66 test();
67 debug("test after resizing canvas");
68 canvas.width = 8;
69 test();
70 debug("test after resizing canvas and waiting for compositing");
71 canvas.width = 16;
72 wtu.waitForComposite(5, function() {
73 test();
74 finishTest();
75 glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors.");
76 });
78 successfullyParsed = true;
79 </script>
80 </body>
81 </html>