PageRenderTime 58ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/sdk/tests/conformance/misc/error-reporting.html

https://github.com/JunJiang/WebGL
HTML | 97 lines | 64 code | 9 blank | 24 comment | 0 complexity | 5c384949ad358b534c66480759f2c091 MD5 | raw file
  1. <!--
  2. /*
  3. ** Copyright (c) 2012 The Khronos Group Inc.
  4. **
  5. ** Permission is hereby granted, free of charge, to any person obtaining a
  6. ** copy of this software and/or associated documentation files (the
  7. ** "Materials"), to deal in the Materials without restriction, including
  8. ** without limitation the rights to use, copy, modify, merge, publish,
  9. ** distribute, sublicense, and/or sell copies of the Materials, and to
  10. ** permit persons to whom the Materials are furnished to do so, subject to
  11. ** the following conditions:
  12. **
  13. ** The above copyright notice and this permission notice shall be included
  14. ** in all copies or substantial portions of the Materials.
  15. **
  16. ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  19. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  20. ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  21. ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  22. ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
  23. */
  24. -->
  25. <!DOCTYPE html>
  26. <html>
  27. <head>
  28. <meta charset="utf-8">
  29. <link rel="stylesheet" href="../../resources/js-test-style.css"/>
  30. <script src="../../resources/js-test-pre.js"></script>
  31. <script src="../resources/webgl-test-utils.js"></script>
  32. </head>
  33. <body>
  34. <div id="description"></div>
  35. <div id="console"></div>
  36. <script>
  37. "use strict";
  38. description("Tests generation of synthetic and real GL errors");
  39. var wtu = WebGLTestUtils;
  40. var context = wtu.create3DContext();
  41. var program = wtu.loadStandardProgram(context);
  42. // Other tests in this directory like getActiveTest and
  43. // incorrect-context-object-behaviour already test the raising of many
  44. // synthetic GL errors. This test verifies the raising of certain
  45. // known real GL errors, and contains a few regression tests for bugs
  46. // discovered in the synthetic error generation and in the WebGL
  47. // implementation itself.
  48. wtu.glErrorShouldBe(context, context.NO_ERROR);
  49. debug("Testing getActiveAttrib");
  50. // Synthetic OpenGL error
  51. shouldBeNull("context.getActiveAttrib(null, 2)");
  52. wtu.glErrorShouldBe(context, context.INVALID_VALUE);
  53. // Error state should be clear by this point
  54. wtu.glErrorShouldBe(context, context.NO_ERROR);
  55. // Real OpenGL error
  56. shouldBeNull("context.getActiveAttrib(program, 2)");
  57. wtu.glErrorShouldBe(context, context.INVALID_VALUE);
  58. // Error state should be clear by this point
  59. wtu.glErrorShouldBe(context, context.NO_ERROR);
  60. debug("Testing getActiveUniform");
  61. // Synthetic OpenGL error
  62. shouldBeNull("context.getActiveUniform(null, 0)");
  63. wtu.glErrorShouldBe(context, context.INVALID_VALUE);
  64. // Error state should be clear by this point
  65. wtu.glErrorShouldBe(context, context.NO_ERROR);
  66. // Real OpenGL error
  67. shouldBeNull("context.getActiveUniform(program, 50)");
  68. wtu.glErrorShouldBe(context, context.INVALID_VALUE);
  69. // Error state should be clear by this point
  70. wtu.glErrorShouldBe(context, context.NO_ERROR);
  71. debug("Testing attempts to manipulate the default framebuffer");
  72. shouldBeUndefined("context.bindFramebuffer(context.FRAMEBUFFER, null)");
  73. wtu.glErrorShouldBe(context, context.NO_ERROR);
  74. shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, null)");
  75. // Synthetic OpenGL error
  76. wtu.glErrorShouldBe(context, context.INVALID_OPERATION);
  77. // Error state should be clear by this point
  78. wtu.glErrorShouldBe(context, context.NO_ERROR);
  79. shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, null, 0)");
  80. // Synthetic OpenGL error
  81. wtu.glErrorShouldBe(context, context.INVALID_OPERATION);
  82. // Error state should be clear by this point
  83. wtu.glErrorShouldBe(context, context.NO_ERROR);
  84. var successfullyParsed = true;
  85. </script>
  86. <script src="../../resources/js-test-post.js"></script>
  87. </body>
  88. </html>