1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES Utilities
3 * ------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 goog.provide('functional.gles3.es3fStringQueryTests');
23 goog.require('framework.common.tcuTestCase');
24 goog.require('functional.gles3.es3fApiCase');
26 goog.scope(function() {
27 var es3fStringQueryTests = functional.gles3.es3fStringQueryTests;
28 var tcuTestCase = framework.common.tcuTestCase;
29 var es3fApiCase = functional.gles3.es3fApiCase;
33 * @extends {tcuTestCase.DeqpTest}
35 es3fStringQueryTests.StringQueryTests = function() {
36 tcuTestCase.DeqpTest.call(this, 'string', 'String Query tests');
39 es3fStringQueryTests.StringQueryTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype);
40 es3fStringQueryTests.StringQueryTests.prototype.constructor = es3fStringQueryTests.StringQueryTests;
42 es3fStringQueryTests.StringQueryTests.prototype.init = function() {
43 this.addChild(new es3fApiCase.ApiCaseCallback('renderer', 'RENDERER', gl, function() {
44 var string = /** @type {string} */ (gl.getParameter(gl.RENDERER));
45 this.check(string !== null,
46 'Got invalid string: ' + string);
49 this.addChild(new es3fApiCase.ApiCaseCallback('vendor', 'VENDOR', gl, function() {
50 var string = /** @type {string} */ (gl.getParameter(gl.VENDOR));
51 this.check(string !== null,
52 'Got invalid string: ' + string);
55 this.addChild(new es3fApiCase.ApiCaseCallback('version', 'VERSION', gl, function() {
56 var string = /** @type {string} */ (gl.getParameter(gl.VERSION));
57 /** @type {string} */ var referenceString = 'WebGL 2.0';
59 this.check(string !== null && string.indexOf(referenceString) === 0,
60 'Got invalid string prefix: ' + string + ' expected: ' + referenceString);
63 this.addChild(new es3fApiCase.ApiCaseCallback('shading_language_version', 'SHADING_LANGUAGE_VERSION', gl, function() {
64 var string = /** @type {string} */ (gl.getParameter(gl.SHADING_LANGUAGE_VERSION));
65 /** @type {string} */ var referenceString = 'WebGL GLSL ES 3.00';
67 this.check(string !== null, 'Got invalid string');
68 this.check(string.indexOf(referenceString) === 0, 'Got invalid string prefix');
71 this.addChild(new es3fApiCase.ApiCaseCallback('extensions', 'EXTENSIONS', gl, function() {
72 /** @type {Array<string>} */ var extensions = gl.getSupportedExtensions();
73 this.check(extensions !== null, 'Got invalid string');
75 // [dag] check that all extensions from gl.getSupportedExtensions() are found using gl.getExtension()
76 for (var i in extensions) {
77 /** @type {Object} */ var extension = gl.getExtension(extensions[i]);
78 this.check(extension !== null, 'Advertised extension ' + extensions[i] + ' not found');
81 // [dag] check that gl.getExtension() returns null for items not in gl.getSupportedExtensions()
82 this.check(gl.getExtension('Random_String') === null, 'Extension query methods are not consistent.');
89 * @param {WebGL2RenderingContext} context
91 es3fStringQueryTests.run = function(context) {
93 //Set up Test Root parameters
94 var state = tcuTestCase.runner;
95 state.setRoot(new es3fStringQueryTests.StringQueryTests());
97 //Set up name and description of this test series.
98 setCurrentTestName(state.testCases.fullName());
99 description(state.testCases.getDescription());
103 tcuTestCase.runTestCases();
106 testFailedOptions('Failed to es3fStringQueryTests.run tests', false);
107 tcuTestCase.runner.terminate();