1/* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import app from '@system.app' 16 17import { 18 describe, 19 beforeAll, 20 beforeEach, 21 afterEach, 22 afterAll, 23 it, 24 expect 25} from 'deccjsunit/index' 26 27describe('webgl1Test_webgl5', function() { 28 console.info('webgltest start'); 29 var gl; 30 var gl2; 31 32 var indices = new Uint16Array([0, 1, 2, 1, 3, 4]); 33 var vertices = new Uint16Array([ 34 -0.5, 0.5, 0.0, 35 0.0, 0.5, 0.0, 36 -0.25, 0.25, 0.0, 37 0.5, 0.5, 0.0, 38 0.25, 0.25, 0.0, 39 ]) 40 41 //顶点着色器程序 42 var VSHADER_SOURCE = 43 "attribute vec4 a_Position;" + 44 "void main() {" + 45 //设置坐标 46 "gl_Position = a_Position; " + 47 // "gl_PointSize = 10.0;" + 48 "} "; 49 50 //片元着色器 51 var FSHADER_SOURCE = 52 "void main() {" + 53 //设置颜色 54 "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);" + 55 "}"; 56 57 function globalFunction() { 58 const vertexShader = gl.createShader(gl.VERTEX_SHADER); 59 gl.shaderSource(vertexShader, VSHADER_SOURCE); 60 gl.compileShader(vertexShader); 61 const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); 62 gl.shaderSource(fragmentShader, FSHADER_SOURCE); 63 gl.compileShader(fragmentShader); 64 const programObj = gl.createProgram(); 65 console.info("testUseProgram has failed for " + programObj) 66 const useProgramError1 = gl.getError(); 67 console.info("useProgramError: " + useProgramError1); 68 const renderBufferValue1 = gl.getParameter(gl.CURRENT_PROGRAM); 69 console.info("testUseProgram has failed for " + renderBufferValue1) 70 gl.attachShader(programObj, vertexShader); 71 gl.attachShader(programObj, fragmentShader); 72 gl.linkProgram(programObj); 73 gl.useProgram(programObj); 74 return programObj; 75 } 76 77 78 function createProgram(gl) { 79 //顶点着色器程序 80 var VSHADER_SOURCE = 81 'attribute vec4 a_Position;\n' + 82 'void main() {\n' + 83 ' gl_Position = a_Position;\n' + 84 '}\n'; 85 86 // 片元着色器程序 87 var FSHADER_SOURCE = 88 'precision mediump float;\n' + 89 'uniform vec4 u_FragColor;\n' + 90 'void main() {\n' + 91 ' gl_FragColor = u_FragColor;\n' + 92 '}\n'; 93 var vertexShader = gl.createShader(gl.VERTEX_SHADER); 94 gl.shaderSource(vertexShader, VSHADER_SOURCE); 95 gl.compileShader(vertexShader); 96 var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); 97 gl.shaderSource(fragmentShader, FSHADER_SOURCE); 98 gl.compileShader(fragmentShader); 99 const programObj = gl.createProgram(); 100 console.log("testUseProgram has failed for " + programObj) 101 const useProgramError1 = gl.getError(); 102 console.info("useProgramError: " + useProgramError1); 103 const renderBufferValue1 = gl.getParameter(gl.CURRENT_PROGRAM); 104 console.log("testUseProgram has failed for " + renderBufferValue1) 105 gl.attachShader(programObj, vertexShader); 106 gl.attachShader(programObj, fragmentShader); 107 gl.linkProgram(programObj); 108 gl.useProgram(programObj); 109 return programObj; 110 } 111 112 function initShaders(gl, vshader, fshader) { 113 var program = createProgramExternal(gl, vshader, fshader); 114 console.log("======createProgram program: " + JSON.stringify(program)); 115 116 if (!program) { 117 console.log('Failed to create program'); 118 return false; 119 } 120 121 gl.useProgram(program); 122 gl.program = program; 123 124 return true; 125 } 126 127 function createProgramExternal(gl, vshader, fshader) { 128 // Create shader object 129 var vertexShader = loadShader(gl, gl.VERTEX_SHADER, vshader); 130 console.log("======vertexShader: " + vertexShader); 131 var fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fshader); 132 if (!vertexShader || !fragmentShader) { 133 return null; 134 } 135 136 // Create a program object 137 var program = gl.createProgram(); 138 console.log("======createProgram program: " + JSON.stringify(program)); 139 140 if (!program) { 141 return null; 142 } 143 144 // Attach the shader objects 145 gl.attachShader(program, vertexShader); 146 gl.attachShader(program, fragmentShader); 147 148 // Link the program object 149 gl.linkProgram(program); 150 151 // Check the result of linking 152 var linked = gl.getProgramParameter(program, 0x8B82); 153 console.log("======getProgramParameter linked: " + linked); 154 155 const getUniformLocationValue = gl.getUniformLocation(program, "a_Position"); 156 console.log("======getUniformLocation: " + JSON.stringify(getUniformLocationValue)); 157 158 159 if (!linked) { 160 var error = gl.getProgramInfoLog(program); 161 console.log('Failed to link program: ' + error); 162 gl.deleteProgram(program); 163 gl.deleteShader(fragmentShader); 164 gl.deleteShader(vertexShader); 165 return null; 166 } 167 168 return program; 169 } 170 171 function loadShader(gl, type, source) { 172 console.log("======into loadShader===="); 173 // Create shader object 174 var shader = gl.createShader(type); 175 if (shader == null) { 176 console.log('unable to create shader'); 177 return null; 178 } 179 180 const isShaderValue = gl.isShader(shader); 181 console.log('isShader: ' + isShaderValue); 182 183 // Set the shader program 184 gl.shaderSource(shader, source); 185 186 // Compile the shader 187 gl.compileShader(shader); 188 189 // Check the result of compilation 190 var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS); 191 if (!compiled) { 192 var error = gl.getShaderInfoLog(shader); 193 console.log('Failed to compile shader: ' + error); 194 gl.deleteShader(shader); 195 return null; 196 } 197 198 var vertex = gl.getShaderParameter(shader, gl.VERTEX_SHADER); 199 console.log('getShaderParameter VERTEX_SHADER: ' + vertex); 200 201 202 return shader; 203 } 204 205 function initVertexBuffers(gl) { 206 var vertices = new Float32Array([ 207 0.0, -1.0, -0.5, 0, 0.5, 0 208 ]); 209 210 var n = 3; // 点的个数 211 212 // 创建缓冲区对象 213 var vertexBuffer = gl.createBuffer(); 214 if (!vertexBuffer) { 215 console.log('Failed to create the buffer object'); 216 return -1; 217 } 218 219 // 将缓冲区对象绑定到目标 220 gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); 221 // 向缓冲区对象写入数据 222 gl.bufferData(gl.ARRAY_BUFFER, vertices.buffer, gl.STATIC_DRAW); 223 224 var aPosition = gl.getAttribLocation(gl.program, 'a_Position'); 225 console.info("webgl# getAttribLocation getAttribLocation success:" + JSON.stringify(gl.program)); 226 console.info("webgl# getAttribLocation getAttribLocation success:" + aPosition); 227 if (aPosition < 0) { 228 console.log('Failed to get the storage location of a_Position'); 229 return -1; 230 } 231 // 将缓冲区对象分配给a_Position变量 232 gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0); 233 234 // 连接a_Position变量与分配给它的缓冲区对象 235 gl.enableVertexAttribArray(aPosition); 236 237 return n; 238 } 239 240 241 var float1 = new Float32Array([1.1, 1.2, 1.3, 1.4]); 242 var int1 = new Int8Array([1, 1, 1, 1]); 243 var uint1 = new Uint8Array([1, 1, 1, 1]); 244 var float2 = [1.1, 1.2, 1.3, 1.4]; 245 var int2 = [1, 1, 1, 1]; 246 var uint2 = [1, 1, 1, 1]; 247 248 function initContext() { 249 console.info('initContext start'); 250 // 获取canvas元素 251 const el = global.el; 252 const el2 = global.el2; 253 // 获取webgl上下文 254 gl = el.getContext('webgl'); 255 if (!gl) { 256 console.log('webgltest Failed to get the rendering context for WebGL'); 257 } 258 gl2 = el2.getContext('webgl2'); 259 if (!gl) { 260 console.log('webgltest Failed to get the rendering context for WebGL2'); 261 } 262 console.info('webgltest initContext finish'); 263 } 264 265 function deleteContext() { 266 if (gl != null) { 267 gl = null; 268 console.info("webgltest gl has null"); 269 } 270 if (gl2 != null) { 271 console.info("webgltest gl2 has null"); 272 gl2 = null; 273 } 274 } 275 276 /** 277 * run before testClass 278 */ 279 beforeAll(async function(done) { 280 console.info('webgltest beforeAll called'); 281 initContext(); 282 done(); 283 }); 284 285 /** 286 * run after testClass 287 */ 288 afterAll(async function(done) { 289 console.info('webgltest afterEach called'); 290 deleteContext(); 291 done(); 292 }) 293 294 295 /** 296 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0301 297 * @tc.name testUniform1iv3 298 * @tc.desc Test uniform1iv. 299 */ 300 it('testUniform1iv3', 0, async function(done) { 301 //initContext(); 302 console.info('jsWebGL2 uniform1iv test start ...' + JSON.stringify(gl2)); 303 const programObj = globalFunction(); 304 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 305 306 gl2.uniform1iv(uniformLocation, [1, 2]); 307 const error = gl.getError(); 308 console.info("error: " + error); 309 expect(error).assertEqual(gl.NO_ERROR); 310 done(); 311 }); 312 313 314 /** 315 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0302 316 * @tc.name testUniform1iv4 317 * @tc.desc Test uniform1iv. 318 */ 319 it('testUniform1iv4', 0, async function(done) { 320 //initContext(); 321 console.info('jsWebGL2 uniform1iv test start ...' + JSON.stringify(gl2)); 322 const programObj = globalFunction(); 323 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 324 325 gl2.uniform1iv(uniformLocation, [1, 2], 0, 0); 326 const error = gl.getError(); 327 console.info("error: " + error); 328 expect(error).assertEqual(gl.NO_ERROR); 329 done(); 330 }); 331 332 /** 333 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0303 334 * @tc.name testUniform2ivFirst 335 * @tc.desc Test uniform2iv. 336 */ 337 it('testUniform2ivFirst', 0, async function(done) { 338 //initContext(); 339 console.info('jsWebGL2 uniform2iv test start ...' + JSON.stringify(gl2)); 340 const programObj = globalFunction(); 341 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 342 343 const int32Array = new Int32Array([1, 2]); 344 gl2.uniform2iv(uniformLocation, int32Array); 345 const error = gl.getError(); 346 console.info("error: " + error); 347 expect(error).assertEqual(gl.NO_ERROR); 348 done(); 349 }); 350 351 352 /** 353 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0304 354 * @tc.name testUniform2ivSecond 355 * @tc.desc Test uniform2iv. 356 */ 357 it('testUniform2ivSecond', 0, async function(done) { 358 //initContext(); 359 console.info('jsWebGL2 uniform2iv test start ...' + JSON.stringify(gl2)); 360 const programObj = globalFunction(); 361 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 362 363 const int32Array = new Int32Array([1, 2]); 364 gl2.uniform2iv(uniformLocation, int32Array, 0, 0); 365 const error = gl.getError(); 366 console.info("error: " + error); 367 expect(error).assertEqual(gl.NO_ERROR); 368 done(); 369 }); 370 371 372 /** 373 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0305 374 * @tc.name testUniform2ivError 375 * @tc.desc Test uniform2iv. 376 */ 377 it('testUniform2ivError', 0, async function(done) { 378 //initContext(); 379 console.info('jsWebGL2 uniform2iv test start ...' + JSON.stringify(gl2)); 380 const programObj = gl.createProgram(); 381 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 382 383 const int32Array = new Int32Array([1, 2]); 384 gl2.uniform2iv(uniformLocation, int32Array); 385 const error = gl.getError(); 386 console.info("error: " + error); 387 expect(error).assertEqual(1282); 388 done(); 389 }); 390 391 /** 392 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0306 393 * @tc.name testUniform2iv3 394 * @tc.desc Test uniform2iv. 395 */ 396 it('testUniform2iv3', 0, async function(done) { 397 //initContext(); 398 console.info('jsWebGL2 uniform2iv test start ...' + JSON.stringify(gl2)); 399 const programObj = globalFunction(); 400 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 401 402 gl2.uniform2iv(uniformLocation, [1, 2]); 403 const error = gl.getError(); 404 console.info("error: " + error); 405 expect(error).assertEqual(gl.NO_ERROR); 406 done(); 407 }); 408 409 /** 410 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0307 411 * @tc.name testUniform2iv4 412 * @tc.desc Test uniform2iv. 413 */ 414 it('testUniform2iv4', 0, async function(done) { 415 //initContext(); 416 console.info('jsWebGL2 uniform2iv test start ...' + JSON.stringify(gl2)); 417 const programObj = globalFunction(); 418 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 419 420 gl2.uniform2iv(uniformLocation, [1, 2], 0, 0); 421 const error = gl.getError(); 422 console.info("error: " + error); 423 expect(error).assertEqual(gl.NO_ERROR); 424 done(); 425 }); 426 427 /** 428 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0308 429 * @tc.name testUniform3ivFirst 430 * @tc.desc Test uniform3iv. 431 */ 432 it('testUniform3ivFirst', 0, async function(done) { 433 //initContext(); 434 console.info('jsWebGL2 uniform3iv test start ...' + JSON.stringify(gl2)); 435 const programObj = globalFunction(); 436 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 437 438 const int32Array = new Int32Array([1, 2]); 439 gl2.uniform3iv(uniformLocation, int32Array); 440 const error = gl.getError(); 441 console.info("error: " + error); 442 expect(error).assertEqual(gl.NO_ERROR); 443 done(); 444 }); 445 446 /** 447 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0309 448 * @tc.name testUniform3ivSecond 449 * @tc.desc Test uniform3iv. 450 */ 451 it('testUniform3ivSecond', 0, async function(done) { 452 //initContext(); 453 console.info('jsWebGL2 uniform3iv test start ...' + JSON.stringify(gl2)); 454 const programObj = globalFunction(); 455 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 456 457 const int32Array = new Int32Array([1, 2]); 458 gl2.uniform3iv(uniformLocation, int32Array, 0, 0); 459 const error = gl.getError(); 460 console.info("error: " + error); 461 expect(error).assertEqual(gl.NO_ERROR); 462 done(); 463 }); 464 465 /** 466 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0310 467 * @tc.name testUniform3ivError 468 * @tc.desc Test uniform3iv. 469 */ 470 it('testUniform3ivError', 0, async function(done) { 471 //initContext(); 472 console.info('jsWebGL2 uniform3iv test start ...' + JSON.stringify(gl2)); 473 const programObj = gl.createProgram(); 474 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 475 476 const int32Array = new Int32Array([1, 2]); 477 gl2.uniform3iv(uniformLocation, int32Array); 478 const error = gl.getError(); 479 console.info("error: " + error); 480 expect(error).assertEqual(1282); 481 done(); 482 }); 483 484 /** 485 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0311 486 * @tc.name testUniform3iv3 487 * @tc.desc Test uniform3iv. 488 */ 489 it('testUniform3iv3', 0, async function(done) { 490 //initContext(); 491 console.info('jsWebGL2 uniform3iv test start ...' + JSON.stringify(gl2)); 492 const programObj = globalFunction(); 493 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 494 495 gl2.uniform3iv(uniformLocation, [1, 2]); 496 const error = gl.getError(); 497 console.info("error: " + error); 498 expect(error).assertEqual(gl.NO_ERROR); 499 done(); 500 }); 501 502 /** 503 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0312 504 * @tc.name testUniform3iv4 505 * @tc.desc Test uniform3iv. 506 */ 507 it('testUniform3iv4', 0, async function(done) { 508 //initContext(); 509 console.info('jsWebGL2 uniform3iv test start ...' + JSON.stringify(gl2)); 510 const programObj = globalFunction(); 511 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 512 513 gl2.uniform3iv(uniformLocation, [1, 2], 0, 0); 514 const error = gl.getError(); 515 console.info("error: " + error); 516 expect(error).assertEqual(gl.NO_ERROR); 517 done(); 518 }); 519 520 /** 521 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0313 522 * @tc.name testUniform4ivFirst 523 * @tc.desc Test uniform4iv. 524 */ 525 it('testUniform4ivFirst', 0, async function(done) { 526 //initContext(); 527 console.info('jsWebGL2 uniform4iv test start ...' + JSON.stringify(gl2)); 528 const programObj = globalFunction(); 529 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 530 531 const int32Array = new Int32Array([1, 2]); 532 gl2.uniform4iv(uniformLocation, int32Array); 533 const error = gl.getError(); 534 console.info("error: " + error); 535 expect(error).assertEqual(gl.NO_ERROR); 536 done(); 537 }); 538 539 /** 540 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0314 541 * @tc.name testUniform4ivSecond 542 * @tc.desc Test uniform4iv. 543 */ 544 it('testUniform4ivSecond', 0, async function(done) { 545 //initContext(); 546 console.info('jsWebGL2 uniform4iv test start ...' + JSON.stringify(gl2)); 547 const programObj = globalFunction(); 548 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 549 550 const int32Array = new Int32Array([1, 2]); 551 gl2.uniform4iv(uniformLocation, int32Array, 0, 0); 552 const error = gl.getError(); 553 console.info("error: " + error); 554 expect(error).assertEqual(gl.NO_ERROR); 555 done(); 556 }); 557 558 /** 559 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0315 560 * @tc.name testUniform4ivError 561 * @tc.desc Test uniform4iv. 562 */ 563 it('testUniform4ivError', 0, async function(done) { 564 //initContext(); 565 console.info('jsWebGL2 uniform4iv test start ...' + JSON.stringify(gl2)); 566 const programObj = gl.createProgram(); 567 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 568 569 const int32Array = new Int32Array([1, 2]); 570 gl2.uniform4iv(uniformLocation, int32Array); 571 const error = gl.getError(); 572 console.info("error: " + error); 573 expect(error).assertEqual(1282); 574 done(); 575 }); 576 577 /** 578 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0316 579 * @tc.name testUniform4iv3 580 * @tc.desc Test uniform4iv. 581 */ 582 it('testUniform4iv3', 0, async function(done) { 583 //initContext(); 584 console.info('jsWebGL2 uniform4iv test start ...' + JSON.stringify(gl2)); 585 const programObj = globalFunction(); 586 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 587 588 gl2.uniform4iv(uniformLocation, [1, 2]); 589 const error = gl.getError(); 590 console.info("error: " + error); 591 expect(error).assertEqual(gl.NO_ERROR); 592 done(); 593 }); 594 595 /** 596 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0317 597 * @tc.name testUniform4iv4 598 * @tc.desc Test uniform4iv. 599 */ 600 it('testUniform4iv4', 0, async function(done) { 601 //initContext(); 602 console.info('jsWebGL2 uniform4iv test start ...' + JSON.stringify(gl2)); 603 const programObj = globalFunction(); 604 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 605 606 gl2.uniform4iv(uniformLocation, [1, 2], 0, 0); 607 const error = gl.getError(); 608 console.info("error: " + error); 609 expect(error).assertEqual(gl.NO_ERROR); 610 done(); 611 }); 612 613 /** 614 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0318 615 * @tc.name testUniformMatrix4fvFirst 616 * @tc.desc Test uniformMatrix4fv. 617 */ 618 it('testUniformMatrix4fvFirst', 0, async function(done) { 619 //initContext(); 620 console.info('jsWebGL2 uniformMatrix4fv test start ...' + JSON.stringify(gl2)); 621 const programObj = globalFunction(); 622 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 623 624 var flaot32list = new Float32Array([1, 2]); 625 gl2.uniformMatrix4fv(uniformLocation, true, flaot32list); 626 const error = gl.getError(); 627 console.info("error: " + error); 628 expect(error).assertEqual(gl.NO_ERROR); 629 done(); 630 }); 631 632 /** 633 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0319 634 * @tc.name testUniformMatrix4fv2 635 * @tc.desc Test uniformMatrix4fv. 636 */ 637 it('testUniformMatrix4fv2', 0, async function(done) { 638 //initContext(); 639 console.info('jsWebGL2 uniformMatrix4fv test start ...' + JSON.stringify(gl2)); 640 const programObj = globalFunction(); 641 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 642 643 var flaot32list = new Float32Array([1, 2]); 644 gl2.uniformMatrix4fv(uniformLocation, true, flaot32list, 0, 0); 645 const error = gl.getError(); 646 console.info("error: " + error); 647 expect(error).assertEqual(gl.NO_ERROR); 648 done(); 649 }); 650 651 /** 652 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0320 653 * @tc.name testUniformMatrix4fvError 654 * @tc.desc Test uniformMatrix4fv. 655 */ 656 it('testUniformMatrix4fvError', 0, async function(done) { 657 //initContext(); 658 console.info('jsWebGL2 uniformMatrix4fv test start ...' + JSON.stringify(gl2)); 659 const programObj = gl.createProgram(); 660 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 661 662 var flaot32list = new Float32Array([1, 2]); 663 gl2.uniformMatrix4fv(uniformLocation, true, flaot32list); 664 const error = gl.getError(); 665 console.info("error: " + error); 666 expect(error).assertEqual(1282); 667 done(); 668 }); 669 670 /** 671 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0321 672 * @tc.name testUniformMatrix4fv3 673 * @tc.desc Test uniformMatrix4fv. 674 */ 675 it('testUniformMatrix4fv3', 0, async function(done) { 676 //initContext(); 677 console.info('jsWebGL2 uniformMatrix4fv test start ...' + JSON.stringify(gl2)); 678 const programObj = globalFunction(); 679 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 680 681 gl2.uniformMatrix4fv(uniformLocation, true, [1, 2]); 682 const error = gl.getError(); 683 console.info("error: " + error); 684 expect(error).assertEqual(gl.NO_ERROR); 685 done(); 686 }); 687 688 /** 689 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0322 690 * @tc.name testUniformMatrix4fv4 691 * @tc.desc Test uniformMatrix4fv. 692 */ 693 it('testUniformMatrix4fv4', 0, async function(done) { 694 //initContext(); 695 console.info('jsWebGL2 uniformMatrix4fv test start ...' + JSON.stringify(gl2)); 696 const programObj = globalFunction(); 697 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 698 699 gl2.uniformMatrix4fv(uniformLocation, true, [1, 2], 0, 0); 700 const error = gl.getError(); 701 console.info("error: " + error); 702 expect(error).assertEqual(gl.NO_ERROR); 703 done(); 704 }); 705 706 /** 707 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0323 708 * @tc.name testUniformMatrix3fvFirst 709 * @tc.desc Test uniformMatrix3fv. 710 */ 711 it('testUniformMatrix3fvFirst', 0, async function(done) { 712 //initContext(); 713 console.info('jsWebGL2 uniformMatrix3fv test start ...' + JSON.stringify(gl2)); 714 const programObj = globalFunction(); 715 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 716 717 var flaot32list = new Float32Array([1, 2]); 718 gl2.uniformMatrix3fv(uniformLocation, true, flaot32list); 719 720 const error = gl.getError(); 721 console.info("error: " + error); 722 expect(error).assertEqual(gl.NO_ERROR); 723 done(); 724 }); 725 726 /** 727 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0324 728 * @tc.name testUniformMatrix3fv2 729 * @tc.desc Test uniformMatrix3fv. 730 */ 731 it('testUniformMatrix3fv2', 0, async function(done) { 732 //initContext(); 733 console.info('jsWebGL2 uniformMatrix3fv test start ...' + JSON.stringify(gl2)); 734 const programObj = globalFunction(); 735 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 736 737 var flaot32list = new Float32Array([1, 2]); 738 gl2.uniformMatrix3fv(uniformLocation, true, flaot32list, 0, 0); 739 740 const error = gl.getError(); 741 console.info("error: " + error); 742 expect(error).assertEqual(gl.NO_ERROR); 743 done(); 744 }); 745 746 /** 747 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0325 748 * @tc.name testUniformMatrix3fvError 749 * @tc.desc Test uniformMatrix3fv. 750 */ 751 it('testUniformMatrix3fvError', 0, async function(done) { 752 //initContext(); 753 console.info('jsWebGL2 uniformMatrix3fv test start ...' + JSON.stringify(gl2)); 754 const programObj = gl.createProgram(); 755 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 756 757 var flaot32list = new Float32Array([1, 2]); 758 gl2.uniformMatrix3fv(uniformLocation, true, flaot32list); 759 const error = gl.getError(); 760 console.info("error: " + error); 761 expect(error).assertEqual(1282); 762 done(); 763 }); 764 765 766 /** 767 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0326 768 * @tc.name testUniformMatrix3fv3 769 * @tc.desc Test uniformMatrix3fv. 770 */ 771 it('testUniformMatrix3fv3', 0, async function(done) { 772 //initContext(); 773 console.info('jsWebGL2 uniformMatrix3fv test start ...' + JSON.stringify(gl2)); 774 const programObj = globalFunction(); 775 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 776 777 gl2.uniformMatrix3fv(uniformLocation, true, [1, 2]); 778 779 const error = gl.getError(); 780 console.info("error: " + error); 781 expect(error).assertEqual(gl.NO_ERROR); 782 done(); 783 }); 784 785 /** 786 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0327 787 * @tc.name testUniformMatrix3fv4 788 * @tc.desc Test uniformMatrix3fv. 789 */ 790 it('testUniformMatrix3fv4', 0, async function(done) { 791 //initContext(); 792 console.info('jsWebGL2 uniformMatrix3fv test start ...' + JSON.stringify(gl2)); 793 const programObj = globalFunction(); 794 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 795 796 gl2.uniformMatrix3fv(uniformLocation, true, [1, 2], 0, 0); 797 798 const error = gl.getError(); 799 console.info("error: " + error); 800 expect(error).assertEqual(gl.NO_ERROR); 801 done(); 802 }); 803 804 /** 805 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0328 806 * @tc.name testUniformMatrix2fv1 807 * @tc.desc Test uniformMatrix2fv. 808 */ 809 it('testUniformMatrix2fv1', 0, async function(done) { 810 //initContext(); 811 console.info('jsWebGL2 uniformMatrix2fv test start ...' + JSON.stringify(gl2)); 812 const programObj = globalFunction(); 813 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 814 815 var flaot32list = new Float32Array([1, 2]); 816 gl2.uniformMatrix2fv(uniformLocation, true, flaot32list); 817 818 const error = gl.getError(); 819 console.info("error: " + error); 820 expect(error).assertEqual(gl.NO_ERROR); 821 done(); 822 }); 823 824 /** 825 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0329 826 * @tc.name testUniformMatrix2fv2 827 * @tc.desc Test uniformMatrix2fv. 828 */ 829 it('testUniformMatrix2fv2', 0, async function(done) { 830 //initContext(); 831 console.info('jsWebGL2 uniformMatrix2fv test start ...' + JSON.stringify(gl2)); 832 const programObj = globalFunction(); 833 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 834 835 var flaot32list = new Float32Array([1, 2]); 836 gl2.uniformMatrix2fv(uniformLocation, true, flaot32list, 0, 0); 837 838 const error = gl.getError(); 839 console.info("error: " + error); 840 expect(error).assertEqual(gl.NO_ERROR); 841 done(); 842 }); 843 844 845 /** 846 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0330 847 * @tc.name testUniformMatrix2fvError 848 * @tc.desc Test uniformMatrix2fv. 849 */ 850 it('testUniformMatrix2fvError', 0, async function(done) { 851 //initContext(); 852 console.info('jsWebGL2 uniformMatrix2fv test start ...' + JSON.stringify(gl2)); 853 const programObj = gl.createProgram(); 854 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 855 856 var flaot32list = new Float32Array([1, 2]); 857 gl2.uniformMatrix2fv(uniformLocation, true, flaot32list); 858 const error = gl.getError(); 859 console.info("error: " + error); 860 expect(error).assertEqual(1282); 861 done(); 862 }); 863 864 /** 865 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0331 866 * @tc.name testUniformMatrix2fv3 867 * @tc.desc Test uniformMatrix2fv. 868 */ 869 it('testUniformMatrix2fv3', 0, async function(done) { 870 //initContext(); 871 console.info('jsWebGL2 uniformMatrix2fv test start ...' + JSON.stringify(gl2)); 872 const programObj = globalFunction(); 873 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 874 875 gl2.uniformMatrix2fv(uniformLocation, true, [1, 2]); 876 877 const error = gl.getError(); 878 console.info("error: " + error); 879 expect(error).assertEqual(gl.NO_ERROR); 880 done(); 881 }); 882 883 /** 884 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0332 885 * @tc.name testUniformMatrix2fv4 886 * @tc.desc Test uniformMatrix2fv. 887 */ 888 it('testUniformMatrix2fv4', 0, async function(done) { 889 //initContext(); 890 console.info('jsWebGL2 uniformMatrix2fv test start ...' + JSON.stringify(gl2)); 891 const programObj = globalFunction(); 892 const uniformLocation = gl.getUniformLocation(programObj, "a_Position"); 893 894 gl2.uniformMatrix2fv(uniformLocation, true, [1, 2], 0, 0); 895 896 const error = gl.getError(); 897 console.info("error: " + error); 898 expect(error).assertEqual(gl.NO_ERROR); 899 done(); 900 }); 901 902 /** 903 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0333 904 * @tc.name testBufferData1 905 * @tc.desc Test bufferData. 906 */ 907 it('testBufferData1', 0, async function(done) { 908 //initContext(); 909 console.info('jsWebGL2 bufferData test start ...' + JSON.stringify(gl2)); 910 const buffer = gl.createBuffer(); 911 gl.bindBuffer(gl.ARRAY_BUFFER, buffer); 912 gl2.bufferData(gl.ARRAY_BUFFER, 1024, gl.STATIC_DRAW); 913 const bufferSize = gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE); 914 console.info('bufferSize' + bufferSize); 915 expect(bufferSize).assertEqual(1024); 916 done(); 917 }); 918 919 /** 920 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0334 921 * @tc.name testBufferData2 922 * @tc.desc Test bufferData. 923 */ 924 it('testBufferData2', 0, async function(done) { 925 //initContext(); 926 console.info('jsWebGL2 bufferData test start ...' + JSON.stringify(gl2)); 927 const buffer = gl.createBuffer(); 928 gl.bindBuffer(gl.ARRAY_BUFFER, buffer); 929 gl2.bufferData(gl.ARRAY_BUFFER, 1024, gl.STATIC_DRAW); 930 const bufferUsage = gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_USAGE); 931 console.info('bufferUsage' + bufferUsage); 932 expect(bufferUsage).assertEqual(gl.STATIC_DRAW); 933 done(); 934 }); 935 936 /** 937 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0335 938 * @tc.name testBufferData3 939 * @tc.desc Test bufferData. 940 */ 941 it('testBufferData3', 0, async function(done) { 942 //initContext(); 943 console.info('jsWebGL2 bufferData test start ...' + JSON.stringify(gl2)); 944 gl2.bufferData(gl.ELEMENT_ARRAY_BUFFER, new ArrayBuffer(8), gl.DYNAMIC_READ); 945 const errorCode = gl.getError(); 946 console.info("webgltest bufferData getError: " + errorCode); 947 expect(errorCode).assertEqual(gl.NO_ERROR); 948 done(); 949 }); 950 951 /** 952 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0336 953 * @tc.name testBufferData4 954 * @tc.desc Test bufferData. 955 */ 956 it('testBufferData4', 0, async function(done) { 957 //initContext(); 958 console.info('jsWebGL2 bufferData test start ...' + JSON.stringify(gl2)); 959 gl2.bufferData(gl.ELEMENT_ARRAY_BUFFER, new ArrayBuffer(8), gl.DYNAMIC_READ, 0, 0); 960 const errorCode = gl.getError(); 961 console.info("webgl2test bufferData getError: " + errorCode); 962 expect(errorCode).assertEqual(gl.NO_ERROR); 963 done(); 964 }); 965 966 /** 967 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0337 968 * @tc.name testBufferDataError 969 * @tc.desc Test bufferData. 970 */ 971 it('testBufferDataError', 0, async function(done) { 972 //initContext(); 973 console.info('jsWebGL2 bufferData test start ...' + JSON.stringify(gl2)); 974 gl2.bufferData(1024, gl.STATIC_DRAW); 975 const bufferSize = gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE); 976 console.info('bufferSize' + bufferSize); 977 const type = (bufferSize === 1024) 978 expect(type).assertEqual(true); 979 done(); 980 }); 981 982 /** 983 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0338 984 * @tc.name testBufferSubData 985 * @tc.desc Test bufferData. 986 */ 987 it('testBufferSubData', 0, async function(done) { 988 //initContext(); 989 console.info('jsWebGL2 bufferData test start ...' + JSON.stringify(gl2)); 990 gl2.bufferSubData(gl.COPY_READ_BUFFER, 512, new ArrayBuffer(8)); 991 const errorCode = gl.getError(); 992 console.info("webgl2test bufferSubData getError: " + errorCode); 993 expect(errorCode).assertEqual(gl.NO_ERROR); 994 done(); 995 }); 996 997 /** 998 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0339 999 * @tc.name testBufferSubData2 1000 * @tc.desc Test bufferData. 1001 */ 1002 it('testBufferSubData2', 0, async function(done) { 1003 //initContext(); 1004 console.info('jsWebGL2 bufferData test start ...' + JSON.stringify(gl2)); 1005 gl2.bufferSubData(gl.COPY_READ_BUFFER, 512, new ArrayBuffer(8), 0, 0); 1006 const errorCode = gl.getError(); 1007 console.info("webgl2test bufferSubData getError: " + errorCode); 1008 expect(errorCode).assertEqual(gl.NO_ERROR); 1009 done(); 1010 }); 1011 1012 /** 1013 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0340 1014 * @tc.name testTexImage2D 1015 * @tc.desc Test texImage2D. 1016 */ 1017 it('testTexImage2D', 0, async function(done) { 1018 //initContext(); 1019 console.info('jsWebGL2 texImage2D test start ...' + JSON.stringify(gl2)); 1020 var buffer = new ArrayBuffer(8); 1021 var view = new DataView(buffer, 0); 1022 view.setInt16(1, 42); 1023 gl2.texImage2D(gl2.TEXTURE_2D, 0, 32, 512, 512, 0, 32, 32, view); 1024 const errorCode = gl.getError(); 1025 console.info("webgl2test texImage2D getError: " + errorCode); 1026 expect(errorCode).assertEqual(gl.NO_ERROR); 1027 done(); 1028 }); 1029 1030 1031 /** 1032 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0341 1033 * @tc.name testTexImage2D2 1034 * @tc.desc Test texImage2D. 1035 */ 1036 it('testTexImage2D2', 0, async function(done) { 1037 //initContext(); 1038 console.info('jsWebGL2 texImage2D test start ...' + JSON.stringify(gl2)); 1039 gl2.texImage2D(gl2.TEXTURE_2D, 0, gl.RGB8, 512, 512, 0, gl.RGB, gl.UNSIGNED_BYTE, 0); 1040 const errorCode = gl.getError(); 1041 console.info("webgl2test texImage2D getError: " + errorCode); 1042 expect(errorCode).assertEqual(gl.NO_ERROR); 1043 done(); 1044 }); 1045 1046 /** 1047 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0342 1048 * @tc.name testTexImage2D3 1049 * @tc.desc Test texImage2D. 1050 */ 1051 it('testTexImage2D3', 0, async function(done) { 1052 //initContext(); 1053 console.info('jsWebGL2 texImage2D test start ...' + JSON.stringify(gl2)); 1054 var buffer = new ArrayBuffer(8); 1055 var view = new DataView(buffer, 0); 1056 view.setInt16(1, 42); 1057 gl2.texImage2D(gl2.TEXTURE_2D, 0, gl.R16F, 512, 512, 0, gl.RED, gl.FLOAT, view, 0); 1058 const errorCode = gl.getError(); 1059 console.info("webgl2test texImage2D getError: " + errorCode); 1060 expect(errorCode).assertEqual(gl.NO_ERROR); 1061 done(); 1062 }); 1063 1064 /** 1065 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0343 1066 * @tc.name testTexImage2D4 1067 * @tc.desc Test frontFace. 1068 */ 1069 it('testTexImage2D4', 0, async function(done) { 1070 //initContext(); 1071 console.info('jsWebGL2 texImage2D test start ...' + JSON.stringify(gl2)); 1072 var buffer = new ArrayBuffer(8); 1073 var view = new DataView(buffer, 0); 1074 view.setInt16(1, 42); 1075 gl2.texImage2D(gl2.TEXTURE_2D, 0, gl.R16F, 512, 512, 0, gl.RED, gl.FLOAT, view, 0); 1076 const errorCode = gl.getError(); 1077 console.info("webgl2test texImage2D getError: " + errorCode); 1078 expect(errorCode).assertEqual(gl.NO_ERROR); 1079 done(); 1080 }); 1081 1082 /** 1083 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0344 1084 * @tc.name testTexSubImage2D5 1085 * @tc.desc Test texSubImage2D. 1086 */ 1087 it('testTexSubImage2D5', 0, async function(done) { 1088 //initContext(); 1089 console.info('jsWebGL2 texSubImage2D test start ...' + JSON.stringify(gl2)); 1090 var buffer = new ArrayBuffer(8); 1091 var view = new DataView(buffer, 0); 1092 view.setInt16(1, 42); 1093 gl2.texSubImage2D(gl2.TEXTURE_2D, 0, 0, 0, 512, 512, gl.RED, gl.FLOAT, view, 0); 1094 const errorCode = gl.getError(); 1095 console.info("webgl2test texSubImage2D getError: " + errorCode); 1096 expect(errorCode).assertEqual(gl.NO_ERROR); 1097 done(); 1098 }); 1099 1100 /** 1101 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0345 1102 * @tc.name testTexSubImage2D6 1103 * @tc.desc Test texSubImage2D. 1104 */ 1105 it('testTexSubImage2D6', 0, async function(done) { 1106 //initContext(); 1107 console.info('jsWebGL2 texSubImage2D test start ...' + JSON.stringify(gl2)); 1108 gl2.texSubImage2D(gl2.TEXTURE_2D, 0, 0, 0, 512, 512, gl.RED, gl.FLOAT, 0); 1109 const errorCode = gl.getError(); 1110 console.info("webgl2test texSubImage2D getError: " + errorCode); 1111 expect(errorCode).assertEqual(gl.NO_ERROR); 1112 done(); 1113 }); 1114 1115 /** 1116 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0346 1117 * @tc.name testTexSubImage2D7 1118 * @tc.desc Test texSubImage2D. 1119 */ 1120 it('testTexSubImage2D7', 0, async function(done) { 1121 //initContext(); 1122 console.info('jsWebGL2 texSubImage2D test start ...' + JSON.stringify(gl2)); 1123 var buffer = new ArrayBuffer(8); 1124 var view = new DataView(buffer, 0); 1125 view.setInt16(1, 42); 1126 gl2.texSubImage2D(gl2.TEXTURE_2D, 0, 0, 0, 512, 512, gl.RGBA, gl.UNSIGNED_BYTE, view); 1127 const errorCode = gl.getError(); 1128 console.info("webgl2test texSubImage2D getError: " + errorCode); 1129 expect(errorCode).assertEqual(gl.NO_ERROR); 1130 done(); 1131 }); 1132 1133 /** 1134 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0347 1135 * @tc.name testTexSubImage2D8 1136 * @tc.desc Test texSubImage2D. 1137 */ 1138 it('testTexSubImage2D8', 0, async function(done) { 1139 //initContext(); 1140 console.info('jsWebGL2 texSubImage2D test start ...' + JSON.stringify(gl2)); 1141 var buffer = new ArrayBuffer(8); 1142 var view = new DataView(buffer, 0); 1143 view.setInt16(1, 42); 1144 gl2.texSubImage2D(gl2.TEXTURE_2D, 0, 0, 0, 512, 512, gl.RGBA, gl.UNSIGNED_BYTE, view); 1145 const errorCode = gl.getError(); 1146 console.info("webgl2test texSubImage2D getError: " + errorCode); 1147 expect(errorCode).assertEqual(gl.NO_ERROR); 1148 done(); 1149 }); 1150 1151 /** 1152 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0348 1153 * @tc.name testCompressedTexImage2D9 1154 * @tc.desc Test compressedTexImage2D. 1155 */ 1156 it('testCompressedTexImage2D9', 0, async function(done) { 1157 //initContext(); 1158 console.info('jsWebGL2 compressedTexImage2D test start ...' + JSON.stringify(gl2)); 1159 gl2.compressedTexImage2D(gl2.TEXTURE_2D, 0, 0x83F3, 512, 512, 0, gl.PIXEL_UNPACK_BUFFER, 0); 1160 const errorCode = gl.getError(); 1161 console.info("webgl2test compressedTexImage2D getError: " + errorCode); 1162 expect(errorCode).assertEqual(gl.NO_ERROR); 1163 done(); 1164 }); 1165 1166 /** 1167 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0349 1168 * @tc.name testCompressedTexImage2D11 1169 * @tc.desc Test compressedTexImage2D. 1170 */ 1171 it('testCompressedTexImage2D11', 0, async function(done) { 1172 //initContext(); 1173 console.info('jsWebGL2 compressedTexImage2D test start ...' + JSON.stringify(gl2)); 1174 var buffer = new ArrayBuffer(8); 1175 var view = new DataView(buffer, 0); 1176 view.setInt16(1, 42); 1177 gl2.compressedTexImage2D(gl2.TEXTURE_2D, 0, 0x83F3, 512, 512, 0, view, 0, 0); 1178 const errorCode = gl.getError(); 1179 console.info("webgl2test compressedTexImage2D getError: " + errorCode); 1180 expect(errorCode).assertEqual(gl.NO_ERROR); 1181 done(); 1182 }); 1183 1184 1185 /** 1186 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0350 1187 * @tc.name testCompressedTexSubImage2D12 1188 * @tc.desc Test compressedTexSubImage2D. 1189 */ 1190 it('testCompressedTexSubImage2D12', 0, async function(done) { 1191 //initContext(); 1192 console.info('jsWebGL2 compressedTexSubImage2D test start ...' + JSON.stringify(gl2)); 1193 gl2.compressedTexSubImage2D(gl2.TEXTURE_2D, 0, 256, 256, 512, 512, 0x83F3, gl 1194 .PIXEL_UNPACK_BUFFER, 0); 1195 const errorCode = gl.getError(); 1196 console.info("webgl2test compressedTexSubImage2D getError: " + errorCode); 1197 expect(errorCode).assertEqual(gl.NO_ERROR); 1198 done(); 1199 }); 1200 1201 1202 /** 1203 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0351 1204 * @tc.name testCompressedTexSubImage2D13 1205 * @tc.desc Test compressedTexSubImage2D. 1206 */ 1207 it('testCompressedTexSubImage2D13', 0, async function(done) { 1208 //initContext(); 1209 console.info('jsWebGL2 compressedTexSubImage2D test start ...' + JSON.stringify(gl2)); 1210 var buffer = new ArrayBuffer(8); 1211 var view = new DataView(buffer, 0); 1212 view.setInt16(1, 42); 1213 gl2.compressedTexSubImage2D(gl2.TEXTURE_2D, 0, 256, 256, 512, 512, 0x83F3, view, 0, 0); 1214 const errorCode = gl.getError(); 1215 console.info("webgl2test compressedTexSubImage2D getError: " + errorCode); 1216 expect(errorCode).assertEqual(gl.NO_ERROR); 1217 done(); 1218 }); 1219 1220 /** 1221 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0352 1222 * @tc.name testReadPixelsFirst 1223 * @tc.desc Test readPixels. 1224 */ 1225 it('testReadPixelsFirst', 0, async function(done) { 1226 //initContext(); 1227 console.info('jsWebGL2 readPixels test start ...' + JSON.stringify(gl2)); 1228 var buffer = new ArrayBuffer(8); 1229 var view = new DataView(buffer, 0); 1230 view.setInt16(1, 42); 1231 gl2.readPixels(0, 0, 512, 512, gl2.RGBA, gl2.UNSIGNED_BYTE, view); 1232 const errorCode = gl.getError(); 1233 console.info("webgl2test readPixels getError: " + errorCode); 1234 expect(errorCode).assertEqual(gl.NO_ERROR); 1235 done(); 1236 }); 1237 1238 /** 1239 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0353 1240 * @tc.name testReadPixelsSecond 1241 * @tc.desc Test readPixels. 1242 */ 1243 it('testReadPixelsSecond', 0, async function(done) { 1244 //initContext(); 1245 console.info('jsWebGL2 readPixels test start ...' + JSON.stringify(gl2)); 1246 gl2.readPixels(0, 0, 512, 512, gl2.RGBA, gl2.UNSIGNED_BYTE, 0); 1247 const errorCode = gl.getError(); 1248 console.info("webgl2test readPixels getError: " + errorCode); 1249 expect(errorCode).assertEqual(gl.NO_ERROR); 1250 done(); 1251 }); 1252 1253 /** 1254 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0354 1255 * @tc.name testReadPixelsThird 1256 * @tc.desc Test readPixels. 1257 */ 1258 it('testReadPixelsThird', 0, async function(done) { 1259 //initContext(); 1260 console.info('jsWebGL2 readPixels test start ...' + JSON.stringify(gl2)); 1261 var buffer = new ArrayBuffer(8); 1262 var view = new DataView(buffer, 0); 1263 view.setInt16(1, 42); 1264 gl2.readPixels(0, 0, 512, 512, gl2.RGBA, gl2.UNSIGNED_BYTE, view, 0); 1265 const errorCode = gl.getError(); 1266 console.info("webgl2test readPixels getError: " + errorCode); 1267 expect(errorCode).assertEqual(gl.NO_ERROR); 1268 done(); 1269 }); 1270 1271 /** 1272 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0355 1273 * @tc.name testReadPixelsError 1274 * @tc.desc Test readPixels. 1275 */ 1276 it('testReadPixelsError', 0, async function(done) { 1277 //initContext(); 1278 console.info('jsWebGL2 readPixels test start ...' + JSON.stringify(gl2)); 1279 var buffer = new ArrayBuffer(8); 1280 var view = new DataView(buffer, 0); 1281 view.setInt16(1, 42); 1282 const returnVale = gl2.readPixels(0, 0, 512, 512, gl2.RGBA, gl2.UNSIGNED_BYTE, view, 0); 1283 const errorCode = gl.getError(); 1284 console.info("webgl2test readPixels getError: " + errorCode); 1285 const type = 1286 expect(errorCode).assertEqual(gl.NO_ERROR); 1287 done(); 1288 }); 1289 1290/* 1291 * ***************************************** GT ************************************************ 1292 */ 1293 1294 /** 1295 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0356 1296 * @tc.name testIsFramebuffer 1297 * @tc.desc Test isFramebuffer. 1298 */ 1299 it('testIsFramebuffer', 0, async function(done) { 1300 //initContext(); 1301 try { 1302 console.info('jsWebGL testIsFramebuffer test start ...66'); 1303 var framebuffer = gl.createFramebuffer(); 1304 const isFramebuffer = gl.isFramebuffer(framebuffer); 1305 console.info("createFramebuffer --> isFramebuffer: " + isFramebuffer); 1306 expect(isFramebuffer).assertEqual(false); 1307 //deleteContext(); 1308 done(); 1309 } catch (e) { 1310 console.log("testIsFramebuffer has failed for " + e) 1311 expect(null).assertFail() 1312 } 1313 }) 1314 1315 /** 1316 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0357 1317 * @tc.name testIsFramebuffer_01 1318 * @tc.desc Test isFramebuffer. 1319 */ 1320 it('testIsFramebuffer_01', 0, async function(done) { 1321 //initContext(); 1322 try { 1323 console.info('jsWebGL testIsFramebuffer_01 test start ...66'); 1324 var framebuffer = gl.createFramebuffer(); 1325 gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); 1326 const isFramebuffer = gl.isFramebuffer(framebuffer); 1327 console.info("createFramebuffer --> bindFramebuffer --> isFramebuffer: " + 1328 isFramebuffer); 1329 expect(isFramebuffer).assertEqual(true); 1330 //deleteContext(); 1331 done(); 1332 } catch (e) { 1333 console.log("testIsFramebuffer_01 has failed for " + e) 1334 expect(null).assertFail() 1335 } 1336 }) 1337 1338 /** 1339 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0358 1340 * @tc.name testIsFramebuffer_02 1341 * @tc.desc Test isFramebuffer. 1342 */ 1343 it('testIsFramebuffer_02', 0, async function(done) { 1344 //initContext(); 1345 try { 1346 console.info('jsWebGL testIsFramebuffer_02 test start ...66'); 1347 var programobject = gl.createProgram(); 1348 const isFramebuffer = gl.isFramebuffer(programobject); 1349 console.info("createFramebuffer --> isFramebuffer: " + isFramebuffer); 1350 expect(isFramebuffer).assertEqual(false); 1351 //deleteContext(); 1352 done(); 1353 } catch (e) { 1354 console.log("testIsFramebuffer_02 has failed for " + e) 1355 expect(null).assertFail() 1356 } 1357 }) 1358 1359 /** 1360 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0359 1361 * @tc.name testIsFramebuffer_03 1362 * @tc.desc Test isFramebuffer. 1363 */ 1364 it('testIsFramebuffer_03', 0, async function(done) { 1365 //initContext(); 1366 console.info('jsWebGL testIsFramebuffer_03 test start ...66'); 1367 var shader = gl.createShader(gl.VERTEX_SHADER) 1368 const isFramebuffer = gl.isFramebuffer(shader); 1369 console.info("createFramebuffer --> isFramebuffer: " + isFramebuffer); 1370 expect(isFramebuffer).assertEqual(false); 1371 done(); 1372 }) 1373 1374 /** 1375 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0360 1376 * @tc.name testIsFramebuffer_04 1377 * @tc.desc Test isFramebuffer. 1378 */ 1379 it('testIsFramebuffer_04', 0, async function(done) { 1380 //initContext(); 1381 console.info('jsWebGL testIsFramebuffer_04 test start ...66'); 1382 var renderbufferObject = gl.createRenderbuffer(); 1383 const isFramebuffer = gl.isFramebuffer(renderbufferObject); 1384 console.info("createFramebuffer --> isFramebuffer: " + isFramebuffer); 1385 expect(isFramebuffer).assertEqual(false); 1386 done(); 1387 }) 1388 1389 /** 1390 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0361 1391 * @tc.name testIsProgram 1392 * @tc.desc Test isProgram. 1393 */ 1394 it('testIsProgram', 0, async function(done) { 1395 //initContext(); 1396 console.info('jsWebGL testIsProgram test start ...66'); 1397 var program = gl.createProgram(); 1398 const isProgram = gl.isProgram(program); 1399 console.info("createProgram --> isProgram: " + isProgram); 1400 expect(isProgram).assertEqual(true); 1401 done(); 1402 }) 1403 1404 /** 1405 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0363 1406 * @tc.name testIsProgram_02 1407 * @tc.desc Test isProgram. 1408 */ 1409 it('testIsProgram_02', 0, async function(done) { 1410 //initContext(); 1411 console.info('jsWebGL testIsProgram_02 test start ...66'); 1412 var renderbuffer = gl.createRenderbuffer(); 1413 const programError = gl.getError(); 1414 console.info("createProgram --> programError: " + programError); 1415 const isProgram = gl.isProgram(renderbuffer); 1416 console.info("createProgram --> isProgram: " + isProgram); 1417 expect(isProgram).assertEqual(false); 1418 done(); 1419 }) 1420 1421 /** 1422 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0364 1423 * @tc.name testIsProgram_03 1424 * @tc.desc Test isProgram. 1425 */ 1426 it('testIsProgram_03', 0, async function(done) { 1427 //initContext(); 1428 console.info('jsWebGL testIsProgram_03 test start ...66'); 1429 var shader = gl.createShader(gl.VERTEX_SHADER); 1430 const programError = gl.getError(); 1431 console.info("createProgram --> programError: " + programError); 1432 const isProgram = gl.isProgram(shader); 1433 console.info("createProgram --> isProgram: " + isProgram); 1434 expect(isProgram).assertEqual(false); 1435 done(); 1436 }) 1437 1438 /** 1439 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0366 1440 * @tc.name testIsRenderbuffer 1441 * @tc.desc Test isRenderbuffer. 1442 */ 1443 it('testIsRenderbuffer', 0, async function(done) { 1444 //initContext(); 1445 console.info('jsWebGL testIsRenderbuffer test start ...66'); 1446 var renderbuffer = gl.createRenderbuffer(); 1447 const isrenderbuffer = gl.isRenderbuffer(renderbuffer); 1448 console.info("createRenderbuffer --> isRenderbuffer: " + isrenderbuffer); 1449 expect(isrenderbuffer).assertEqual(false); 1450 done(); 1451 }) 1452 1453 /** 1454 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0367 1455 * @tc.name testIsRenderbuffer_01 1456 * @tc.desc Test isRenderbuffer. 1457 */ 1458 it('testIsRenderbuffer_01', 0, async function(done) { 1459 //initContext(); 1460 console.info('jsWebGL testIsRenderbuffer_01 test start ...66'); 1461 var renderbuffer = gl.createRenderbuffer(); 1462 gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer); 1463 const isrenderbuffer = gl.isRenderbuffer(renderbuffer); 1464 gl.deleteRenderbuffer(renderbuffer); 1465 console.info("createRenderbuffer --> isRenderbuffer: " + isrenderbuffer); 1466 expect(isrenderbuffer).assertEqual(true); 1467 done(); 1468 }) 1469 1470 /** 1471 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0368 1472 * @tc.name testIsRenderbuffer_02 1473 * @tc.desc Test isRenderbuffer. 1474 */ 1475 it('testIsRenderbuffer_02', 0, async function(done) { 1476 //initContext(); 1477 console.info('jsWebGL testIsRenderbuffer_02 test start ...66'); 1478 var framebuffer = gl.createFramebuffer(); 1479 const isrenderbuffer = gl.isRenderbuffer(framebuffer); 1480 console.info("createRenderbuffer --> isRenderbuffer: " + isrenderbuffer); 1481 // The webgl interface transparently transmits opengl.Therefore, only need to verify the interface does not crash. 1482 const notCrash = true; 1483 expect(notCrash).assertTrue(); 1484 for(let err; (err = gl.getError()) != gl.NO_ERROR;) {} 1485 done(); 1486 }) 1487 1488 /** 1489 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0369 1490 * @tc.name testIsRenderbuffer_03 1491 * @tc.desc Test isRenderbuffer. 1492 */ 1493 it('testIsRenderbuffer_03', 0, async function(done) { 1494 //initContext(); 1495 console.info('jsWebGL testIsRenderbuffer_03 test start ...66'); 1496 var programobject = gl.createProgram(); 1497 const isrenderbuffer = gl.isRenderbuffer(programobject); 1498 console.info("createRenderbuffer --> isRenderbuffer: " + isrenderbuffer); 1499 expect(isrenderbuffer).assertEqual(false); 1500 done(); 1501 }) 1502 1503 /** 1504 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0371 1505 * @tc.name testIsShader 1506 * @tc.desc Test isShader. 1507 */ 1508 it('testIsShader', 0, async function(done) { 1509 //initContext(); 1510 console.info('jsWebGL testIsShader test start ...66'); 1511 var shader = gl.createShader(gl.VERTEX_SHADER) 1512 const isShader = gl.isShader(shader); 1513 console.info("createShader --> isShader: " + isShader); 1514 expect(isShader).assertEqual(true); 1515 done(); 1516 }) 1517 1518 /** 1519 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0372 1520 * @tc.name testIsShader_01 1521 * @tc.desc Test isShader. 1522 */ 1523 it('testIsShader_01', 0, async function(done) { 1524 //initContext(); 1525 console.info('jsWebGL testIsShader_01 test start ...66'); 1526 var shader = gl.createShader(gl.FRAGMENT_SHADER) 1527 const isShader = gl.isShader(shader); 1528 console.info("createShader --> isShader: " + isShader); 1529 expect(isShader).assertEqual(true); 1530 done(); 1531 }) 1532 1533 /** 1534 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0373 1535 * @tc.name testIsShader_02 1536 * @tc.desc Test isShader. 1537 */ 1538 it('testIsShader_02', 0, async function(done) { 1539 //initContext(); 1540 console.info('jsWebGL testIsShader_02 test start ...66'); 1541 var renderbuffer = gl.createRenderbuffer(); 1542 const isShader = gl.isShader(renderbuffer); 1543 console.info("createShader --> isShader: " + isShader); 1544 // The webgl interface transparently transmits opengl.Therefore, only need to verify the interface does not crash. 1545 const notCrash = true; 1546 expect(notCrash).assertTrue(); 1547 for(let err; (err = gl.getError()) != gl.NO_ERROR;) {} 1548 done(); 1549 }) 1550 1551 /** 1552 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0375 1553 * @tc.name testIsShader_04 1554 * @tc.desc Test isShader. 1555 */ 1556 it('testIsShader_04', 0, async function(done) { 1557 //initContext(); 1558 console.info('jsWebGL testIsShader_04 test start ...66'); 1559 var programobject = gl.createProgram(); 1560 const isShader = gl.isShader(programobject); 1561 console.info("createShader --> isShader: " + isShader); 1562 expect(isShader).assertEqual(false); 1563 done(); 1564 }) 1565 1566 /** 1567 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0376 1568 * @tc.name testIsTexture 1569 * @tc.desc Test isTexture. 1570 */ 1571 it('testIsTexture', 0, async function(done) { 1572 //initContext(); 1573 console.info('jsWebGL testIsTexture test start ...66'); 1574 var texture = gl.createTexture(); 1575 gl.bindTexture(gl.TEXTURE_2D, texture); 1576 const isTexture = gl.isTexture(texture); 1577 console.info("createShader --> isTexture: " + isTexture); 1578 expect(isTexture).assertEqual(true); 1579 done(); 1580 }) 1581 1582 /** 1583 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0377 1584 * @tc.name testIsTexture_01 1585 * @tc.desc Test isTexture. 1586 */ 1587 it('testIsTexture_01', 0, async function(done) { 1588 //initContext(); 1589 console.info('jsWebGL testIsTexture_01 test start ...66'); 1590 var texture = gl.createTexture(); 1591 const isTexture = gl.isTexture(texture); 1592 console.info("createShader --> isTexture: " + isTexture); 1593 expect(isTexture).assertEqual(false); 1594 done(); 1595 }) 1596 1597 /** 1598 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0378 1599 * @tc.name testIsTexture_02 1600 * @tc.desc Test isTexture. 1601 */ 1602 it('testIsTexture_02', 0, async function(done) { 1603 //initContext(); 1604 console.info('jsWebGL testIsTexture_02 test start ...66'); 1605 var programobject = gl.createProgram(); 1606 const isTexture = gl.isTexture(programobject); 1607 console.info("createShader --> isTexture: " + isTexture); 1608 expect(isTexture).assertEqual(false); 1609 done(); 1610 }) 1611 1612 /** 1613 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0379 1614 * @tc.name testIsTexture_03 1615 * @tc.desc Test isTexture. 1616 */ 1617 it('testIsTexture_03', 0, async function(done) { 1618 //initContext(); 1619 console.info('jsWebGL testIsTexture_03 test start ...66'); 1620 var renderbuffer = gl.createRenderbuffer(); 1621 const isTexture = gl.isTexture(renderbuffer); 1622 console.info("createShader --> isTexture: " + isTexture); 1623 expect(isTexture).assertEqual(false); 1624 done(); 1625 }) 1626 1627 /** 1628 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0380 1629 * @tc.name testIsTexture_04 1630 * @tc.desc Test isTexture. 1631 */ 1632 it('testIsTexture_04', 0, async function(done) { 1633 //initContext(); 1634 console.info('jsWebGL testIsTexture_04 test start ...66'); 1635 var framebuffer = gl.createFramebuffer(); 1636 const isTexture = gl.isTexture(framebuffer); 1637 console.info("createShader --> isTexture: " + isTexture); 1638 expect(isTexture).assertEqual(false); 1639 done(); 1640 }) 1641 1642 /** 1643 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0383 1644 * @tc.name testLineWidth_01 1645 * @tc.desc Test lineWidth. 1646 */ 1647 it('testLineWidth_01', 0, async function(done) { 1648 //initContext(); 1649 console.info('jsWebGL testLineWidth_01 test start ...66'); 1650 gl.lineWidth(-1); 1651 const windtherror = gl.getError(); 1652 console.info("windtherror: " + windtherror); 1653 expect(windtherror).assertEqual(gl.INVALID_VALUE); 1654 done(); 1655 }) 1656 1657 /** 1658 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0384 1659 * @tc.name testLineWidth_02 1660 * @tc.desc Test lineWidth. 1661 */ 1662 it('testLineWidth_02', 0, async function(done) { 1663 //initContext(); 1664 console.info('jsWebGL testLineWidth_02 test start ...66'); 1665 gl.lineWidth(0); 1666 const windtherror = gl.getError(); 1667 console.info("windtherror: " + windtherror); 1668 expect(windtherror).assertEqual(gl.INVALID_VALUE); 1669 done(); 1670 }) 1671 1672 1673 /** 1674 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0385 1675 * @tc.name testLinkProgram 1676 * @tc.desc Test linkProgram. 1677 */ 1678 it('testLinkProgram', 0, async function(done) { 1679 //initContext(); 1680 console.info('jsWebGL testLinkProgram test start ...66'); 1681 console.info('jsWebGL testLinkProgram test start ...' + JSON.stringify(gl)); 1682 var shaderProg = gl.createProgram(); 1683 gl.linkProgram(shaderProg); 1684 const linkProgramError = gl.getError(); 1685 console.info("linkProgramError: " + linkProgramError); 1686 expect(linkProgramError).assertEqual(0); 1687 done(); 1688 }) 1689 1690 /** 1691 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0388 1692 * @tc.name testLinkProgram_03 1693 * @tc.desc Test linkProgram. 1694 */ 1695 it('testLinkProgram_03', 0, async function(done) { 1696 //initContext(); 1697 console.info('jsWebGL testLinkProgram_03 test start ...66'); 1698 var shader = gl.createShader(gl.VERTEX_SHADER); 1699 gl.linkProgram(shader); 1700 const linkProgramError = gl.getError(); 1701 console.info("linkProgramError: " + linkProgramError); 1702 expect(linkProgramError).assertEqual(gl.INVALID_OPERATION); 1703 done(); 1704 }) 1705 1706 /** 1707 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0389 1708 * @tc.name testLinkProgram_04 1709 * @tc.desc Test linkProgram. 1710 */ 1711 it('testLinkProgram_04', 0, async function(done) { 1712 //initContext(); 1713 console.info('jsWebGL testLinkProgram_04 test start ...66'); 1714 gl.linkProgram("-123"); 1715 const linkProgramError = gl.getError(); 1716 console.info("linkProgramError: " + linkProgramError); 1717 expect(linkProgramError).assertEqual(0); 1718 done(); 1719 }) 1720 1721 /** 1722 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0390 1723 * @tc.name testPixelStorei 1724 * @tc.desc Test pixelStorei. 1725 */ 1726 it('testPixelStorei', 0, async function(done) { 1727 //initContext(); 1728 console.info('jsWebGL testPixelStorei test start ...66'); 1729 var tex = gl.createTexture(); 1730 gl.bindTexture(gl.TEXTURE_2D, tex); 1731 gl.pixelStorei(gl.PACK_ALIGNMENT, 4); 1732 gl.pixelStorei(gl.UNPACK_ALIGNMENT, 8); 1733 const packValue = gl.getParameter(gl.PACK_ALIGNMENT); 1734 const unpackValue = gl.getParameter(gl.UNPACK_ALIGNMENT); 1735 console.info("packValue: " + packValue); 1736 console.info("unpackValue: " + unpackValue); 1737 const pixelStoreiError = gl.getError(); 1738 console.info("pixelStoreiError: " + pixelStoreiError); 1739 expect(pixelStoreiError).assertEqual(0); 1740 done(); 1741 }) 1742 1743 /** 1744 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0391 1745 * @tc.name testPixelStorei_01 1746 * @tc.desc Test pixelStorei. 1747 */ 1748 it('testPixelStorei_01', 0, async function(done) { 1749 //initContext(); 1750 console.info('jsWebGL testPixelStorei_01 test start ...66'); 1751 var tex = gl.createTexture(); 1752 gl.pixelStorei(gl.UNPACK_ALIGNMENT, 8); 1753 const pixelStoreiError = gl.getError(); 1754 console.info("pixelStoreiError: " + pixelStoreiError); 1755 expect(pixelStoreiError).assertEqual(0); 1756 done(); 1757 }) 1758 1759 /** 1760 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0392 1761 * @tc.name testPixelStorei_02 1762 * @tc.desc Test pixelStorei. 1763 */ 1764 it('testPixelStorei_02', 0, async function(done) { 1765 //initContext(); 1766 console.info('jsWebGL testPixelStorei_02 test start ...66'); 1767 var tex = gl.createTexture(); 1768 gl.pixelStorei(gl.LINE_LOOP, 8); 1769 const pixelStoreiError = gl.getError(); 1770 console.info("pixelStoreiError: " + pixelStoreiError); 1771 expect(pixelStoreiError).assertEqual(gl.INVALID_ENUM); 1772 done(); 1773 }) 1774 1775 /** 1776 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0393 1777 * @tc.name testPixelStorei_03 1778 * @tc.desc Test pixelStorei. 1779 */ 1780 it('testPixelStorei_03', 0, async function(done) { 1781 //initContext(); 1782 console.info('jsWebGL testPixelStorei_03 test start ...66'); 1783 var tex = gl.createTexture(); 1784 gl.pixelStorei(gl.ONE_MINUS_SRC_COLOR, 8); 1785 const pixelStoreiError = gl.getError(); 1786 console.info("pixelStoreiError: " + pixelStoreiError); 1787 expect(pixelStoreiError).assertEqual(gl.INVALID_ENUM); 1788 done(); 1789 }) 1790 1791 /** 1792 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0394 1793 * @tc.name testPixelStorei_04 1794 * @tc.desc Test pixelStorei. 1795 */ 1796 it('testPixelStorei_04', 0, async function(done) { 1797 //initContext(); 1798 console.info('jsWebGL testPixelStorei_04 test start ...66'); 1799 var tex = gl.createTexture(); 1800 gl.pixelStorei(gl.ONE_MINUS_SRC_COLOR, -1); 1801 const pixelStoreiError = gl.getError(); 1802 console.info("pixelStoreiError: " + pixelStoreiError); 1803 expect(pixelStoreiError).assertLarger(gl.NO_ERROR); 1804 for(let err; (err = gl.getError()) != gl.NO_ERROR;) {} 1805 done(); 1806 }) 1807 1808 /** 1809 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0395 1810 * @tc.name testPolygonOffset 1811 * @tc.desc Test polygonOffset. 1812 */ 1813 it('testPolygonOffset', 0, async function(done) { 1814 //initContext(); 1815 console.info('jsWebGL testPolygonOffset test start ...66'); 1816 gl.enable(gl.POLYGON_OFFSET_FILL); 1817 gl.polygonOffset(2, 3); 1818 const polygonOffsetError = gl.getError(); 1819 console.info("polygonOffsetError: " + polygonOffsetError); 1820 expect(polygonOffsetError).assertEqual(0); 1821 done(); 1822 }) 1823 1824 /** 1825 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0396 1826 * @tc.name testPolygonOffset_01 1827 * @tc.desc Test polygonOffset. 1828 */ 1829 it('testPolygonOffset_01', 0, async function(done) { 1830 //initContext(); 1831 console.info('jsWebGL testPolygonOffset_01 test start ...66'); 1832 gl.enable(gl.TRIANGLE_STRIP); 1833 gl.polygonOffset(-2, 3); 1834 const polygonOffsetError = gl.getError(); 1835 console.info("polygonOffsetError: " + polygonOffsetError); 1836 expect(polygonOffsetError).assertEqual(gl.INVALID_ENUM); 1837 done(); 1838 }) 1839 1840 /** 1841 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0397 1842 * @tc.name testPolygonOffset_02 1843 * @tc.desc Test polygonOffset. 1844 */ 1845 it('testPolygonOffset_02', 0, async function(done) { 1846 //initContext(); 1847 console.info('jsWebGL testPolygonOffset_02 test start ...66'); 1848 gl.enable(gl.TRIANGLES); 1849 gl.polygonOffset(-2, -3); 1850 const polygonOffsetError = gl.getError(); 1851 console.info("polygonOffsetError: " + polygonOffsetError); 1852 expect(polygonOffsetError).assertEqual(gl.INVALID_ENUM); 1853 done(); 1854 }) 1855 1856 /** 1857 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0398 1858 * @tc.name testPolygonOffset_03 1859 * @tc.desc Test polygonOffset. 1860 */ 1861 it('testPolygonOffset_03', 0, async function(done) { 1862 //initContext(); 1863 console.info('jsWebGL testPolygonOffset_03 test start ...66'); 1864 gl.enable(gl.LINES); 1865 gl.polygonOffset(0, 0); 1866 const polygonOffsetError = gl.getError(); 1867 console.info("polygonOffsetError: " + polygonOffsetError); 1868 expect(polygonOffsetError).assertEqual(gl.INVALID_ENUM); 1869 done(); 1870 }) 1871 1872 /** 1873 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0399 1874 * @tc.name testPolygonOffset_04 1875 * @tc.desc Test polygonOffset. 1876 */ 1877 it('testPolygonOffset_04', 0, async function(done) { 1878 //initContext(); 1879 console.info('jsWebGL testPolygonOffset_04 test start ...66'); 1880 gl.enable(gl.LINE_STRIP); 1881 gl.polygonOffset(0, 0); 1882 const polygonOffsetError = gl.getError(); 1883 console.info("polygonOffsetError: " + polygonOffsetError); 1884 expect(polygonOffsetError).assertEqual(gl.INVALID_ENUM); 1885 done(); 1886 }) 1887 1888 /** 1889 * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_0400 1890 * @tc.name testBufferData 1891 * @tc.desc Test bufferData. 1892 */ 1893 it('testBufferData', 0, async function(done) { 1894 //initContext(); 1895 console.info('jsWebGL testBufferData test start ...66'); 1896 console.info('jsWebGL testBufferData test start ...' + JSON.stringify(gl)); 1897 var buffer = gl.createBuffer(); 1898 gl.bindBuffer(gl.ARRAY_BUFFER, buffer); 1899 gl.bufferData(gl.ARRAY_BUFFER, 1024, gl.STATIC_DRAW); 1900 const bufferDataError = gl.getError(); 1901 console.info("bufferDataError: " + bufferDataError); 1902 expect(bufferDataError).assertEqual(0); 1903 done(); 1904 }) 1905}) 1906