PageRenderTime 45ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/gabadie/WebGL
HTML | 98 lines | 65 code | 9 blank | 24 comment | 0 complexity | 74512f68c7f22eb6113fa0b1adca7b70 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1
  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.js"></script>
  32. <script src="../resources/webgl-test-utils.js"></script>
  33. </head>
  34. <body>
  35. <div id="description"></div>
  36. <div id="console"></div>
  37. <script>
  38. "use strict";
  39. description("Tests generation of synthetic and real GL errors");
  40. var wtu = WebGLTestUtils;
  41. var context = wtu.create3DContext();
  42. var program = wtu.loadStandardProgram(context);
  43. // Other tests in this directory like getActiveTest and
  44. // incorrect-context-object-behaviour already test the raising of many
  45. // synthetic GL errors. This test verifies the raising of certain
  46. // known real GL errors, and contains a few regression tests for bugs
  47. // discovered in the synthetic error generation and in the WebGL
  48. // implementation itself.
  49. glErrorShouldBe(context, context.NO_ERROR);
  50. debug("Testing getActiveAttrib");
  51. // Synthetic OpenGL error
  52. shouldBeNull("context.getActiveAttrib(null, 2)");
  53. glErrorShouldBe(context, context.INVALID_VALUE);
  54. // Error state should be clear by this point
  55. glErrorShouldBe(context, context.NO_ERROR);
  56. // Real OpenGL error
  57. shouldBeNull("context.getActiveAttrib(program, 2)");
  58. glErrorShouldBe(context, context.INVALID_VALUE);
  59. // Error state should be clear by this point
  60. glErrorShouldBe(context, context.NO_ERROR);
  61. debug("Testing getActiveUniform");
  62. // Synthetic OpenGL error
  63. shouldBeNull("context.getActiveUniform(null, 0)");
  64. glErrorShouldBe(context, context.INVALID_VALUE);
  65. // Error state should be clear by this point
  66. glErrorShouldBe(context, context.NO_ERROR);
  67. // Real OpenGL error
  68. shouldBeNull("context.getActiveUniform(program, 50)");
  69. glErrorShouldBe(context, context.INVALID_VALUE);
  70. // Error state should be clear by this point
  71. glErrorShouldBe(context, context.NO_ERROR);
  72. debug("Testing attempts to manipulate the default framebuffer");
  73. shouldBeUndefined("context.bindFramebuffer(context.FRAMEBUFFER, null)");
  74. glErrorShouldBe(context, context.NO_ERROR);
  75. shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, null)");
  76. // Synthetic OpenGL error
  77. glErrorShouldBe(context, context.INVALID_OPERATION);
  78. // Error state should be clear by this point
  79. glErrorShouldBe(context, context.NO_ERROR);
  80. shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, null, 0)");
  81. // Synthetic OpenGL error
  82. glErrorShouldBe(context, context.INVALID_OPERATION);
  83. // Error state should be clear by this point
  84. glErrorShouldBe(context, context.NO_ERROR);
  85. var successfullyParsed = true;
  86. </script>
  87. <script src="../../resources/js-test-post.js"></script>
  88. </body>
  89. </html>