Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1622)

Side by Side Diff: conformance/manual/framebuffers-keep-contents-exiting-fullscreen-mode.html

Issue 41503006: Add ToT WebGL conformance tests : part 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(Empty)
1 <!--
2
3 /*
4 ** Copyright (c) 2013 The Khronos Group Inc.
5 **
6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to
11 ** permit persons to whom the Materials are furnished to do so, subject to
12 ** the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
16 **
17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
24 */
25
26 -->
27
28 <!DOCTYPE html>
29 <html>
30 <head>
31 <meta charset="utf-8">
32 <title>Check that framebuffers keep contents exiting fullscreen mode.</title>
33 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
34 <script src="../../resources/js-test-pre.js"></script>
35 <script src="../resources/webgl-test.js"></script>
36 <script src="../resources/webgl-test-utils.js"></script>
37 <style>
38 canvas {
39 width: 100%;
40 height: 50px;
41 border: 1px solid black;
42 }
43 #f {
44 left: 0px;
45 top: 0px;
46 }
47 #inner {
48 }
49 input.button {
50 font-size: 36pt;
51 }
52 .redbox {
53 border: 1px solid black;
54 background-color: red;
55 }
56 #canvasholder {
57 position: relative;
58 }
59 #clabel {
60 position: absolute;
61 width: 100%;
62 top: 0px;
63 left: 0px;
64 font-size: 40px;
65 z-index: 10;
66 text-align: center;
67 }
68 </style>
69 </head>
70 <body>
71 <pre>
72 This test must be run manually.
73
74 Checks that framebuffers keep their contents going into and out of fullscreen mo de.
75
76 Through the entire test you should see a <span class="redbox">red rectangle</spa n>. If it is not <span class="redbox">red</span> in all cases the test has faile d.
77 </pre>
78 <div id="f">
79 <div id="inner">
80 <div id="buttonHolder">
81 <div><input id="button" class="button" type="button" value="Click this but ton to continue the test"/></div>
82 <div id="canvasholder">
83 <canvas id='c'></canvas>
84 <div id='clabel'>
85 should be red
86 </div>
87 </div>
88 </div>
89 </div>
90 </div>
91 <div id="description"></div>
92 <div id="console"></div>
93 <script>
94 "use strict";
95 var wtu = WebGLTestUtils;
96 var testedFullScreen = false;
97 var c = document.getElementById("c");
98 var button = document.getElementById("button");
99 var buttonHolder = document.getElementById("buttonHolder");
100 var gl = wtu.create3DContext(c);
101 if (!gl) {
102 testFailed("can't init WebGL");
103 }
104
105 var checkState = function() {
106 debug("");
107 wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0, 255, 0, 255]);
108 shouldBeNonNull("gl.getParameter(gl.FRAMEBUFFER_BINDING)");
109 glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
110 }
111
112 var checkFramebufferState = function(fullscreen) {
113 checkState();
114
115 debug("fullscreen:" + fullscreen);
116
117 if (fullscreen) {
118 // Not sure if this is needed but need to make sure
119 // we at least went fullscreen once.
120 testedFullScreen = true;
121 } else {
122 if (testedFullScreen) {
123 finishTest();
124 }
125 }
126 };
127
128 var test = function() {
129 if (!wtu.setupFullscreen("button", "f", checkFramebufferState)) {
130 testPassed("Browser does not support fullscreen mode. This is OK");
131 finishTest();
132 return;
133 }
134
135 var fb = gl.createFramebuffer();
136 var tex = gl.createTexture();
137
138 gl.clearColor(1,0,0,1);
139 gl.clear(gl.COLOR_BUFFER_BIT);
140
141 gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
142 gl.bindTexture(gl.TEXTURE_2D, tex);
143 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, n ull);
144 gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, t ex, 0);
145 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE ");
146
147 gl.clearColor(0, 1, 0, 1);
148 gl.clear(gl.COLOR_BUFFER_BIT);
149
150 checkState();
151 };
152 test();
153
154 </script>
155 </body>
156 </html>
OLDNEW
« no previous file with comments | « conformance/manual/canvas-no-clear-on-unsuccessful-draw.html ('k') | conformance/misc/00_test_list.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698