1/* 2 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 */ 15 16import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '@ohos/hypium'; 17import drawing from '@ohos.graphics.drawing'; 18const loop_times = 20; 19 20export default function drawingTsMatrixTest() { 21 describe('drawingTsMatrixTest', () => { 22 const DEFAULT = 0; 23 // Defines a test suite. Two parameters are supported: test suite name and test suite function. 24 beforeAll(() => { 25 26 }) 27 beforeEach(() => { 28 // Presets an action, which is performed before each unit test case starts. 29 // The number of execution times is the same as the number of test cases defined by **it**. 30 // This API supports only one parameter: preset action function. 31 }) 32 afterEach(() => { 33 // Presets a clear action, which is performed after each unit test case ends. 34 // The number of execution times is the same as the number of test cases defined by **it**. 35 // This API supports only one parameter: clear action function. 36 }) 37 afterAll(() => { 38 // Presets a clear action, which is performed after all test cases of the test suite end. 39 // This API supports only one parameter: clear action function. 40 }) 41 42 43 /** 44 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0100 45 * @tc.name : testMatrixConstructorNormal 46 * @tc.desc : testMatrixConstructorNormal 47 * @tc.size : MediumTest 48 * @tc.type : Function 49 * @tc.level : Level0 50 */ 51 it('testMatrixConstructorNormal', DEFAULT, () => { 52 const msg = 'testMatrixConstructorNormal'; 53 try { 54 let matrix = new drawing.Matrix(); 55 console.info(msg + ' Matrix successed'); 56 } catch (e) { 57 console.info(msg + ` Matrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 58 expect().assertFail() 59 } 60 }) 61 62 /** 63 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0103 64 * @tc.name : testMatrixConstructorMultipleCalls 65 * @tc.desc : testMatrixConstructorMultipleCalls 66 * @tc.size : MediumTest 67 * @tc.type : Function 68 * @tc.level : Level3 69 */ 70 it('testMatrixConstructorMultipleCalls', DEFAULT, () => { 71 const msg = 'testMatrixConstructorMultipleCalls'; 72 try { 73 for (let i = 0; i < loop_times; i++) { 74 let matrix = new drawing.Matrix(); 75 } 76 console.info(msg + ' Matrix successed'); 77 } catch (e) { 78 console.info(msg + ` Matrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 79 expect().assertFail() 80 } 81 }) 82 83 /** 84 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0200 85 * @tc.name : testMatrixSetRotationNormal 86 * @tc.desc : testMatrixSetRotationNormal 87 * @tc.size : MediumTest 88 * @tc.type : Function 89 * @tc.level : Level0 90 */ 91 it('testMatrixSetRotationNormal', DEFAULT, () => { 92 const msg = 'testMatrixSetRotationNormal'; 93 try { 94 let matrix = new drawing.Matrix(); 95 matrix.setRotation(90, 100, 100); 96 let widths : number[] = matrix.getAll(); 97 expect(widths.length == 9).assertTrue(); 98 expect(matrix != null).assertTrue(); 99 console.info(msg + ' getAll successed,width:'+ widths.length + JSON.stringify(matrix)); 100 } catch (e) { 101 console.info(msg + ` getAll errorCode is: ${e.code} + errormsg is: ${e.message}`); 102 expect().assertFail() 103 } 104 105 try { 106 let matrix = new drawing.Matrix(); 107 matrix.setRotation(90.1, 100.1, 100.1); 108 let widths : number[] = matrix.getAll(); 109 expect(widths.length == 9).assertTrue(); 110 expect(matrix != null).assertTrue(); 111 console.info(msg + ' getAll successed,width:'+ widths.length + JSON.stringify(matrix)); 112 } catch (e) { 113 console.info(msg + ` getAll errorCode is: ${e.code} + errormsg is: ${e.message}`); 114 expect().assertFail() 115 } 116 117 try { 118 let matrix = new drawing.Matrix(); 119 matrix.setRotation(-90, 100, 100); 120 let widths : number[] = matrix.getAll(); 121 expect(widths.length == 9).assertTrue(); 122 expect(matrix != null).assertTrue(); 123 console.info(msg + ' getAll successed,width:'+ widths.length + JSON.stringify(matrix)); 124 } catch (e) { 125 console.info(msg + ` getAll errorCode is: ${e.code} + errormsg is: ${e.message}`); 126 expect().assertFail() 127 } 128 129 try { 130 let matrix = new drawing.Matrix(); 131 matrix.setRotation(90, -100, 100); 132 let widths : number[] = matrix.getAll(); 133 expect(widths.length == 9).assertTrue(); 134 expect(matrix != null).assertTrue(); 135 console.info(msg + ' getAll successed,width:'+ widths.length + JSON.stringify(matrix)); 136 } catch (e) { 137 console.info(msg + ` getAll errorCode is: ${e.code} + errormsg is: ${e.message}`); 138 expect().assertFail() 139 } 140 141 try { 142 let matrix = new drawing.Matrix(); 143 matrix.setRotation(90, 100, -100); 144 let widths : number[] = matrix.getAll(); 145 matrix.setRotation(90.1, 100.1, 100.1); 146 expect(widths.length == 9).assertTrue(); 147 expect(matrix != null).assertTrue(); 148 console.info(msg + ' getAll successed,width:'+ widths.length + JSON.stringify(matrix)); 149 } catch (e) { 150 console.info(msg + ` getAll errorCode is: ${e.code} + errormsg is: ${e.message}`); 151 expect().assertFail() 152 } 153 154 try { 155 let matrix = new drawing.Matrix(); 156 matrix.setRotation(361, Number.MAX_VALUE, Number.MAX_VALUE); 157 let widths : number[] = matrix.getAll(); 158 expect(widths.length == 9).assertTrue(); 159 expect(matrix != null).assertTrue(); 160 console.info(msg + ' getAll successed,width:'+ widths.length + JSON.stringify(matrix)); 161 } catch (e) { 162 console.info(msg + ` getAll errorCode is: ${e.code} + errormsg is: ${e.message}`); 163 expect().assertFail() 164 } 165 }) 166 167 /** 168 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0201 169 * @tc.name : testMatrixSetRotationNull 170 * @tc.desc : testMatrixSetRotationNull 171 * @tc.size : MediumTest 172 * @tc.type : Function 173 * @tc.level : Level3 174 */ 175 it('testMatrixSetRotationNull', DEFAULT, () => { 176 const msg = 'testMatrixSetRotationNull'; 177 try { 178 let matrix = new drawing.Matrix(); 179 matrix.setRotation(null, 100, 100); 180 console.info(msg + ' setRotation successed'); 181 } catch (e) { 182 console.info(msg + ` setRotation errorCode is: ${e.code} + errormsg is: ${e.message}`); 183 expect(e.code).assertEqual(401); 184 } 185 186 try { 187 let matrix = new drawing.Matrix(); 188 matrix.setRotation(90, null, 100); 189 console.info(msg + ' setRotation successed'); 190 } catch (e) { 191 console.info(msg + ` setRotation errorCode is: ${e.code} + errormsg is: ${e.message}`); 192 expect(e.code).assertEqual(401); 193 } 194 195 try { 196 let matrix = new drawing.Matrix(); 197 matrix.setRotation(90, 100, null); 198 console.info(msg + ' setRotation successed'); 199 } catch (e) { 200 console.info(msg + ` setRotation errorCode is: ${e.code} + errormsg is: ${e.message}`); 201 expect(e.code).assertEqual(401); 202 } 203 204 try { 205 let matrix = new drawing.Matrix(); 206 matrix.setRotation(undefined, 100, 100); 207 console.info(msg + ' setRotation successed'); 208 } catch (e) { 209 console.info(msg + ` setRotation errorCode is: ${e.code} + errormsg is: ${e.message}`); 210 expect(e.code).assertEqual(401); 211 } 212 213 try { 214 let matrix = new drawing.Matrix(); 215 matrix.setRotation(90, undefined, 100); 216 console.info(msg + ' setRotation successed'); 217 } catch (e) { 218 console.info(msg + ` setRotation errorCode is: ${e.code} + errormsg is: ${e.message}`); 219 expect(e.code).assertEqual(401); 220 } 221 222 try { 223 let matrix = new drawing.Matrix(); 224 matrix.setRotation(90, 100, undefined); 225 console.info(msg + ' setRotation successed'); 226 } catch (e) { 227 console.info(msg + ` setRotation errorCode is: ${e.code} + errormsg is: ${e.message}`); 228 expect(e.code).assertEqual(401); 229 } 230 }) 231 232 /** 233 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0203 234 * @tc.name : testMatrixSetRotationMultipleCalls 235 * @tc.desc : testMatrixSetRotationMultipleCalls 236 * @tc.size : MediumTest 237 * @tc.type : Function 238 * @tc.level : Level3 239 */ 240 it('testMatrixSetRotationMultipleCalls', DEFAULT, () => { 241 const msg = 'testMatrixSetRotationMultipleCalls'; 242 try { 243 let matrix = new drawing.Matrix(); 244 for (let i = 0; i < loop_times; i++) { 245 matrix.setRotation(Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE); 246 } 247 console.info(msg + ' setRotation successed'); 248 } catch (e) { 249 console.info(msg + ` setRotation errorCode is: ${e.code} + errormsg is: ${e.message}`); 250 expect().assertFail() 251 } 252 }) 253 254 /** 255 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0300 256 * @tc.name : testMatrixSetScaleNormal 257 * @tc.desc : testMatrixSetScaleNormal 258 * @tc.size : MediumTest 259 * @tc.type : Function 260 * @tc.level : Level0 261 */ 262 it('testMatrixSetScaleNormal', DEFAULT, () => { 263 const msg = 'testMatrixSetScaleNormal'; 264 try { 265 let matrix = new drawing.Matrix(); 266 matrix.setScale(100, 100, 150, 150); 267 let widths : number[] = matrix.getAll(); 268 expect(widths.length == 9).assertTrue(); 269 expect(matrix != null).assertTrue(); 270 console.info(msg + ' setScale successed,width:'+ widths.length + JSON.stringify(matrix)); 271 } catch (e) { 272 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 273 expect().assertFail() 274 } 275 276 try { 277 let matrix = new drawing.Matrix(); 278 matrix.setScale(0.2, 0.2, 0.5, 0.5); 279 let widths : number[] = matrix.getAll(); 280 expect(widths.length == 9).assertTrue(); 281 expect(matrix != null).assertTrue(); 282 console.info(msg + ' setScale successed,width:'+ widths.length + JSON.stringify(matrix)); 283 } catch (e) { 284 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 285 expect().assertFail() 286 } 287 288 try { 289 let matrix = new drawing.Matrix(); 290 matrix.setScale(-100, -100, 150, 150); 291 let widths : number[] = matrix.getAll(); 292 expect(widths.length == 9).assertTrue(); 293 expect(matrix != null).assertTrue(); 294 console.info(msg + ' setScale successed,width:'+ widths.length + JSON.stringify(matrix)); 295 } catch (e) { 296 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 297 expect().assertFail() 298 } 299 300 try { 301 let matrix = new drawing.Matrix(); 302 matrix.setScale(100, 100, -150, -150); 303 let widths : number[] = matrix.getAll(); 304 expect(widths.length == 9).assertTrue(); 305 expect(matrix != null).assertTrue(); 306 console.info(msg + ' setScale successed,width:'+ widths.length + JSON.stringify(matrix)); 307 } catch (e) { 308 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 309 expect().assertFail() 310 } 311 312 try { 313 let matrix = new drawing.Matrix(); 314 matrix.setScale(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); 315 let widths : number[] = matrix.getAll(); 316 expect(widths.length == 9).assertTrue(); 317 expect(matrix != null).assertTrue(); 318 console.info(msg + ' setScale successed,width:'+ widths.length + JSON.stringify(matrix)); 319 } catch (e) { 320 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 321 expect().assertFail() 322 } 323 }) 324 325 /** 326 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0301 327 * @tc.name : testMatrixSetScaleNull 328 * @tc.desc : testMatrixSetScaleNull 329 * @tc.size : MediumTest 330 * @tc.type : Function 331 * @tc.level : Level3 332 */ 333 it('testMatrixSetScaleNull', DEFAULT, () => { 334 const msg = 'testMatrixSetScaleNull'; 335 try { 336 let matrix = new drawing.Matrix(); 337 matrix.setScale(null, 100, 150, 150); 338 console.info(msg + ' setScale successed'); 339 } catch (e) { 340 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 341 expect(e.code).assertEqual(401); 342 } 343 344 try { 345 let matrix = new drawing.Matrix(); 346 matrix.setScale(100, null, 150, 150); 347 console.info(msg + ' setScale successed'); 348 } catch (e) { 349 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 350 expect(e.code).assertEqual(401); 351 } 352 353 try { 354 let matrix = new drawing.Matrix(); 355 matrix.setScale(100, 100, null, 150); 356 console.info(msg + ' setScale successed'); 357 } catch (e) { 358 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 359 expect(e.code).assertEqual(401); 360 } 361 362 try { 363 let matrix = new drawing.Matrix(); 364 matrix.setScale(100, 100, 150, null); 365 console.info(msg + ' setScale successed'); 366 } catch (e) { 367 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 368 expect(e.code).assertEqual(401); 369 } 370 371 try { 372 let matrix = new drawing.Matrix(); 373 matrix.setScale(undefined, 100, 150, 150); 374 console.info(msg + ' setScale successed'); 375 } catch (e) { 376 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 377 expect(e.code).assertEqual(401); 378 } 379 380 try { 381 let matrix = new drawing.Matrix(); 382 matrix.setScale(100, undefined, 150, 150); 383 console.info(msg + ' setScale successed'); 384 } catch (e) { 385 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 386 expect(e.code).assertEqual(401); 387 } 388 389 try { 390 let matrix = new drawing.Matrix(); 391 matrix.setScale(100, 100, undefined, 150); 392 console.info(msg + ' setScale successed'); 393 } catch (e) { 394 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 395 expect(e.code).assertEqual(401); 396 } 397 398 try { 399 let matrix = new drawing.Matrix(); 400 matrix.setScale(100, 100, 150, undefined); 401 console.info(msg + ' setScale successed'); 402 } catch (e) { 403 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 404 expect(e.code).assertEqual(401); 405 } 406 }) 407 408 /** 409 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0303 410 * @tc.name : testMatrixSetScaleMultipleCalls 411 * @tc.desc : testMatrixSetScaleMultipleCalls 412 * @tc.size : MediumTest 413 * @tc.type : Function 414 * @tc.level : Level3 415 */ 416 it('testMatrixSetScaleMultipleCalls', DEFAULT, () => { 417 const msg = 'testMatrixSetScaleMultipleCalls'; 418 try { 419 let matrix = new drawing.Matrix(); 420 for (let i = 0; i < loop_times; i++) { 421 matrix.setScale(Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE); 422 } 423 console.info(msg + ' setScale successed'); 424 } catch (e) { 425 console.info(msg + ` setScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 426 expect().assertFail() 427 } 428 }) 429 430 /** 431 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0400 432 * @tc.name : testMatrixSetTranslationNormal 433 * @tc.desc : testMatrixSetTranslationNormal 434 * @tc.size : MediumTest 435 * @tc.type : Function 436 * @tc.level : Level0 437 */ 438 it('testMatrixSetTranslationNormal', DEFAULT, () => { 439 const msg = 'testMatrixSetTranslationNormal'; 440 try { 441 let matrix = new drawing.Matrix(); 442 matrix.setTranslation(100, 100); 443 let widths : number[] = matrix.getAll(); 444 expect(widths.length == 9).assertTrue(); 445 expect(matrix != null).assertTrue(); 446 console.info(msg + ' setTranslation successed,width:'+ widths.length + JSON.stringify(matrix)); 447 } catch (e) { 448 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 449 expect().assertFail() 450 } 451 452 try { 453 let matrix = new drawing.Matrix(); 454 matrix.setTranslation(100.1, 100.1); 455 let widths : number[] = matrix.getAll(); 456 expect(widths.length == 9).assertTrue(); 457 expect(matrix != null).assertTrue(); 458 console.info(msg + ' setTranslation successed,width:'+ widths.length + JSON.stringify(matrix)); 459 } catch (e) { 460 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 461 expect().assertFail() 462 } 463 464 try { 465 let matrix = new drawing.Matrix(); 466 matrix.setTranslation(-100, 100); 467 let widths : number[] = matrix.getAll(); 468 expect(widths.length == 9).assertTrue(); 469 expect(matrix != null).assertTrue(); 470 console.info(msg + ' setTranslation successed,width:'+ widths.length + JSON.stringify(matrix)); 471 } catch (e) { 472 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 473 expect().assertFail() 474 } 475 476 try { 477 let matrix = new drawing.Matrix(); 478 matrix.setTranslation(100, -150); 479 let widths : number[] = matrix.getAll(); 480 expect(widths.length == 9).assertTrue(); 481 expect(matrix != null).assertTrue(); 482 console.info(msg + ' setTranslation successed,width:'+ widths.length + JSON.stringify(matrix)); 483 } catch (e) { 484 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 485 expect().assertFail() 486 } 487 488 try { 489 let matrix = new drawing.Matrix(); 490 matrix.setTranslation(Number.MAX_VALUE, Number.MAX_VALUE); 491 let widths : number[] = matrix.getAll(); 492 expect(widths.length == 9).assertTrue(); 493 expect(matrix != null).assertTrue(); 494 console.info(msg + ' setTranslation successed,width:'+ widths.length + JSON.stringify(matrix)); 495 } catch (e) { 496 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 497 expect().assertFail() 498 } 499 }) 500 501 /** 502 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0401 503 * @tc.name : testMatrixSetTranslationNull 504 * @tc.desc : testMatrixSetTranslationNull 505 * @tc.size : MediumTest 506 * @tc.type : Function 507 * @tc.level : Level3 508 */ 509 it('testMatrixSetTranslationNull', DEFAULT, () => { 510 const msg = 'testMatrixSetTranslationNull'; 511 try { 512 let matrix = new drawing.Matrix(); 513 matrix.setTranslation(null, 100,); 514 console.info(msg + ' setTranslation successed'); 515 } catch (e) { 516 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 517 expect(e.code).assertEqual(401); 518 } 519 520 try { 521 let matrix = new drawing.Matrix(); 522 matrix.setTranslation(100, null); 523 console.info(msg + ' setTranslation successed'); 524 } catch (e) { 525 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 526 expect(e.code).assertEqual(401); 527 } 528 529 try { 530 let matrix = new drawing.Matrix(); 531 matrix.setTranslation(undefined, 100,); 532 console.info(msg + ' setTranslation successed'); 533 } catch (e) { 534 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 535 expect(e.code).assertEqual(401); 536 } 537 538 try { 539 let matrix = new drawing.Matrix(); 540 matrix.setTranslation(100, undefined); 541 console.info(msg + ' setTranslation successed'); 542 } catch (e) { 543 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 544 expect(e.code).assertEqual(401); 545 } 546 }) 547 548 /** 549 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0403 550 * @tc.name : testMatrixSetTranslationMultipleCalls 551 * @tc.desc : testMatrixSetTranslationMultipleCalls 552 * @tc.size : MediumTest 553 * @tc.type : Function 554 * @tc.level : Level3 555 */ 556 it('testMatrixSetTranslationMultipleCalls', DEFAULT, () => { 557 const msg = 'testMatrixSetTranslationMultipleCalls'; 558 try { 559 let matrix = new drawing.Matrix(); 560 for (let i = 0; i < loop_times; i++) { 561 matrix.setTranslation(Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE); 562 } 563 console.info(msg + ' setTranslation successed'); 564 } catch (e) { 565 console.info(msg + ` setTranslation errorCode is: ${e.code} + errormsg is: ${e.message}`); 566 expect().assertFail() 567 } 568 }) 569 570 /** 571 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0500 572 * @tc.name : testMatrixSetAndGetMatrixNormal 573 * @tc.desc : testMatrixSetAndGetMatrixNormal 574 * @tc.size : MediumTest 575 * @tc.type : Function 576 * @tc.level : Level0 577 */ 578 it('testMatrixSetAndGetMatrixNormal', DEFAULT, () => { 579 const msg = 'testMatrixSetAndGetMatrixNormal'; 580 try { 581 let matrix = new drawing.Matrix(); 582 let widths : number[] = matrix.getAll(); 583 expect(widths.length == 9).assertTrue(); 584 expect(matrix != null).assertTrue(); 585 console.info(msg + ' SetAndGetMatrix successed,width:'+ widths.length + JSON.stringify(matrix)); 586 } catch (e) { 587 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 588 expect().assertFail() 589 } 590 591 try { 592 let matrix = new drawing.Matrix(); 593 matrix.setMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9]); 594 matrix.getValue(0); 595 let widths : number[] = matrix.getAll(); 596 expect(widths.length == 9).assertTrue(); 597 expect(matrix != null).assertTrue(); 598 console.info(msg + ' SetAndGetMatrix successed,width:'+ widths.length + JSON.stringify(matrix)); 599 } catch (e) { 600 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 601 expect().assertFail() 602 } 603 604 try { 605 let matrix = new drawing.Matrix(); 606 matrix.setMatrix([1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1,8.1, 9.1]); 607 matrix.getValue(0); 608 let widths : number[] = matrix.getAll(); 609 expect(widths.length == 9).assertTrue(); 610 expect(matrix != null).assertTrue(); 611 console.info(msg + ' SetAndGetMatrix successed,width:'+ widths.length + JSON.stringify(matrix)); 612 } catch (e) { 613 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 614 expect().assertFail() 615 } 616 617 try { 618 let matrix = new drawing.Matrix(); 619 matrix.setMatrix([0,-1, 2.1, 2.1, 42.1, 2.1, 2.,1 -2.1, 10]); 620 matrix.getValue(0); 621 let widths : number[] = matrix.getAll(); 622 expect(widths.length == 9).assertTrue(); 623 expect(matrix != null).assertTrue(); 624 console.info(msg + ' SetAndGetMatrix successed,width:'+ widths.length + JSON.stringify(matrix)); 625 } catch (e) { 626 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 627 expect().assertFail() 628 } 629 630 try { 631 let matrix = new drawing.Matrix(); 632 matrix.setMatrix([Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, 633 Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE]); 634 matrix.getValue(0); 635 let widths : number[] = matrix.getAll(); 636 expect(widths.length == 9).assertTrue(); 637 expect(matrix != null).assertTrue(); 638 console.info(msg + ' SetAndGetMatrix successed,width:'+ widths.length + JSON.stringify(matrix)); 639 } catch (e) { 640 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 641 expect().assertFail() 642 } 643 }) 644 645 /** 646 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0501 647 * @tc.name : testMatrixSetAndGetMatrixNull 648 * @tc.desc : testMatrixSetAndGetMatrixNull 649 * @tc.size : MediumTest 650 * @tc.type : Function 651 * @tc.level : Level3 652 */ 653 it('testMatrixSetAndGetMatrixNull', DEFAULT, () => { 654 const msg = 'testMatrixSetAndGetMatrixNull'; 655 try { 656 let matrix = new drawing.Matrix(); 657 matrix.getValue(null); 658 console.info(msg + ' SetAndGetMatrix successed'); 659 } catch (e) { 660 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 661 expect(e.code).assertEqual(401); 662 } 663 664 try { 665 let matrix = new drawing.Matrix(); 666 matrix.getValue(undefined); 667 console.info(msg + ' SetAndGetMatrix successed'); 668 } catch (e) { 669 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 670 expect(e.code).assertEqual(401); 671 } 672 673 try { 674 let matrix = new drawing.Matrix(); 675 matrix.setMatrix(null); 676 console.info(msg + ' SetAndGetMatrix successed'); 677 } catch (e) { 678 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 679 expect(e.code).assertEqual(401); 680 } 681 682 try { 683 let matrix = new drawing.Matrix(); 684 matrix.setMatrix(undefined); 685 console.info(msg + ' SetAndGetMatrix successed'); 686 } catch (e) { 687 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 688 expect(e.code).assertEqual(401); 689 } 690 691 try { 692 let matrix = new drawing.Matrix(); 693 matrix.setMatrix([]); 694 console.info(msg + ' SetAndGetMatrix successed'); 695 } catch (e) { 696 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 697 expect(e.code).assertEqual(401); 698 } 699 }) 700 701 /** 702 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0503 703 * @tc.name : testMatrixSetAndGetMatrixMultipleCalls 704 * @tc.desc : testMatrixSetAndGetMatrixMultipleCalls 705 * @tc.size : MediumTest 706 * @tc.type : Function 707 * @tc.level : Level3 708 */ 709 it('testMatrixSetAndGetMatrixMultipleCalls', DEFAULT, () => { 710 const msg = 'testMatrixSetAndGetMatrixMultipleCalls'; 711 try { 712 let matrix = new drawing.Matrix(); 713 matrix.setMatrix([Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, 714 Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, 715 Math.random() * Number.MAX_VALUE,Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, 716 Math.random() * Number.MAX_VALUE]); 717 for (let i = 0; i < loop_times; i++) { 718 matrix.getValue(0); 719 matrix.getAll(); 720 } 721 console.info(msg + ' SetAndGetMatrix successed'); 722 } catch (e) { 723 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 724 expect().assertFail() 725 } 726 727 try { 728 let matrix = new drawing.Matrix(); 729 for (let i = 0; i < loop_times; i++) { 730 matrix.setMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9]); 731 } 732 console.info(msg + ' SetAndGetMatrix successed'); 733 } catch (e) { 734 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 735 expect().assertFail() 736 } 737 738 try { 739 let matrix = new drawing.Matrix(); 740 matrix.setMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9]); 741 for (let i = 0; i < loop_times; i++) { 742 matrix.getValue(0); 743 } 744 for (let i = 0; i < loop_times; i++) { 745 matrix.getAll(); 746 } 747 console.info(msg + ' SetAndGetMatrix successed'); 748 } catch (e) { 749 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 750 expect().assertFail() 751 } 752 }) 753 754 /** 755 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0504 756 * @tc.name : testMatrixSetAndGetMatrixAbnormal 757 * @tc.desc : testMatrixSetAndGetMatrixAbnormal 758 * @tc.size : MediumTest 759 * @tc.type : Function 760 * @tc.level : Level3 761 */ 762 it('testMatrixSetAndGetMatrixAbnormal', DEFAULT, () => { 763 const msg = 'testMatrixSetAndGetMatrixAbnormal'; 764 try { 765 let matrix = new drawing.Matrix(); 766 matrix.setMatrix([1, 2, 3, 4, 5, 6,7, 8]); 767 matrix.getValue(9); 768 console.info(msg + ' SetAndGetMatrix successed'); 769 } catch (e) { 770 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 771 expect(e.code).assertEqual(401); 772 } 773 774 try { 775 let matrix = new drawing.Matrix(); 776 matrix.setMatrix([1, 2, 3, 4, 5, 6, 7, 8, 8, 8]) 777 matrix.getValue(-1); 778 console.info(msg + ' SetAndGetMatrix successed'); 779 } catch (e) { 780 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 781 expect(e.code).assertEqual(401); 782 } 783 784 try { 785 let matrix = new drawing.Matrix(); 786 matrix.getValue(-1); 787 console.info(msg + ' SetAndGetMatrix successed'); 788 } catch (e) { 789 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 790 expect(e.code).assertEqual(401); 791 } 792 793 try { 794 let matrix = new drawing.Matrix(); 795 matrix.getValue(9); 796 console.info(msg + ' SetAndGetMatrix successed'); 797 } catch (e) { 798 console.info(msg + ` SetAndGetMatrix errorCode is: ${e.code} + errormsg is: ${e.message}`); 799 expect(e.code).assertEqual(401); 800 } 801 }) 802 /** 803 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0600 804 * @tc.name : testMatrixPreConcatNormal 805 * @tc.desc : testMatrixPreConcatNormal 806 * @tc.size : MediumTest 807 * @tc.type : Function 808 * @tc.level : Level0 809 */ 810 it('testMatrixPreConcatNormal', DEFAULT, () => { 811 const msg = 'testMatrixPreConcatNormal'; 812 try { 813 let matrix1 = new drawing.Matrix(); 814 matrix1.setMatrix([2, 1, 3, 1, 2, 1, 3, 1, 2]); 815 let matrix2 = new drawing.Matrix(); 816 matrix2.setMatrix([-2, 1, 3, 1, 0, -1, 3, -1, 2]); 817 matrix1.preConcat(matrix2); 818 matrix1.getAll(); 819 console.info(msg + ' preConcat successed'); 820 } catch (e) { 821 console.info(msg + ` preConcat errorCode is: ${e.code} + errormsg is: ${e.message}`); 822 expect().assertFail() 823 } 824 }) 825 826 /** 827 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0601 828 * @tc.name : testMatrixPreConcatNull 829 * @tc.desc : testMatrixPreConcatNull 830 * @tc.size : MediumTest 831 * @tc.type : Function 832 * @tc.level : Level3 833 */ 834 it('testMatrixPreConcatNull', DEFAULT, () => { 835 const msg = 'testMatrixPreConcatNull'; 836 try { 837 let matrix1 = new drawing.Matrix(); 838 matrix1.preConcat(null) 839 matrix1.preConcat(undefined) 840 console.info(msg + ' preConcat successed'); 841 } catch (e) { 842 console.info(msg + ` preConcat errorCode is: ${e.code} + errormsg is: ${e.message}`); 843 expect(e.code).assertEqual(401); 844 } 845 846 try { 847 let matrix1 = new drawing.Matrix(); 848 matrix1.preConcat(undefined) 849 console.info(msg + ' preConcat successed'); 850 } catch (e) { 851 console.info(msg + ` preConcat errorCode is: ${e.code} + errormsg is: ${e.message}`); 852 expect(e.code).assertEqual(401); 853 } 854 }) 855 856 /** 857 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0603 858 * @tc.name : testMatrixPreConcatMultipleCalls 859 * @tc.desc : testMatrixPreConcatMultipleCalls 860 * @tc.size : MediumTest 861 * @tc.type : Function 862 * @tc.level : Level3 863 */ 864 it('testMatrixPreConcatMultipleCalls', DEFAULT, () => { 865 const msg = 'testMatrixPreConcatMultipleCalls'; 866 try { 867 let matrix = new drawing.Matrix(); 868 for (let i = 0; i < loop_times; i++) { 869 matrix.preConcat(matrix); 870 } 871 console.info(msg + ' preConcat successed'); 872 } catch (e) { 873 console.info(msg + ` preConcat errorCode is: ${e.code} + errormsg is: ${e.message}`); 874 expect().assertFail() 875 } 876 }) 877 878 /** 879 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0700 880 * @tc.name : testMatrixIsEqualNormal 881 * @tc.desc : testMatrixIsEqualNormal 882 * @tc.size : MediumTest 883 * @tc.type : Function 884 * @tc.level : Level0 885 */ 886 it('testMatrixIsEqualNormal', DEFAULT, () => { 887 const msg = 'testMatrixIsEqualNormal'; 888 try { 889 let matrix1 = new drawing.Matrix(); 890 matrix1.setMatrix([2, 1, 3, 1, 2, 1, 3, 1, 2]); 891 let matrix2 = new drawing.Matrix(); 892 matrix2.setMatrix([-2, 1, 3, 1, 0, -1, 3, -1, 2]); 893 matrix1.isEqual(matrix2); 894 console.info(msg + ' isEqual successed'); 895 } catch (e) { 896 console.info(msg + ` isEqual errorCode is: ${e.code} + errormsg is: ${e.message}`); 897 expect().assertFail() 898 } 899 900 try { 901 let matrix1 = new drawing.Matrix(); 902 matrix1.setMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9]); 903 let matrix2 = new drawing.Matrix(); 904 matrix2.setMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9]); 905 matrix1.isEqual(matrix2) 906 console.info(msg + ' isEqual successed'); 907 } catch (e) { 908 console.info(msg + ` isEqual errorCode is: ${e.code} + errormsg is: ${e.message}`); 909 expect().assertFail() 910 } 911 }) 912 913 /** 914 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0701 915 * @tc.name : testMatrixIsEqualNull 916 * @tc.desc : testMatrixIsEqualNull 917 * @tc.size : MediumTest 918 * @tc.type : Function 919 * @tc.level : Level3 920 */ 921 it('testMatrixIsEqualNull', DEFAULT, () => { 922 const msg = 'testMatrixIsEqualNull'; 923 try { 924 let matrix1 = new drawing.Matrix(); 925 matrix1.isEqual(null); 926 console.info(msg + ' isEqual successed'); 927 } catch (e) { 928 console.info(msg + ` isEqual errorCode is: ${e.code} + errormsg is: ${e.message}`); 929 expect(e.code).assertEqual(401); 930 } 931 932 try { 933 let matrix1 = new drawing.Matrix(); 934 matrix1.isEqual(undefined); 935 console.info(msg + ' isEqual successed'); 936 } catch (e) { 937 console.info(msg + ` isEqual errorCode is: ${e.code} + errormsg is: ${e.message}`); 938 expect(e.code).assertEqual(401); 939 } 940 }) 941 942 /** 943 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0703 944 * @tc.name : testMatrixIsEqualMultipleCalls 945 * @tc.desc : testMatrixIsEqualMultipleCalls 946 * @tc.size : MediumTest 947 * @tc.type : Function 948 * @tc.level : Level3 949 */ 950 it('testMatrixIsEqualMultipleCalls', DEFAULT, () => { 951 const msg = 'testMatrixIsEqualMultipleCalls'; 952 try { 953 let matrix1 = new drawing.Matrix(); 954 matrix1.setMatrix([2, 1, 3, 1, 2, 1, 3, 1, 2]); 955 let matrix2 = new drawing.Matrix(); 956 matrix2.setMatrix([-2, 1, 3, 1, 0, -1, 3, -1, 2]); 957 console.info(msg + ' isEqual successed'); 958 } catch (e) { 959 console.info(msg + ` isEqual errorCode is: ${e.code} + errormsg is: ${e.message}`); 960 expect().assertFail() 961 } 962 963 try { 964 let matrix1 = new drawing.Matrix(); 965 matrix1.setMatrix([2, 1, 3, 1, 2, 1, 3, 1, 2]); 966 let matrix2 = new drawing.Matrix(); 967 matrix2.setMatrix([-2, 1, 3, 1, 0, -1, 3, -1, 2]); 968 for (let i = 0; i < loop_times; i++) { 969 matrix1.isEqual(matrix2); 970 } 971 console.info(msg + ' isEqual successed'); 972 } catch (e) { 973 console.info(msg + ` isEqual errorCode is: ${e.code} + errormsg is: ${e.message}`); 974 expect().assertFail() 975 } 976 }) 977 978 /** 979 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0800 980 * @tc.name : testMatrixInvertNormal 981 * @tc.desc : testMatrixInvertNormal 982 * @tc.size : MediumTest 983 * @tc.type : Function 984 * @tc.level : Level0 985 */ 986 it('testMatrixInvertNormal', DEFAULT, () => { 987 const msg = 'testMatrixInvertNormal'; 988 try { 989 let matrix1 = new drawing.Matrix(); 990 let matrix2 = new drawing.Matrix(); 991 matrix2 .setScale(0, 0, 0.5, 0.5); 992 matrix1.invert(matrix2); 993 console.info(msg + ' invert successed'); 994 } catch (e) { 995 console.info(msg + ` invert errorCode is: ${e.code} + errormsg is: ${e.message}`); 996 expect().assertFail() 997 } 998 999 try { 1000 let matrix1 = new drawing.Matrix(); 1001 let matrix2 = new drawing.Matrix(); 1002 matrix1 .setScale(0, 0, 0.5, 0.5); 1003 matrix1.invert(matrix2); 1004 console.info(msg + ' invert successed'); 1005 } catch (e) { 1006 console.info(msg + ` invert errorCode is: ${e.code} + errormsg is: ${e.message}`); 1007 expect().assertFail() 1008 } 1009 }) 1010 1011 /** 1012 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0801 1013 * @tc.name : testMatrixInvertNull 1014 * @tc.desc : testMatrixInvertNull 1015 * @tc.size : MediumTest 1016 * @tc.type : Function 1017 * @tc.level : Level3 1018 */ 1019 it('testMatrixInvertNull', DEFAULT, () => { 1020 const msg = 'testMatrixInvertNull'; 1021 try { 1022 let matrix1 = new drawing.Matrix(); 1023 matrix1.invert(null); 1024 console.info(msg + ' invert successed'); 1025 } catch (e) { 1026 console.info(msg + ` invert errorCode is: ${e.code} + errormsg is: ${e.message}`); 1027 expect(e.code).assertEqual(401); 1028 } 1029 1030 try { 1031 let matrix1 = new drawing.Matrix(); 1032 matrix1.invert(undefined); 1033 console.info(msg + ' invert successed'); 1034 } catch (e) { 1035 console.info(msg + ` invert errorCode is: ${e.code} + errormsg is: ${e.message}`); 1036 expect(e.code).assertEqual(401); 1037 } 1038 }) 1039 1040 /** 1041 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0803 1042 * @tc.name : testMatrixInvertMultipleCalls 1043 * @tc.desc : testMatrixInvertMultipleCalls 1044 * @tc.size : MediumTest 1045 * @tc.type : Function 1046 * @tc.level : Level3 1047 */ 1048 it('testMatrixInvertMultipleCalls', DEFAULT, () => { 1049 const msg = 'testMatrixInvertMultipleCalls'; 1050 try { 1051 let matrix1 = new drawing.Matrix(); 1052 matrix1.setMatrix([2, 1, 3, 1, 2, 1, 3, 1, 2]); 1053 let matrix2 = new drawing.Matrix(); 1054 matrix2.setMatrix([-2, 1, 3, 1, 0, -1, 3, -1, 2]); 1055 console.info(msg + ' invert successed'); 1056 } catch (e) { 1057 console.info(msg + ` invert errorCode is: ${e.code} + errormsg is: ${e.message}`); 1058 expect().assertFail() 1059 } 1060 1061 try { 1062 let matrix1 = new drawing.Matrix(); 1063 matrix1.setMatrix([2, 1, 3, 1, 2, 1, 3, 1, 2]); 1064 let matrix2 = new drawing.Matrix(); 1065 matrix2.setMatrix([-2, 1, 3, 1, 0, -1, 3, -1, 2]); 1066 for (let i = 0; i < loop_times; i++) { 1067 matrix1.invert(matrix2); 1068 } 1069 console.info(msg + ' invert successed'); 1070 } catch (e) { 1071 console.info(msg + ` invert errorCode is: ${e.code} + errormsg is: ${e.message}`); 1072 expect().assertFail() 1073 } 1074 }) 1075 1076 /** 1077 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0900 1078 * @tc.name : testMatrixIsIdentityNormal 1079 * @tc.desc : testMatrixIsIdentityNormal 1080 * @tc.size : MediumTest 1081 * @tc.type : Function 1082 * @tc.level : Level0 1083 */ 1084 it('testMatrixIsIdentityNormal', DEFAULT, () => { 1085 const msg = 'testMatrixIsIdentityNormal'; 1086 try { 1087 let matrix1 = new drawing.Matrix(); 1088 matrix1.isIdentity(); 1089 console.info(msg + ' isIdentity successed'); 1090 } catch (e) { 1091 console.info(msg + ` isIdentity errorCode is: ${e.code} + errormsg is: ${e.message}`); 1092 expect().assertFail() 1093 } 1094 1095 try { 1096 let matrix1 = new drawing.Matrix(); 1097 matrix1.setMatrix([2, 1, 3, 1, 2, 1, 3, 1, 2]); 1098 matrix1.isIdentity(); 1099 console.info(msg + ' isIdentity successed'); 1100 } catch (e) { 1101 console.info(msg + ` isIdentity errorCode is: ${e.code} + errormsg is: ${e.message}`); 1102 expect().assertFail() 1103 } 1104 }) 1105 1106 /** 1107 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_0902 1108 * @tc.name : testMatrixIsIdentityMultipleCalls 1109 * @tc.desc : testMatrixIsIdentityMultipleCalls 1110 * @tc.size : MediumTest 1111 * @tc.type : Function 1112 * @tc.level : Level3 1113 */ 1114 it('testMatrixIsIdentityMultipleCalls', DEFAULT, () => { 1115 const msg = 'testMatrixIsIdentityMultipleCalls'; 1116 try { 1117 let matrix1 = new drawing.Matrix(); 1118 for (let i = 0; i < loop_times; i++) { 1119 matrix1.isIdentity(); 1120 } 1121 console.info(msg + ' isIdentity successed'); 1122 } catch (e) { 1123 console.info(msg + ` isIdentity errorCode is: ${e.code} + errormsg is: ${e.message}`); 1124 expect().assertFail() 1125 } 1126 }) 1127 1128 /** 1129 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_1000 1130 * @tc.name : testMatrixPostRotateNormal 1131 * @tc.desc : testMatrixPostRotateNormal 1132 * @tc.size : MediumTest 1133 * @tc.type : Function 1134 * @tc.level : Level0 1135 */ 1136 it('testMatrixPostRotateNormal', DEFAULT, () => { 1137 const msg = 'testMatrixPostRotateNormal'; 1138 try { 1139 let matrix = new drawing.Matrix(); 1140 matrix.postRotate(90, 100, 100); 1141 let widths : number[] = matrix.getAll(); 1142 expect(widths.length == 9).assertTrue(); 1143 expect(matrix != null).assertTrue(); 1144 console.info(msg + ' postRotate successed,width:'+ widths.length + JSON.stringify(matrix)); 1145 } catch (e) { 1146 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1147 expect().assertFail() 1148 } 1149 1150 try { 1151 let matrix = new drawing.Matrix(); 1152 matrix.postRotate(90.1, 100.1, 100.1); 1153 let widths : number[] = matrix.getAll(); 1154 expect(widths.length == 9).assertTrue(); 1155 expect(matrix != null).assertTrue(); 1156 console.info(msg + ' postRotate successed,width:'+ widths.length + JSON.stringify(matrix)); 1157 } catch (e) { 1158 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1159 expect().assertFail() 1160 } 1161 1162 try { 1163 let matrix = new drawing.Matrix(); 1164 matrix.postRotate(-90, 100, 100); 1165 let widths : number[] = matrix.getAll(); 1166 expect(widths.length == 9).assertTrue(); 1167 expect(matrix != null).assertTrue(); 1168 console.info(msg + ' postRotate successed,width:'+ widths.length + JSON.stringify(matrix)); 1169 } catch (e) { 1170 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1171 expect().assertFail() 1172 } 1173 1174 try { 1175 let matrix = new drawing.Matrix(); 1176 matrix.postRotate(90, -100, 100); 1177 let widths : number[] = matrix.getAll(); 1178 expect(widths.length == 9).assertTrue(); 1179 expect(matrix != null).assertTrue(); 1180 console.info(msg + ' postRotate successed,width:'+ widths.length + JSON.stringify(matrix)); 1181 } catch (e) { 1182 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1183 expect().assertFail() 1184 } 1185 1186 try { 1187 let matrix = new drawing.Matrix(); 1188 matrix.postRotate(90, 100, -100); 1189 let widths : number[] = matrix.getAll(); 1190 expect(widths.length == 9).assertTrue(); 1191 expect(matrix != null).assertTrue(); 1192 console.info(msg + ' postRotate successed,width:'+ widths.length + JSON.stringify(matrix)); 1193 } catch (e) { 1194 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1195 expect().assertFail() 1196 } 1197 1198 try { 1199 let matrix = new drawing.Matrix(); 1200 matrix.postRotate(361, Number.MAX_VALUE, Number.MAX_VALUE); 1201 let widths : number[] = matrix.getAll(); 1202 expect(widths.length == 9).assertTrue(); 1203 expect(matrix != null).assertTrue(); 1204 console.info(msg + ' postRotate successed,width:'+ widths.length + JSON.stringify(matrix)); 1205 } catch (e) { 1206 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1207 expect().assertFail() 1208 } 1209 }) 1210 1211 /** 1212 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_1001 1213 * @tc.name : testMatrixPostRotateNull 1214 * @tc.desc : testMatrixPostRotateNull 1215 * @tc.size : MediumTest 1216 * @tc.type : Function 1217 * @tc.level : Level3 1218 */ 1219 it('testMatrixPostRotateNull', DEFAULT, () => { 1220 const msg = 'testMatrixPostRotateNull'; 1221 try { 1222 let matrix = new drawing.Matrix(); 1223 matrix.postRotate(null, 100, 100); 1224 console.info(msg + ' postRotate successed'); 1225 } catch (e) { 1226 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1227 expect(e.code).assertEqual(401); 1228 } 1229 1230 try { 1231 let matrix = new drawing.Matrix(); 1232 matrix.postRotate(90, null, 100); 1233 console.info(msg + ' postRotate successed'); 1234 } catch (e) { 1235 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1236 expect(e.code).assertEqual(401); 1237 } 1238 1239 try { 1240 let matrix = new drawing.Matrix(); 1241 matrix.postRotate(90, 100, null); 1242 console.info(msg + ' postRotate successed'); 1243 } catch (e) { 1244 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1245 expect(e.code).assertEqual(401); 1246 } 1247 1248 try { 1249 let matrix = new drawing.Matrix(); 1250 matrix.postRotate(undefined, 100, 100); 1251 console.info(msg + ' postRotate successed'); 1252 } catch (e) { 1253 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1254 expect(e.code).assertEqual(401); 1255 } 1256 1257 try { 1258 let matrix = new drawing.Matrix(); 1259 matrix.postRotate(90, undefined, 100); 1260 console.info(msg + ' postRotate successed'); 1261 } catch (e) { 1262 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1263 expect(e.code).assertEqual(401); 1264 } 1265 1266 try { 1267 let matrix = new drawing.Matrix(); 1268 matrix.postRotate(90, 100, undefined); 1269 console.info(msg + ' postRotate successed'); 1270 } catch (e) { 1271 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1272 expect(e.code).assertEqual(401); 1273 } 1274 }) 1275 1276 /** 1277 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_1003 1278 * @tc.name : testMatrixPostRotateMultipleCalls 1279 * @tc.desc : testMatrixPostRotateMultipleCalls 1280 * @tc.size : MediumTest 1281 * @tc.type : Function 1282 * @tc.level : Level3 1283 */ 1284 it('testMatrixPostRotateMultipleCalls', DEFAULT, () => { 1285 const msg = 'testMatrixPostRotateMultipleCalls'; 1286 try { 1287 let matrix = new drawing.Matrix(); 1288 for (let i = 0; i < loop_times; i++) { 1289 matrix.postRotate(Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, 1290 Math.random() * Number.MAX_VALUE); 1291 } 1292 console.info(msg + ' postRotate successed'); 1293 } catch (e) { 1294 console.info(msg + ` postRotate errorCode is: ${e.code} + errormsg is: ${e.message}`); 1295 expect().assertFail() 1296 } 1297 }) 1298 1299 /** 1300 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_1100 1301 * @tc.name : testMatrixPostScaleNormal 1302 * @tc.desc : testMatrixPostScaleNormal 1303 * @tc.size : MediumTest 1304 * @tc.type : Function 1305 * @tc.level : Level0 1306 */ 1307 it('testMatrixPostScaleNormal', DEFAULT, () => { 1308 const msg = 'testMatrixPostScaleNormal'; 1309 try { 1310 let matrix = new drawing.Matrix(); 1311 matrix.postScale(100, 100, 150, 150); 1312 let widths : number[] = matrix.getAll(); 1313 expect(widths.length == 9).assertTrue(); 1314 expect(matrix != null).assertTrue(); 1315 console.info(msg + ' postScale successed,width:'+ widths.length + JSON.stringify(matrix)); 1316 } catch (e) { 1317 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1318 expect().assertFail() 1319 } 1320 1321 try { 1322 let matrix = new drawing.Matrix(); 1323 matrix.postScale(0.2, 0.2, 0.5, 0.5); 1324 let widths : number[] = matrix.getAll(); 1325 expect(widths.length == 9).assertTrue(); 1326 expect(matrix != null).assertTrue(); 1327 console.info(msg + ' postScale successed,width:'+ widths.length + JSON.stringify(matrix)); 1328 } catch (e) { 1329 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1330 expect().assertFail() 1331 } 1332 1333 try { 1334 let matrix = new drawing.Matrix(); 1335 matrix.postScale(-100, -100, 150, 150); 1336 let widths : number[] = matrix.getAll(); 1337 expect(widths.length == 9).assertTrue(); 1338 expect(matrix != null).assertTrue(); 1339 console.info(msg + ' postScale successed,width:'+ widths.length + JSON.stringify(matrix)); 1340 } catch (e) { 1341 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1342 expect().assertFail() 1343 } 1344 1345 try { 1346 let matrix = new drawing.Matrix(); 1347 matrix.postScale(100, 100, -150, -150); 1348 let widths : number[] = matrix.getAll(); 1349 expect(widths.length == 9).assertTrue(); 1350 expect(matrix != null).assertTrue(); 1351 console.info(msg + ' postScale successed,width:'+ widths.length + JSON.stringify(matrix)); 1352 } catch (e) { 1353 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1354 expect().assertFail() 1355 } 1356 1357 try { 1358 let matrix = new drawing.Matrix(); 1359 matrix.postScale(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); 1360 let widths : number[] = matrix.getAll(); 1361 expect(widths.length == 9).assertTrue(); 1362 expect(matrix != null).assertTrue(); 1363 console.info(msg + ' postScale successed,width:'+ widths.length + JSON.stringify(matrix)); 1364 } catch (e) { 1365 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1366 expect().assertFail() 1367 } 1368 }) 1369 1370 /** 1371 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_1101 1372 * @tc.name : testMatrixPostScaleNull 1373 * @tc.desc : testMatrixPostScaleNull 1374 * @tc.size : MediumTest 1375 * @tc.type : Function 1376 * @tc.level : Level3 1377 */ 1378 it('testMatrixPostScaleNull', DEFAULT, () => { 1379 const msg = 'testMatrixPostScaleNull'; 1380 try { 1381 let matrix = new drawing.Matrix(); 1382 matrix.postScale(null, 100, 150, 150); 1383 console.info(msg + ' postScale successed'); 1384 } catch (e) { 1385 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1386 expect(e.code).assertEqual(401); 1387 } 1388 1389 try { 1390 let matrix = new drawing.Matrix(); 1391 matrix.postScale(100, null, 150, 150); 1392 console.info(msg + ' postScale successed'); 1393 } catch (e) { 1394 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1395 expect(e.code).assertEqual(401); 1396 } 1397 1398 try { 1399 let matrix = new drawing.Matrix(); 1400 matrix.postScale(100, 100, null, 150); 1401 console.info(msg + ' postScale successed'); 1402 } catch (e) { 1403 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1404 expect(e.code).assertEqual(401); 1405 } 1406 1407 try { 1408 let matrix = new drawing.Matrix(); 1409 matrix.postScale(100, 100, 150, null); 1410 console.info(msg + ' postScale successed'); 1411 } catch (e) { 1412 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1413 expect(e.code).assertEqual(401); 1414 } 1415 1416 try { 1417 let matrix = new drawing.Matrix(); 1418 matrix.postScale(undefined, 100, 150, 150); 1419 console.info(msg + ' postScale successed'); 1420 } catch (e) { 1421 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1422 expect(e.code).assertEqual(401); 1423 } 1424 1425 try { 1426 let matrix = new drawing.Matrix(); 1427 matrix.postScale(100, undefined, 150, 150); 1428 console.info(msg + ' postScale successed'); 1429 } catch (e) { 1430 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1431 expect(e.code).assertEqual(401); 1432 } 1433 1434 try { 1435 let matrix = new drawing.Matrix(); 1436 matrix.postScale(100, 100, undefined, 150); 1437 console.info(msg + ' postScale successed'); 1438 } catch (e) { 1439 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1440 expect(e.code).assertEqual(401); 1441 } 1442 1443 try { 1444 let matrix = new drawing.Matrix(); 1445 matrix.postScale(100, 100, 150, undefined); 1446 console.info(msg + ' postScale successed'); 1447 } catch (e) { 1448 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1449 expect(e.code).assertEqual(401); 1450 } 1451 }) 1452 1453 /** 1454 * @tc.number : SUB_BASIC_GRAPHICS_SPECIAL_API_TS_DRAWING_MATRIX_1103 1455 * @tc.name : testMatrixPostScaleMultipleCalls 1456 * @tc.desc : testMatrixPostScaleMultipleCalls 1457 * @tc.size : MediumTest 1458 * @tc.type : Function 1459 * @tc.level : Level3 1460 */ 1461 it('testMatrixPostScaleMultipleCalls', DEFAULT, () => { 1462 const msg = 'testMatrixPostScaleMultipleCalls'; 1463 try { 1464 let matrix = new drawing.Matrix(); 1465 for (let i = 0; i < loop_times; i++) { 1466 matrix.postScale(Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE, Math.random() * Number.MAX_VALUE); 1467 } 1468 console.info(msg + ' postScale successed'); 1469 } catch (e) { 1470 console.info(msg + ` postScale errorCode is: ${e.code} + errormsg is: ${e.message}`); 1471 expect().assertFail() 1472 } 1473 }) 1474 }) 1475}