Bug 1945965 – remove new tab April Fools logo. r=home-newtab-reviewers,reemhamz
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / more / functions / copyTexImage2DBadArgs.html
blob802fbc971f8f3cdb3731ee44e5f3831122c90c3b
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <!--
6 Copyright (c) 2019 The Khronos Group Inc.
7 Use of this source code is governed by an MIT-style license that can be
8 found in the LICENSE.txt file.
9 -->
10 <link rel="stylesheet" type="text/css" href="../unit.css" />
11 <script type="application/javascript" src="../unit.js"></script>
12 <script type="application/javascript" src="../util.js"></script>
13 <script type="application/javascript">
15 Tests.startUnit = function () {
16 var canvas = document.getElementById('gl');
17 var gl = wrapGLContext(getGLContext(canvas));
18 return [gl];
21 Tests.setup = function(gl) {
22 var tex = gl.createTexture();
23 gl.bindTexture(gl.TEXTURE_2D, tex);
24 return [gl]
27 Tests.teardown = function(gl,tex) {
28 gl.bindTexture(gl.TEXTURE_2D, null);
29 gl.deleteTexture(tex);
32 Tests.testTexImage2D = function(gl) {
33 assertOk("height > backHeight", function(){
34 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,0, 17,1,0);
35 });
36 assertOk("width > backWidth", function(){
37 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,0, 1,17,0);
38 });
39 assertOk("x + width > backWidth", function(){
40 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16,0, 1,1,0);
41 });
42 assertOk("y + height > backHeight", function(){
43 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,16, 1,1,0);
44 });
45 assertOk("Negative X", function(){
46 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, -1,0, 1,1,0);
47 });
48 assertOk("Negative Y", function(){
49 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,-1, 1,1,0);
50 });
51 assertFail("Negative height", function(){
52 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,0, -1,1,0);
53 });
54 assertFail("Negative width", function(){
55 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,0, 1,-1,0);
56 });
57 assertFail("Non 0 border", function(){
58 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,0, 1,1,1);
59 });
60 assertFail("Negative border",function(){
61 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,0, 1,1,-1);
62 });
63 assertOk("Good Args", function(){
64 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,0, 16,16,0);
65 });
66 assertFail("NPOT texture to > level 0", function(){
67 gl.copyTexImage2D(gl.TEXTURE_2D, 1, gl.RGBA, 0,0, 15,16,0);
68 });
69 assertFail("Bad target", function(){
70 gl.copyTexImage2D(gl.FLOAT, 0, gl.RGBA, 0,0, 16,16,0);
71 });
72 assertFail("Bad internal format", function(){
73 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.FLOAT, 0,0, 16,16,0);
74 });
75 assertFail("Negative level", function(){
76 gl.copyTexImage2D(gl.TEXTURE_2D, -1, gl.RGBA, 0,0, 16,16,0);
77 });
81 Tests.endUnit = function(gl) {
84 </script>
85 <style>canvas{ position:absolute; }</style>
86 </head><body>
87 <canvas id="gl" width="16" height="16"></canvas>
88 </body></html>