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

Side by Side Diff: conformance/canvas/buffer-offscreen-test.html

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 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
« no previous file with comments | « conformance/canvas/00_test_list.txt ('k') | conformance/canvas/buffer-preserve-test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>WebGL required buffer clear behaviour test</title>
6 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
7 <script src="../../resources/js-test-pre.js"></script>
8 <script src="../resources/webgl-test.js"> </script>
9 <script src="../resources/webgl-test-utils.js"> </script>
10 <style type="text/css">
11 body {
12 height: 3000px;
13 }
14 </style>
15 <script type="text/javascript">
16
17 var iter = 0;
18 var gl1;
19 var gl2;
20
21 var wtu = WebGLTestUtils;
22
23 function timer() {
24 if (iter == 0) {
25 // some random hacky stuff to make sure that we get a compositing step
26 window.scrollBy(0, 10);
27 window.scrollBy(0, -10);
28 iter++;
29
30 setTimeout(timer, 500);
31 } else if (iter == 1) {
32 function clear(gl) {
33 // scissor was set earlier
34 gl.clearColor(0, 0, 1, 1);
35 gl.clear(gl.COLOR_BUFFER_BIT);
36 }
37 clear(gl1);
38 clear(gl2);
39
40 debug("check on screen canvas");
41 wtu.checkCanvasRect(gl1, 0, 10, 10, 10, [0, 0, 255, 255], "cleared corne r should be blue, stencil should be preserved");
42 wtu.checkCanvasRect(gl1, 0, 0, 10, 10, [0, 0, 0, 0], "remainder of buffe r should be cleared");
43 debug("check off screen canvas");
44 wtu.checkCanvasRect(gl2, 0, 10, 10, 10, [0, 0, 255, 255], "cleared corne r should be blue, stencil should be preserved");
45 wtu.checkCanvasRect(gl2, 0, 0, 10, 10, [255, 0, 0, 255], "remainder of b uffer should be un-cleared red");
46
47 finishTest();
48 }
49 }
50
51 function go() {
52 description("This test ensures WebGL implementations correctly clear the dra wing buffer on composite if preserveDrawingBuffer is false.");
53
54 debug("");
55
56 gl1 = create3DContext(document.getElementById("c"));
57 c2 = document.createElement('canvas');
58 gl2 = create3DContext(c2);
59 shouldBeTrue("gl1 != null");
60 shouldBeTrue("gl2 != null");
61
62 shouldBeTrue('gl1.getContextAttributes().preserveDrawingBuffer == false');
63 shouldBeTrue('gl2.getContextAttributes().preserveDrawingBuffer == false');
64
65 function init(gl) {
66 gl.clearColor(1, 0, 0, 1);
67 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_B IT);
68
69 // enable scissor here, before compositing, to make sure it's correctly
70 // ignored and restored
71 gl.scissor(0, 10, 10, 10);
72 gl.enable(gl.SCISSOR_TEST);
73 }
74
75 init(gl1);
76 init(gl2);
77
78 setTimeout(timer, 500);
79 }
80
81 window.addEventListener("load", go, false);
82
83 successfullyParsed = true;
84 </script>
85 </head>
86 <body>
87 <div id="description"></div>
88 <canvas width="20" height="20" style="border: 1px solid blue;" id="c"></canvas>
89 <div id="console"></div>
90 </body>
91 </html>
92
OLDNEW
« no previous file with comments | « conformance/canvas/00_test_list.txt ('k') | conformance/canvas/buffer-preserve-test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698