Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / get-active-test.html
blobf7101a30e65a6bc48df742f6ef092b573ed6535a
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script src="resources/webgl-test.js"></script>
6 </head>
7 <body>
8 <div id="description"></div>
9 <div id="console"></div>
11 <script>
12 description("Test of getActiveAttrib and getActiveUniform");
14 if (window.internals)
15 window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
17 var context = create3DContext();
18 var context2 = create3DContext();
19 var program = loadStandardProgram(context);
20 var program2 = loadProgram(context2,
21 "resources/intArrayUniformShader.vert",
22 "resources/noopUniformShader.frag");
24 glErrorShouldBe(context, context.NO_ERROR);
25 shouldBe("context.getActiveUniform(program, 0).name", "'u_modelViewProjMatrix'");
26 shouldBe("context.getActiveUniform(program, 0).type", "context.FLOAT_MAT4");
27 shouldBe("context.getActiveUniform(program, 0).size", "1");
28 shouldBeNull("context.getActiveUniform(program, 1)");
29 glErrorShouldBe(context, context.INVALID_VALUE);
30 shouldBeNull("context.getActiveUniform(program, -1)");
31 glErrorShouldBe(context, context.INVALID_VALUE);
32 shouldBeNull("context.getActiveUniform(null, 0)");
33 glErrorShouldBe(context, context.INVALID_VALUE);
35 // we don't know the order the attribs will appear.
36 var info = [
37 context.getActiveAttrib(program, 0),
38 context.getActiveAttrib(program, 1)
40 for (var ii = 0; ii < info.length; ++ii)
41 shouldBeNonNull("info[ii]");
43 var expected = [
44 { name: 'a_normal', type: context.FLOAT_VEC3, size: 1 },
45 { name: 'a_vertex', type: context.FLOAT_VEC4, size: 1 }
48 if (info[0].name != expected[0].name) {
49 t = info[0];
50 info[0] = info[1];
51 info[1] = t;
54 for (var ii = 0; ii < info.length; ++ii) {
55 shouldBe("info[ii].name", "expected[ii].name");
56 shouldBe("info[ii].type", "expected[ii].type");
57 shouldBe("info[ii].size", "expected[ii].size");
60 // we don't know the order the uniforms will appear.
61 var info2 = [
62 context2.getActiveUniform(program2, 0),
63 context2.getActiveUniform(program2, 1)
65 for (var ii = 0; ii < info2.length; ++ii)
66 shouldBeNonNull("info2[ii]");
68 var expected2 = [
69 { name: 'ival', type: context2.INT, size: 1 },
70 { name: 'ival2[0]', type: context2.INT, size: 2 }
73 if (info2[0].name != expected2[0].name) {
74 t = info2[0];
75 info2[0] = info2[1];
76 info2[1] = t;
79 for (var ii = 0; ii < info2.length; ++ii) {
80 shouldBe("info2[ii].name", "expected2[ii].name");
81 shouldBe("info2[ii].type", "expected2[ii].type");
82 shouldBe("info2[ii].size", "expected2[ii].size");
85 shouldBeNull("context.getActiveAttrib(program, 2)");
86 glErrorShouldBe(context, context.INVALID_VALUE);
87 shouldBeNull("context.getActiveAttrib(program, -1)");
88 glErrorShouldBe(context, context.INVALID_VALUE);
89 shouldBeNull("context.getActiveAttrib(null, 0)");
90 glErrorShouldBe(context, context.INVALID_VALUE);
92 glErrorShouldBe(context2, context.NO_ERROR);
94 debug("Check trying to get attribs from different context");
95 shouldBeNull("context2.getActiveAttrib(program, 0)");
96 glErrorShouldBe(context2, context2.INVALID_OPERATION);
97 shouldBeNull("context2.getActiveUniform(program, 0)");
98 glErrorShouldBe(context2, context2.INVALID_OPERATION);
100 debug("Check trying to get attribs from deleted program");
101 context.deleteProgram(program);
102 shouldBeNull("context.getActiveUniform(program, 0)");
103 glErrorShouldBe(context, context.INVALID_VALUE);
104 shouldBeNull("context.getActiveAttrib(program, 0)");
105 glErrorShouldBe(context, context.INVALID_VALUE);
106 </script>
108 </body>
109 </html>