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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/programs/get-active-test.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 </head>
36 <body>
37 <div id="description"></div>
38 <div id="console"></div>
39
40 <script>
41 description("Test of getActiveAttrib and getActiveUniform");
42
43 var context = create3DContext();
44 var context2 = create3DContext();
45 var program = loadStandardProgram(context);
46 var program2 = loadProgram(context2,
47 "../resources/intArrayUniformShader.vert",
48 "../resources/noopUniformShader.frag");
49
50 glErrorShouldBe(context, context.NO_ERROR);
51 shouldBe("context.getActiveUniform(program, 0).name", "'u_modelViewProjMatrix'") ;
52 shouldBe("context.getActiveUniform(program, 0).type", "context.FLOAT_MAT4");
53 shouldBe("context.getActiveUniform(program, 0).size", "1");
54 shouldBeNull("context.getActiveUniform(program, 1)");
55 glErrorShouldBe(context, context.INVALID_VALUE);
56 shouldBeNull("context.getActiveUniform(program, -1)");
57 glErrorShouldBe(context, context.INVALID_VALUE);
58 shouldBeNull("context.getActiveUniform(null, 0)");
59 glErrorShouldBe(context, context.INVALID_VALUE);
60
61 // we don't know the order the attribs will appear.
62 var info = [
63 context.getActiveAttrib(program, 0),
64 context.getActiveAttrib(program, 1)
65 ];
66 for (var ii = 0; ii < info.length; ++ii)
67 shouldBeNonNull("info[ii]");
68
69 var expected = [
70 { name: 'a_normal', type: context.FLOAT_VEC3, size: 1 },
71 { name: 'a_vertex', type: context.FLOAT_VEC4, size: 1 }
72 ];
73
74 if (info[0].name != expected[0].name) {
75 t = info[0];
76 info[0] = info[1];
77 info[1] = t;
78 }
79
80 for (var ii = 0; ii < info.length; ++ii) {
81 shouldBe("info[ii].name", "expected[ii].name");
82 shouldBe("info[ii].type", "expected[ii].type");
83 shouldBe("info[ii].size", "expected[ii].size");
84 }
85
86 // we don't know the order the uniforms will appear.
87 var info2 = [
88 context2.getActiveUniform(program2, 0),
89 context2.getActiveUniform(program2, 1)
90 ];
91 for (var ii = 0; ii < info2.length; ++ii)
92 shouldBeNonNull("info2[ii]");
93
94 var expected2 = [
95 { name: 'ival', type: context2.INT, size: 1 },
96 { name: 'ival2[0]', type: context2.INT, size: 2 }
97 ];
98
99 if (info2[0].name != expected2[0].name) {
100 t = info2[0];
101 info2[0] = info2[1];
102 info2[1] = t;
103 }
104
105 for (var ii = 0; ii < info2.length; ++ii) {
106 shouldBe("info2[ii].name", "expected2[ii].name");
107 shouldBe("info2[ii].type", "expected2[ii].type");
108 shouldBe("info2[ii].size", "expected2[ii].size");
109 }
110
111 shouldBeNull("context.getActiveAttrib(program, 2)");
112 glErrorShouldBe(context, context.INVALID_VALUE);
113 shouldBeNull("context.getActiveAttrib(program, -1)");
114 glErrorShouldBe(context, context.INVALID_VALUE);
115 shouldBeNull("context.getActiveAttrib(null, 0)");
116 glErrorShouldBe(context, context.INVALID_VALUE);
117
118 glErrorShouldBe(context2, context.NO_ERROR);
119
120 debug("Check trying to get attribs from different context");
121 shouldBeNull("context2.getActiveAttrib(program, 0)");
122 glErrorShouldBe(context2, context2.INVALID_OPERATION);
123 shouldBeNull("context2.getActiveUniform(program, 0)");
124 glErrorShouldBe(context2, context2.INVALID_OPERATION);
125
126 debug("Check trying to get attribs from deleted program");
127 context.deleteProgram(program);
128 shouldBeNull("context.getActiveUniform(program, 0)");
129 glErrorShouldBe(context, context.INVALID_VALUE);
130 shouldBeNull("context.getActiveAttrib(program, 0)");
131 glErrorShouldBe(context, context.INVALID_VALUE);
132
133 successfullyParsed = true;
134 </script>
135
136 <script src="../../resources/js-test-post.js"></script>
137 </body>
138 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698