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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/context/context-attribute-preserve-drawing-buffer.html

Issue 10399113: Roll webgl conformance tests to r17874: part 2, adding r17874 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 7 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
+ LF
OLDNEW
(Empty)
1 <!--
2
3 /*
4 ** Copyright (c) 2012 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 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
33 <script src="../../resources/js-test-pre.js"></script>
34 <script src="../resources/webgl-test.js"></script>
35 <script src="../resources/webgl-test-utils.js"></script>
36 <style>
37 canvas {
38 width:50px;
39 height:50px;
40 }
41 .square {
42 display:inline-block;
43 width:50px;
44 height:50px;
45 background-color:red;
46 }
47 </style>
48 <script>
49 wtu = WebGLTestUtils;
50 function checkResult(ctx1, ctx2, preserve) {
51 var imgData1 = ctx1.getImageData(0,0,1,1);
52 var imgData2 = ctx2.getImageData(0,0,1,1);
53 var correct1 = [255,0,0,255];
54 var correct2 = preserve ? [255,0,0,255] : [0,0,0,255];
55 var ok1 = true;
56 var ok2 = true;
57 for (var p = 0; p < 4; ++p) {
58 if (imgData1.data[p] != correct1[p])
59 ok1 = false;
60 if (imgData2.data[p] != correct2[p])
61 ok2 = false;
62 }
63 if (ok1 && ok2)
64 testPassed('Rendered ok with preserveDrawingBuffer ' + prese rve +'.');
65 else
66 testFailed('Did not render ok with preserveDrawingBuffer ' + preserve + '.');
67 if (preserve) {
68 finishTest()
69 } else {
70 runTest(true);
71 }
72 }
73
74 function runTest(preserve) {
75 var c1 = document.getElementById('c' + (preserve * 3 + 1));
76 var c2 = document.getElementById('c' + (preserve * 3 + 2));
77 var c3 = document.getElementById('c' + (preserve * 3 + 3));
78 var ctx1 = c1.getContext('2d');
79 var ctx2 = c2.getContext('2d');
80 var gl = create3DContext(c3, { alpha:false, preserveDrawingBuffe r:preserve });
81 gl.clearColor(1, 0, 0, 1);
82 gl.clear(gl.COLOR_BUFFER_BIT);
83 ctx1.drawImage(c3, 0, 0);
84 wtu.waitFrames(5, function() {
85 ctx2.drawImage(c3, 0, 0);
86 checkResult(ctx1, ctx2, preserve);
87 });
88
89 }
90 </script>
91 </head>
92 <body>
93 <div>
94 <canvas id='c1'></canvas>
95 <canvas id='c2'></canvas>
96 <canvas id='c3'></canvas>
97 <span>should look as right pattern</span>
98 <div class='square'></div>
99 <div class='square' style='background-color:black'></div>
100 <div class='square'></div>
101 </div>
102 <div>
103 <canvas id='c4'></canvas>
104 <canvas id='c5'></canvas>
105 <canvas id='c6'></canvas>
106 <span>should look as right pattern</span>
107 <div class='square'></div>
108 <div class='square'></div>
109 <div class='square'></div>
110 </div>
111 <div id="description"></div>
112 <div id="console"></div>
113 <script>
114 description('Verify that preserveDrawingBuffer attribute is honored. ');
115 runTest(false);
116 successfullyParsed = true;
117 shouldBeTrue("successfullyParsed");
118 </script>
119 </body>
120 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698