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

Side by Side Diff: LayoutTests/webgl/resources/webgl_test_files/conformance/context/constants-and-properties.html

Issue 14366040: Fixed spec compliance issues in WebGLRenderingContext. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased and retested. Created 7 years, 8 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
OLDNEW
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 <!DOCTYPE html>
1 <html> 28 <html>
2 <head> 29 <head>
3 <!-- 30 <meta charset="utf-8">
4 Copyright (c) 2009 Ilmari Heikkinen. All rights reserved. 31 <title>WebGL Constants and Properties Test</title>
5 Use of this source code is governed by a BSD-style license that can be 32 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
6 found in the LICENSE file. 33 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></s cript>
7 --> 34 <script src="../../resources/js-test-pre.js"></script>
8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 35 <script src="../resources/webgl-test.js"></script>
9 <title>WebGL Constants Test</title> 36 <script src="../resources/webgl-test-utils.js"></script>
10 <script src="resources/desktop-gl-constants.js" type="text/javascript"></script>
11 <script src="../../js/resources/js-test-pre.js"></script>
12 <script src="resources/webgl-test.js"></script>
13 </head> 37 </head>
14 <body> 38 <body>
15 <div id="description"></div> 39 <div id="description"></div>
16 <div id="console"></div> 40 <div id="console"></div>
17 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas> 41 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
18 <script> 42 <script>
19 description("This test ensures that the WebGL context has all the constants in t he specification."); 43 "use strict";
44 description("This test ensures that the WebGL context has all the constants and (non-function) properties in the specification.");
20 45
21 var constants = { 46 var constants = {
22 /* ClearBufferMask */ 47 /* ClearBufferMask */
23 DEPTH_BUFFER_BIT : 0x00000100, 48 DEPTH_BUFFER_BIT : 0x00000100,
24 STENCIL_BUFFER_BIT : 0x00000400, 49 STENCIL_BUFFER_BIT : 0x00000400,
25 COLOR_BUFFER_BIT : 0x00004000, 50 COLOR_BUFFER_BIT : 0x00004000,
26 51
27 /* BeginMode */ 52 /* BeginMode */
28 POINTS : 0x0000, 53 POINTS : 0x0000,
29 LINES : 0x0001, 54 LINES : 0x0001,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 GENERATE_MIPMAP_HINT : 0x8192, 230 GENERATE_MIPMAP_HINT : 0x8192,
206 231
207 /* DataType */ 232 /* DataType */
208 BYTE : 0x1400, 233 BYTE : 0x1400,
209 UNSIGNED_BYTE : 0x1401, 234 UNSIGNED_BYTE : 0x1401,
210 SHORT : 0x1402, 235 SHORT : 0x1402,
211 UNSIGNED_SHORT : 0x1403, 236 UNSIGNED_SHORT : 0x1403,
212 INT : 0x1404, 237 INT : 0x1404,
213 UNSIGNED_INT : 0x1405, 238 UNSIGNED_INT : 0x1405,
214 FLOAT : 0x1406, 239 FLOAT : 0x1406,
215 HALF_FLOAT_OES : 0x8D61,
216 240
217 /* PixelFormat */ 241 /* PixelFormat */
218 DEPTH_COMPONENT : 0x1902, 242 DEPTH_COMPONENT : 0x1902,
219 ALPHA : 0x1906, 243 ALPHA : 0x1906,
220 RGB : 0x1907, 244 RGB : 0x1907,
221 RGBA : 0x1908, 245 RGBA : 0x1908,
222 LUMINANCE : 0x1909, 246 LUMINANCE : 0x1909,
223 LUMINANCE_ALPHA : 0x190A, 247 LUMINANCE_ALPHA : 0x190A,
224 248
225 /* PixelType */ 249 /* PixelType */
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 INVALID_FRAMEBUFFER_OPERATION : 0x0506, 453 INVALID_FRAMEBUFFER_OPERATION : 0x0506,
430 454
431 /* WebGL-specific enums */ 455 /* WebGL-specific enums */
432 UNPACK_FLIP_Y_WEBGL : 0x9240, 456 UNPACK_FLIP_Y_WEBGL : 0x9240,
433 UNPACK_PREMULTIPLY_ALPHA_WEBGL : 0x9241, 457 UNPACK_PREMULTIPLY_ALPHA_WEBGL : 0x9241,
434 CONTEXT_LOST_WEBGL : 0x9242, 458 CONTEXT_LOST_WEBGL : 0x9242,
435 UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243, 459 UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243,
436 BROWSER_DEFAULT_WEBGL : 0x9244 460 BROWSER_DEFAULT_WEBGL : 0x9244
437 }; 461 };
438 462
463 // Other non-function properties on the WebGL object
464 var otherProperties = {
465 drawingBufferWidth : "number",
466 drawingBufferHeight : "number",
467 canvas : "implementation-dependent"
468 };
469
470 // Properties to be ignored (as a list of strings) because they were
471 // added in versions of the spec that are backward-compatible with
472 // this version
473 var ignoredProperties = [
474 ];
475
439 // Constants removed from the WebGL spec compared to ES 2.0 476 // Constants removed from the WebGL spec compared to ES 2.0
440 var removedConstants = { 477 var removedConstants = {
441 NUM_COMPRESSED_TEXTURE_FORMATS : 0x86A2, 478 NUM_COMPRESSED_TEXTURE_FORMATS : 0x86A2,
442 FIXED : 0x140C, 479 FIXED : 0x140C,
443 ACTIVE_UNIFORM_MAX_LENGTH : 0x8B87, 480 ACTIVE_UNIFORM_MAX_LENGTH : 0x8B87,
444 ACTIVE_ATTRIBUTE_MAX_LENGTH : 0x8B8A, 481 ACTIVE_ATTRIBUTE_MAX_LENGTH : 0x8B8A,
445 EXTENSIONS : 0x1F03, 482 EXTENSIONS : 0x1F03,
446 INFO_LOG_LENGTH : 0x8B84, 483 INFO_LOG_LENGTH : 0x8B84,
447 SHADER_SOURCE_LENGTH : 0x8B88, 484 SHADER_SOURCE_LENGTH : 0x8B88,
448 SHADER_COMPILER : 0x8DFA, 485 SHADER_COMPILER : 0x8DFA,
(...skipping 22 matching lines...) Expand all
471 function assertMsg_(bool, msg) { 508 function assertMsg_(bool, msg) {
472 if (!bool) // show only failures to avoid spamming result list 509 if (!bool) // show only failures to avoid spamming result list
473 assertMsg(bool, msg); 510 assertMsg(bool, msg);
474 return bool; 511 return bool;
475 } 512 }
476 513
477 debug(""); 514 debug("");
478 debug("Canvas.getContext"); 515 debug("Canvas.getContext");
479 516
480 var canvas = document.getElementById("canvas"); 517 var canvas = document.getElementById("canvas");
481 var gl = create3DContext(canvas); 518 var wtu = WebGLTestUtils;
519 var gl = wtu.create3DContext(canvas);
482 var passed = true; 520 var passed = true;
483 for (var i in constants) { 521 for (var i in constants) {
484 var r = assertProperty(gl, i) && assertMsg_(gl[i] == constants[i], "Property " +i+" value test "+gl[i]+" == "+constants[i]); 522 var r = assertProperty(gl, i) && assertMsg_(gl[i] == constants[i], "Property " +i+" value test "+gl[i]+" == "+constants[i]);
485 passed = passed && r; 523 passed = passed && r;
486 } 524 }
487 if (passed) { 525 if (passed) {
488 testPassed("All WebGL constants found to have correct values."); 526 testPassed("All WebGL constants found to have correct values.");
489 } 527 }
490 passed = true; 528 passed = true;
491 for (var i in removedConstants) { 529 for (var i in removedConstants) {
492 var r = assertNoProperty(gl, i); 530 var r = assertNoProperty(gl, i);
493 passed = passed && r; 531 passed = passed && r;
494 } 532 }
495 if (passed) { 533 if (passed) {
496 testPassed("All constants removed from WebGL spec were absent from WebGL conte xt."); 534 testPassed("All constants removed from WebGL spec were absent from WebGL conte xt.");
497 } 535 }
498 var extended = false; 536 var extended = false;
499 for (var i in gl) { 537 for (var i in gl) {
500 if (i.match(/^[^a-z]/) && constants[i] == null) { 538 if (constants[i] !== undefined) {
539 // OK; known constant
540 } else if (ignoredProperties.indexOf(i) != -1) {
541 // OK; constant that should be ignored because it was added in a later versi on of the spec
542 } else if (otherProperties[i] !== undefined &&
543 (otherProperties[i] == "implementation-dependent" || typeof gl[i] = = otherProperties[i])) {
544 // OK; known property of known type
545 } else if (typeof gl[i] != "function") {
501 if (!extended) { 546 if (!extended) {
502 extended = true; 547 extended = true;
503 debug("Also found the following extra constants:"); 548 testFailed("Also found the following extra properties:");
504 } 549 }
505 debug(i); 550 testFailed(i);
506 } 551 }
507 } 552 }
508 553
554 if (!extended) {
555 testPassed("No extra properties found on WebGL context.");
556 }
557
509 debug(""); 558 debug("");
559 var successfullyParsed = true;
510 </script> 560 </script>
511 <script src="../../js/resources/js-test-post.js"></script> 561 <script src="../../resources/js-test-post.js"></script>
512 562
513 </body> 563 </body>
514 </html> 564 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698