1/* 2 * Copyright (C) 2024 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' 16import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect , Level, TestType, Size} from '@ohos/hypium' 17import window from '@ohos.window' 18import display from '@ohos.display' 19 20const TRUE_WINDOW = true; 21const avoidAreaType = 3; 22 23export default function window_test() { 24 describe('window_test', function () { 25 var wnd; 26 var topWindow; 27 const DELAY_TIME = 3000; 28 var height; 29 30 function windowSizeChangeCallback(data) { 31 console.log('windowTest OnOffTest1 callback ' + JSON.stringify(data)); 32 height = data.height; 33 } 34 35 function systemAvoidAreaChangeCallback(data) { 36 console.log('windowTest OnOffTest2 callback ' + JSON.stringify(data)); 37 height = data.bottomRect.height; 38 } 39 40 beforeAll(function (done) { 41 console.log('windowTest beforeAll begin'); 42 window.getTopWindow().then(wnd => { 43 console.log('windowTest beforeAll window.getTopWindow wnd: ' + wnd); 44 if (wnd) { 45 topWindow = wnd; 46 } else { 47 console.log('windowTest beforeAll window.getTopWindow empty'); 48 } 49 }, (err) => { 50 console.log('windowTest beforeAll window.getTopWindow failed, err : ' + JSON.stringify(err)); 51 }) 52 setTimeout(() => { 53 done(); 54 }, 5000); 55 }) 56 beforeEach(function (done) { 57 if (topWindow) { 58 topWindow.show().then(() => { 59 console.log('windowTest beforeEach wnd.show success'); 60 topWindow.getProperties().then(data => { 61 if (data.isFullScreen) { 62 topWindow.setFullScreen(false).then(() => { 63 console.log('windowTest beforeEach wnd.setFullScreen(false) success'); 64 }, (err) => { 65 console.log('windowTest beforeEach wnd.getProperties failed, err : ' + JSON.stringify(err)); 66 }) 67 } 68 }, (err) => { 69 console.log('windowTest beforeEach wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err)); 70 }) 71 }, (err) => { 72 console.log('windowTest beforeEach wnd.show failed, err : ' + JSON.stringify(err)); 73 }) 74 setTimeout(() => { 75 done(); 76 }, DELAY_TIME); 77 } else { 78 done(); 79 } 80 }) 81 afterEach(function () { 82 }) 83 afterAll(function () { 84 }) 85 86 /** 87 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0280 88 * @tc.name testGetProperties_Promise 89 * @tc.desc Get the current application main window properties 90 */ 91 it('testGetProperties_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 92 let msgStr = 'getProperties_Test_001'; 93 console.log(msgStr + ' begin'); 94 window.getTopWindow().then(wnd => { 95 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 96 expect(wnd != null).assertTrue(); 97 wnd.getProperties().then((data) => { 98 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 99 expect(data.type != null).assertTrue(); 100 expect(data.windowRect.height != null).assertTrue(); 101 expect(data.windowRect.left != null).assertTrue(); 102 expect(data.windowRect.top != null).assertTrue(); 103 expect(data.windowRect.width != null).assertTrue(); 104 expect(!data.isFullScreen).assertTrue(); 105 expect(!data.isLayoutFullScreen).assertTrue(); 106 expect(data.focusable).assertTrue(); 107 expect(data.touchable).assertTrue(); 108 expect(!data.isKeepScreenOn).assertTrue(); 109 expect(!data.isTransparent).assertTrue(); 110 expect(data.brightness != null).assertTrue(); 111 expect(data.dimBehindValue).assertEqual(0); 112 expect(!data.isRoundCorner).assertTrue(); 113 expect(!data.isPrivacyMode).assertTrue(); 114 done(); 115 }, (err) => { 116 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 117 expect().assertFail(); 118 done(); 119 }) 120 }, (err) => { 121 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 122 expect().assertFail(); 123 done(); 124 }) 125 }) 126 127 /** 128 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0270 129 * @tc.name testGetProperties_Callback 130 * @tc.desc Get the current application main window properties 131 */ 132 it('testGetProperties_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 133 let msgStr = 'getProperties_Test_002'; 134 console.log(msgStr + ' begin'); 135 window.getTopWindow().then(wnd => { 136 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 137 expect(wnd != null).assertTrue(); 138 wnd.getProperties((err, data) => { 139 if (err.code != 0) { 140 console.log(msgStr + ' window.getProperties callback fail' + JSON.stringify(err)); 141 expect().assertFail(); 142 done(); 143 } else { 144 expect(data.type != null).assertTrue(); 145 expect(data.windowRect.height != null).assertTrue(); 146 expect(data.windowRect.left != null).assertTrue(); 147 expect(data.windowRect.top != null).assertTrue(); 148 expect(data.windowRect.width != null).assertTrue(); 149 expect(!data.isFullScreen).assertTrue(); 150 expect(!data.isLayoutFullScreen).assertTrue(); 151 expect(data.focusable).assertTrue(); 152 expect(data.touchable).assertTrue(); 153 expect(!data.isKeepScreenOn).assertTrue(); 154 expect(!data.isTransparent).assertTrue(); 155 expect(data.brightness != null).assertTrue(); 156 expect(data.dimBehindValue).assertEqual(0); 157 expect(!data.isRoundCorner).assertTrue(); 158 expect(!data.isPrivacyMode).assertTrue(); 159 done(); 160 } 161 }) 162 }, (err) => { 163 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 164 expect().assertFail(); 165 done(); 166 }) 167 }) 168 169 /** 170 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0170 171 * @tc.name testGetAvoidArea_SystemUI_Type_Promise 172 * @tc.desc Get SystemUI type avoidance area 173 */ 174 it('testGetAvoidArea_SystemUI_Type_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 175 let msgStr = 'getAvoidArea_Test_001'; 176 console.log(msgStr + ' begin'); 177 window.getTopWindow().then(wnd => { 178 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 179 expect(wnd != null).assertTrue(); 180 wnd.getAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).then((data) => { 181 console.log(msgStr + ' wnd.getAvoidArea success, data :' + JSON.stringify(data)); 182 expect(data.visible).assertTrue(); 183 expect(data.rightRect != null).assertTrue(); 184 expect(data.topRect != null).assertTrue(); 185 expect(data.bottomRect != null).assertTrue(); 186 expect(data.leftRect != null).assertTrue(); 187 done(); 188 }, (err) => { 189 console.log(msgStr + ' wnd.getAvoidArea failed, err : ' + JSON.stringify(err)); 190 expect().assertFail(); 191 done(); 192 }) 193 }, (err) => { 194 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 195 expect().assertFail(); 196 done(); 197 }) 198 }) 199 200 /** 201 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0160 202 * @tc.name testGetAvoidArea_Notch_Type_Promise 203 * @tc.desc Get Notch type avoidance area 204 */ 205 it('testGetAvoidArea_Notch_Type_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 206 let msgStr = 'getAvoidArea_Test_002'; 207 console.log(msgStr + ' begin'); 208 window.getTopWindow().then(wnd => { 209 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 210 expect(wnd != null).assertTrue(); 211 wnd.getAvoidArea(window.AvoidAreaType.TYPE_CUTOUT).then((data) => { 212 console.log(msgStr + ' wnd.getAvoidArea success, data :' + JSON.stringify(data)); 213 expect(!data.visible).assertTrue(); 214 expect(data.rightRect != null).assertTrue(); 215 expect(data.topRect != null).assertTrue(); 216 expect(data.bottomRect != null).assertTrue(); 217 expect(data.leftRect != null).assertTrue(); 218 done(); 219 }, (err) => { 220 console.log(msgStr + ' wnd.getAvoidArea failed, err : ' + JSON.stringify(err)); 221 expect().assertFail(); 222 done(); 223 }) 224 }, (err) => { 225 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 226 expect().assertFail(); 227 done(); 228 }) 229 }) 230 231 /** 232 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0190 233 * @tc.name testGetAvoidArea_System_Gesture_Type_Promise 234 * @tc.desc Get system gesture type avoidance area 235 */ 236 it('testGetAvoidArea_System_Gesture_Type_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 237 let msgStr = 'getAvoidArea_Test_003'; 238 console.log(msgStr + ' begin'); 239 window.getTopWindow().then(wnd => { 240 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 241 expect(wnd != null).assertTrue(); 242 wnd.getAvoidArea(avoidAreaType).then((data) => { 243 console.log(msgStr + ' wnd.getAvoidArea success, data :' + JSON.stringify(data)); 244 expect(data.visible).assertTrue(); 245 expect(data.rightRect != null).assertTrue(); 246 expect(data.topRect != null).assertTrue(); 247 expect(data.bottomRect != null).assertTrue(); 248 expect(data.leftRect != null).assertTrue(); 249 done(); 250 }, (err) => { 251 console.log(msgStr + ' wnd.getAvoidArea failed, err : ' + JSON.stringify(err)); 252 expect().assertFail(); 253 done(); 254 }) 255 }, (err) => { 256 console.log('windowTest getAvoidAreaTest3 window.getTopWindow failed, err : ' + JSON.stringify(err)); 257 expect().assertFail(); 258 done(); 259 }) 260 }) 261 262 /** 263 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0210 264 * @tc.name testGetAvoidArea_System_Type_Promise 265 * @tc.desc Get System type avoidance area 266 */ 267 it('testGetAvoidArea_System_Type_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 268 let msgStr = 'getAvoidArea_Test_004'; 269 console.log(msgStr + ' begin'); 270 window.getTopWindow().then(wnd => { 271 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 272 expect(wnd != null).assertTrue(); 273 wnd.getAvoidArea(window.AvoidAreaType.TYPE_SYSTEM, (err, data) => { 274 if (err.code != 0) { 275 console.log(msgStr + ' wnd.getAvoidArea callback fail' + JSON.stringify(err)); 276 expect().assertFail(); 277 done(); 278 } else { 279 expect(data.visible).assertTrue(); 280 expect(data.topRect != null).assertTrue(); 281 expect(data.rightRect != null).assertTrue(); 282 expect(data.bottomRect != null).assertTrue(); 283 expect(data.leftRect != null).assertTrue(); 284 done(); 285 } 286 }) 287 }) 288 }) 289 290 /** 291 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0140 292 * @tc.name testGetAvoidArea_Cutout_Type_Callback 293 * @tc.desc Get Cutout type avoidance area 294 */ 295 it('testGetAvoidArea_Cutout_Type_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 296 let msgStr = 'getAvoidArea_Test_005'; 297 console.log(msgStr + ' begin'); 298 window.getTopWindow().then(wnd => { 299 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 300 expect(wnd != null).assertTrue(); 301 wnd.getAvoidArea(window.AvoidAreaType.TYPE_CUTOUT, (err, data) => { 302 if (err.code != 0) { 303 console.log(msgStr + ' wnd.getAvoidArea callback fail' + JSON.stringify(err)); 304 expect().assertFail(); 305 done(); 306 } else { 307 expect(!data.visible).assertTrue(); 308 expect(data.topRect != null).assertTrue(); 309 expect(data.rightRect != null).assertTrue(); 310 expect(data.bottomRect != null).assertTrue(); 311 expect(data.leftRect != null).assertTrue(); 312 console.log(msgStr + ' wnd.getAvoidArea callback end'); 313 done(); 314 } 315 }) 316 }, (err) => { 317 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 318 expect().assertFail(); 319 done(); 320 }) 321 }) 322 323 /** 324 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0180 325 * @tc.name testGetAvoidArea_System_Gesture_Type_Callback 326 * @tc.desc Get system gesture type avoidance area 327 */ 328 it('testGetAvoidArea_System_Gesture_Type_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 329 let msgStr = 'getAvoidArea_Test_006'; 330 console.log(msgStr + ' begin'); 331 window.getTopWindow().then(wnd => { 332 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 333 expect(wnd != null).assertTrue(); 334 wnd.getAvoidArea(avoidAreaType, (err, data) => { 335 if (err.code != 0) { 336 console.log(msgStr + ' wnd.getAvoidArea callback fail' + JSON.stringify(err)); 337 expect().assertFail(); 338 done(); 339 } else { 340 expect(data.visible).assertTrue(); 341 expect(data.topRect != null).assertTrue(); 342 expect(data.rightRect != null).assertTrue(); 343 expect(data.bottomRect != null).assertTrue(); 344 expect(data.leftRect != null).assertTrue(); 345 done(); 346 } 347 }) 348 }, (err) => { 349 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 350 expect().assertFail(); 351 done(); 352 }) 353 }) 354 355 /** 356 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0820 357 * @tc.name testSetFullScreen_Parameter1_Promise 358 * @tc.desc Set the window to be non-fullscreen first and then fullscreen 359 */ 360 it('testSetFullScreen_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 361 let msgStr = 'setFullScreen_Test_001'; 362 console.log(msgStr + ' begin'); 363 window.getTopWindow().then(wnd => { 364 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 365 expect(wnd != null).assertTrue(); 366 wnd.setFullScreen(false).then(() => { 367 wnd.getProperties().then((data) => { 368 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 369 expect(data != null).assertTrue(); 370 expect(!data.isFullScreen).assertTrue(); 371 wnd.setFullScreen(true).then(() => { 372 wnd.getProperties().then((data) => { 373 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 374 expect(data != null).assertTrue(); 375 expect(data.isFullScreen).assertTrue(); 376 done(); 377 }, (err) => { 378 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 379 expect().assertFail(); 380 done(); 381 }) 382 }, (err) => { 383 console.log(msgStr + ' wnd.setFullScreen(true) failed, err : ' + JSON.stringify(err)); 384 expect().assertFail(); 385 done(); 386 }) 387 }, (err) => { 388 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 389 expect().assertFail(); 390 done(); 391 }) 392 }, (err) => { 393 console.log(msgStr + ' wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err)); 394 expect().assertFail(); 395 done(); 396 }) 397 }, (err) => { 398 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 399 expect().assertFail(); 400 done(); 401 }) 402 }) 403 404 /** 405 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0830 406 * @tc.name testSetFullScreen_Parameter2_Callback 407 * @tc.desc Set the window to be non-fullscreen first and then fullscreen. 408 */ 409 it('testSetFullScreen_Parameter2_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 410 let msgStr = 'setFullScreen_Test_002'; 411 console.log(msgStr + ' begin'); 412 window.getTopWindow().then(wnd => { 413 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 414 expect(wnd != null).assertTrue(); 415 wnd.setFullScreen(false, (err) => { 416 if (err.code != 0) { 417 console.log(msgStr + ' window.setFullScreen(false) callback fail' + JSON.stringify(err)); 418 expect().assertFail(); 419 done(); 420 } else { 421 wnd.getProperties((err, data) => { 422 if (err.code != 0) { 423 console.log(msgStr + ' window.getProperties callback fail' + JSON.stringify(err)); 424 expect().assertFail(); 425 done(); 426 } else { 427 expect(!data.isFullScreen).assertTrue(); 428 wnd.setFullScreen(true, (err) => { 429 if (err.code != 0) { 430 console.log(msgStr + ' window.setFullScreen(true) callback fail' + JSON.stringify(err)); 431 expect().assertFail(); 432 done(); 433 } else { 434 wnd.getProperties((err, data) => { 435 if (err.code != 0) { 436 console.log(msgStr + ' window.getProperties callback fail' + JSON.stringify(err)); 437 expect().assertFail(); 438 done(); 439 } else { 440 expect(data.isFullScreen).assertTrue(); 441 console.log(msgStr + ' window.getProperties callback end'); 442 done(); 443 } 444 }) 445 } 446 }) 447 } 448 }) 449 } 450 }) 451 }, (err) => { 452 console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err)); 453 expect().assertFail(); 454 done(); 455 }) 456 }) 457 458 /** 459 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0880 460 * @tc.name testSetLayoutFullScreen_Parameter1_Promise 461 * @tc.desc Set window and layout to full screen 462 */ 463 it('testSetLayoutFullScreen_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 464 let msgStr = 'setLayoutFullScreen_Test_001'; 465 console.log(msgStr + ' begin'); 466 window.getTopWindow().then(wnd => { 467 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 468 expect(wnd != null).assertTrue(); 469 wnd.setFullScreen(true).then(() => { 470 wnd.getProperties().then((data) => { 471 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 472 expect(data.isFullScreen).assertTrue(); 473 wnd.setLayoutFullScreen(true).then(() => { 474 wnd.getProperties().then((data) => { 475 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 476 expect(data != null).assertTrue(); 477 expect(data.isLayoutFullScreen).assertTrue(); 478 done(); 479 }, (err) => { 480 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 481 expect().assertFail(); 482 done(); 483 }) 484 }, (err) => { 485 console.log(msgStr + ' wnd.setLayoutFullScreen(true) failed, err : ' + JSON.stringify(err)); 486 expect().assertFail(); 487 done(); 488 }) 489 }, (err) => { 490 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 491 expect().assertFail(); 492 }) 493 }, (err) => { 494 console.log(msgStr + ' wnd.setFullScreen(true) failed, err : ' + JSON.stringify(err)); 495 expect().assertFail(); 496 done(); 497 }) 498 }, (err) => { 499 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 500 expect().assertFail(); 501 done(); 502 }) 503 }) 504 505 /** 506 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0890 507 * @tc.name testSetLayoutFullScreen_Parameter2_Callback 508 * @tc.desc Set window and layout to full screen. 509 */ 510 it('testSetLayoutFullScreen_Parameter2_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 511 let msgStr = 'setLayoutFullScreen_Test_002'; 512 console.log(msgStr + ' begin'); 513 window.getTopWindow().then(wnd => { 514 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 515 expect(wnd != null).assertTrue(); 516 wnd.setFullScreen(true, (err) => { 517 console.log(msgStr + ' wnd.setFullScreen(true) callback begin'); 518 if (err.code != 0) { 519 console.log(msgStr + ' wnd.setFullScreen callback fail' + JSON.stringify(err)); 520 expect().assertFail(); 521 done(); 522 } else { 523 wnd.getProperties((err, data) => { 524 if (err.code != 0) { 525 console.log(msgStr + ' wnd.getProperties callback fail' + JSON.stringify(err)); 526 expect().assertFail(); 527 done(); 528 } else { 529 expect(data.isFullScreen).assertTrue(); 530 wnd.setLayoutFullScreen(true, (err) => { 531 if (err.code != 0) { 532 console.log(msgStr + ' wnd.setLayoutFullScreen callback fail' + JSON.stringify(err)); 533 expect().assertFail(); 534 done(); 535 } else { 536 wnd.getProperties((err, data) => { 537 if (err.code != 0) { 538 console.log(msgStr + ' wnd.getProperties callback fail' + JSON.stringify(err)); 539 expect().assertFail(); 540 done(); 541 } else { 542 console.log(msgStr + ' wnd.getProperties callback end'); 543 expect(data.isLayoutFullScreen).assertTrue(); 544 done(); 545 } 546 }) 547 } 548 }) 549 } 550 551 }) 552 } 553 }) 554 }, (err) => { 555 console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err)); 556 expect().assertFail(); 557 done(); 558 }) 559 }) 560 561 /** 562 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0900 563 * @tc.name testSetLayoutFullScreen_Parameter3_Promise 564 * @tc.desc Set the window to full screen, the layout is not full screen 565 */ 566 it('testSetLayoutFullScreen_Parameter3_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 567 let msgStr = 'setLayoutFullScreen_Test_003'; 568 console.log(msgStr + ' begin'); 569 window.getTopWindow().then(wnd => { 570 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 571 expect(wnd != null).assertTrue(); 572 wnd.setFullScreen(true).then(() => { 573 wnd.getProperties().then((data) => { 574 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 575 expect(data.isFullScreen).assertTrue(); 576 wnd.setLayoutFullScreen(false).then(() => { 577 wnd.getProperties().then((data) => { 578 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 579 expect(data != null).assertTrue(); 580 expect(!data.isLayoutFullScreen).assertTrue(); 581 done(); 582 }, (err) => { 583 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 584 expect().assertFail(); 585 done(); 586 }) 587 }, (err) => { 588 console.log(msgStr + ' wnd.setLayoutFullScreen(false) failed, err : ' + JSON.stringify(err)); 589 expect().assertFail(); 590 done(); 591 }) 592 }, (err) => { 593 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 594 expect().assertFail(); 595 }) 596 }, (err) => { 597 console.log(msgStr + ' wnd.setFullScreen(true) failed, err : ' + JSON.stringify(err)); 598 expect().assertFail(); 599 done(); 600 }) 601 }, (err) => { 602 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 603 expect().assertFail(); 604 done(); 605 }) 606 }) 607 608 /** 609 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0910 610 * @tc.name testSetLayoutFullScreen_Parameter4_Callback 611 * @tc.desc Set the window to full screen, the layout is not full screen 612 */ 613 it('testSetLayoutFullScreen_Parameter4_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 614 let msgStr = 'setLayoutFullScreen_Test_004'; 615 console.log(msgStr + ' begin'); 616 window.getTopWindow().then(wnd => { 617 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 618 expect(wnd != null).assertTrue(); 619 wnd.setFullScreen(true, (err) => { 620 if (err.code != 0) { 621 console.log(msgStr + ' wnd.setFullScreen(true) callback fail' + JSON.stringify(err)); 622 expect().assertFail(); 623 done(); 624 } else { 625 wnd.getProperties((err, data) => { 626 if (err.code != 0) { 627 console.log(msgStr + ' wnd.getProperties callback fail' + JSON.stringify(err)); 628 expect().assertFail(); 629 done(); 630 } else { 631 expect(data.isFullScreen).assertTrue(); 632 wnd.setLayoutFullScreen(false, (err) => { 633 if (err.code != 0) { 634 console.log(msgStr + ' wnd.setLayoutFullScreen(false) callback fail' + JSON.stringify(err)); 635 expect().assertFail(); 636 done(); 637 } else { 638 wnd.getProperties((err, data) => { 639 if (err.code != 0) { 640 console.log(msgStr + ' wnd.getProperties callback fail' + JSON.stringify(err)); 641 expect().assertFail(); 642 done(); 643 } else { 644 console.log(msgStr + ' wnd.getProperties callback end'); 645 expect(!data.isLayoutFullScreen).assertTrue(); 646 done(); 647 } 648 }) 649 } 650 }) 651 } 652 }) 653 } 654 }) 655 }, (err) => { 656 console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err)); 657 expect().assertFail(); 658 done(); 659 }) 660 }) 661 662 /** 663 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0920 664 * @tc.name testSetLayoutFullScreen_Parameter5_Promise 665 * @tc.desc Set the window to be non-full-screen and the layout to be full-screen 666 */ 667 it('testSetLayoutFullScreen_Parameter5_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 668 let msgStr = 'setLayoutFullScreen_Test_005'; 669 console.log(msgStr + ' begin'); 670 window.getTopWindow().then(wnd => { 671 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 672 expect(wnd != null).assertTrue(); 673 wnd.setFullScreen(false).then(() => { 674 wnd.getProperties().then((data) => { 675 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 676 expect(data != null).assertTrue(); 677 expect(!data.isFullScreen).assertTrue(); 678 wnd.setLayoutFullScreen(true).then(() => { 679 wnd.getProperties().then((data) => { 680 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 681 expect(data.isLayoutFullScreen).assertTrue(); 682 done(); 683 }, (err) => { 684 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 685 expect().assertFail(); 686 done(); 687 }) 688 }, (err) => { 689 console.log(msgStr + ' wnd.setLayoutFullScreen(true) failed, err : ' + JSON.stringify(err)); 690 expect().assertFail(); 691 done(); 692 }) 693 }, (err) => { 694 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 695 expect().assertFail(); 696 done(); 697 }) 698 }, (err) => { 699 console.log(msgStr + ' wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err)); 700 expect().assertFail(); 701 done(); 702 }) 703 }, (err) => { 704 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 705 expect().assertFail(); 706 done(); 707 }) 708 }) 709 710 /** 711 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0930 712 * @tc.name testSetLayoutFullScreen_Parameter6_Callback 713 * @tc.desc Set the window to be non-full-screen and the layout to be full-screen. 714 */ 715 it('setLayoutFullScreen_Test_006', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 716 let msgStr = 'setLayoutFullScreen_Test_006'; 717 console.log(msgStr + ' begin'); 718 window.getTopWindow().then(wnd => { 719 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 720 expect(wnd != null).assertTrue(); 721 wnd.setFullScreen(false, (err) => { 722 if (err.code != 0) { 723 console.log(msgStr + ' wnd.setFullScreen fail' + JSON.stringify(err)); 724 expect().assertFail(); 725 done(); 726 } else { 727 wnd.getProperties((err, data) => { 728 if (err.code != 0) { 729 console.log(msgStr + ' wnd.getProperties fail' + JSON.stringify(err)); 730 expect().assertFail(); 731 done(); 732 } else { 733 expect(!data.isFullScreen).assertTrue(); 734 wnd.setLayoutFullScreen(true, (err) => { 735 if (err.code != 0) { 736 console.log(msgStr + ' wnd.setLayoutFullScreen fail' + JSON.stringify(err)); 737 expect().assertFail(); 738 done(); 739 } else { 740 wnd.getProperties((err, data) => { 741 if (err.code != 0) { 742 console.log(msgStr + ' wnd.getProperties fail' + JSON.stringify(err)); 743 expect().assertFail(); 744 done(); 745 } else { 746 expect(data.isLayoutFullScreen).assertTrue(); 747 done(); 748 } 749 }) 750 } 751 }) 752 } 753 }) 754 } 755 }) 756 }, (err) => { 757 console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err)); 758 expect().assertFail(); 759 done(); 760 }) 761 }) 762 763 /** 764 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0940 765 * @tc.name Test testSetLayoutFullScreen_Parameter7_Promise 766 * @tc.desc Setting windows and layouts to be non-fullscreen 767 */ 768 it('setLayoutFullScreen_Test_007', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 769 let msgStr = 'setLayoutFullScreen_Test_007'; 770 console.log(msgStr + ' begin'); 771 window.getTopWindow().then(wnd => { 772 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 773 expect(wnd != null).assertTrue(); 774 wnd.setFullScreen(false).then(() => { 775 wnd.getProperties().then((data) => { 776 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 777 expect(!data.isFullScreen).assertTrue(); 778 wnd.setLayoutFullScreen(false).then(() => { 779 wnd.getProperties().then((data) => { 780 console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data)); 781 expect(!data.isLayoutFullScreen).assertTrue(); 782 done(); 783 }, (err) => { 784 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 785 expect().assertFail(); 786 done(); 787 }) 788 }, (err) => { 789 console.log(msgStr + ' wnd.setLayoutFullScreen(false) failed, err : ' + JSON.stringify(err)); 790 expect().assertFail(); 791 done(); 792 }) 793 }, (err) => { 794 console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err)); 795 expect().assertFail(); 796 }) 797 }, (err) => { 798 console.log(msgStr + ' wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err)); 799 expect().assertFail(); 800 done(); 801 }) 802 }, (err) => { 803 console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err)); 804 expect().assertFail(); 805 done(); 806 }) 807 }) 808 809 /** 810 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0950 811 * @tc.name testSetLayoutFullScreen_Parameter8_Callback 812 * @tc.desc Setting window and layouts to be non-fullscreen. 813 */ 814 it('testSetLayoutFullScreen_Parameter8_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 815 let msgStr = 'setLayoutFullScreen_Test_008'; 816 console.log(msgStr + ' begin'); 817 window.getTopWindow().then(wnd => { 818 console.log(msgStr + ' window.getTopWindow wnd: ' + wnd); 819 expect(wnd != null).assertTrue(); 820 wnd.setFullScreen(false, (err) => { 821 if (err.code != 0) { 822 console.log(msgStr + ' window.setFullScreen callback fail' + JSON.stringify(err)); 823 expect().assertFail(); 824 done(); 825 } else { 826 wnd.getProperties((err, data) => { 827 if (err.code != 0) { 828 console.log(msgStr + ' window.getProperties callback fail' + JSON.stringify(err)); 829 expect().assertFail(); 830 done(); 831 } else { 832 expect(!data.isFullScreen).assertTrue(); 833 wnd.setLayoutFullScreen(false, (err) => { 834 if (err.code != 0) { 835 console.log(msgStr + ' window.setLayoutFullScreen callback fail' + JSON.stringify(err)); 836 expect().assertFail(); 837 done(); 838 } else { 839 wnd.getProperties((err, data) => { 840 if (err.code != 0) { 841 console.log(msgStr + ' window.getProperties callback fail' + JSON.stringify(err)); 842 expect().assertFail(); 843 done(); 844 } else { 845 expect(!data.isLayoutFullScreen).assertTrue(); 846 done(); 847 } 848 }) 849 } 850 }) 851 } 852 }) 853 } 854 }) 855 }, (err) => { 856 console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err)); 857 expect().assertFail(); 858 done(); 859 }) 860 }) 861 862 863 /** 864 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0090 865 * @tc.name testFindWindow_Main_Window_Promise 866 * @tc.desc Query main window 867 */ 868 it('testFindWindow_Main_Window_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { 869 let msgStr = 'find_Test_001'; 870 console.log(msgStr + ' begin'); 871 window.find('window0').then((data) => { 872 console.log(msgStr + ' wnd.find success, data : ' + JSON.stringify(data)); 873 expect(data != null).assertTrue(); 874 done(); 875 }, (err) => { 876 console.log(msgStr + ' wnd.find failed, err : ' + JSON.stringify(err)); 877 expect().assertFail(); 878 done(); 879 }) 880 }) 881 882 /** 883 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0110 884 * @tc.name testFindWindow_Non_Existing_Window_Promise 885 * @tc.desc Query for non-existing windows 886 */ 887 it('testFindWindow_Non_Existing_Window_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async function (done) { 888 let msgStr = 'find_Test_002'; 889 console.log(msgStr + ' begin'); 890 window.find('window').then((window) => { 891 console.log(msgStr + ' wnd.find success, window : ' + JSON.stringify(window)); 892 expect().assertFail(); 893 done(); 894 }, (err) => { 895 console.log(msgStr + ' wnd.find failed, err : ' + JSON.stringify(err)); 896 expect(TRUE_WINDOW).assertTrue(); 897 done(); 898 }) 899 }) 900 901 /** 902 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0080 903 * @tc.name testFindWindow_Main_Window_Callback 904 * @tc.desc Query main window. 905 */ 906 it('testFindWindow_Main_Window_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { 907 let msgStr = 'find_Test_003'; 908 console.log(msgStr + ' begin'); 909 window.find('window0', (err, data) => { 910 if (err.code) { 911 console.log(msgStr + ' wnd.find fail, err : ' + JSON.stringify(err)); 912 expect().assertFail(); 913 done(); 914 } else { 915 console.log(msgStr + ' wnd.find fail'); 916 expect(data != null).assertTrue(); 917 done(); 918 } 919 }) 920 }) 921 922 /** 923 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0100 924 * @tc.name testFindWindow_Non_Existing_Window_Callback 925 * @tc.desc Query for non-existing windows 926 */ 927 it('testFindWindow_Non_Existing_Window_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async function (done) { 928 let msgStr = 'find_Test_004'; 929 console.log(msgStr + ' begin'); 930 window.find('window', (err, data) => { 931 if (err.code) { 932 console.log(msgStr + ' wnd.find fail, err : ' + JSON.stringify(err)); 933 expect(TRUE_WINDOW).assertTrue(); 934 done(); 935 } else { 936 console.log(msgStr + ' wnd.find success'); 937 expect().assertFail(); 938 done(); 939 } 940 }) 941 }) 942 943 944 /** 945 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0410 946 * @tc.name testOnOff_SystemAvoidAreaChange_Callback 947 * @tc.desc To verify the function of enabling and disabling intercepting when the window size changes. 948 */ 949 it('testOnOff_SystemAvoidAreaChange_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 950 let msgStr = 'onOff_Test_001'; 951 console.log(msgStr + ' begin'); 952 display.getDefaultDisplay().then(dsp => { 953 window.getTopWindow((err, data) => { 954 if (err.code != 0) { 955 console.log(msgStr + ' getTopWindow fail ' + JSON.stringify(err.code)); 956 expect().assertFail(); 957 done(); 958 } else { 959 expect(data != null).assertTrue(); 960 data.on('windowSizeChange', windowSizeChangeCallback); 961 data.off('windowSizeChange'); 962 expect(true).assertTrue() 963 done() 964 } 965 }) 966 }, (err) => { 967 console.log(msgStr + ' getDefaultDisplay failed, err :' + JSON.stringify(err)); 968 expect().assertFail(); 969 done(); 970 }) 971 }) 972 973 /** 974 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0310 975 * @tc.name testIsShowing_Promise 976 * @tc.desc To verify the function of obtaining the display status when a window is hidden and then displayed. 977 */ 978 it('testIsShowing_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 979 let msgStr = 'isShowing_Test_001'; 980 console.log(msgStr + ' begin'); 981 window.create('subWindow1', window.WindowType.TYPE_APP).then(wnd => { 982 expect(wnd != null).assertTrue(); 983 console.log(msgStr + ' wnd.resetSize(400, 400) begin'); 984 wnd.resetSize(400, 400).then(() => { 985 console.log(msgStr + ' wnd.resetSize(400, 400) success'); 986 wnd.isShowing().then(res => { 987 console.log(msgStr + ' wnd.isShowing data:' + res); 988 expect(!res).assertTrue(); 989 wnd.show().then(() => { 990 wnd.isShowing().then(res => { 991 expect(res).assertTrue(); 992 wnd.destroy((err) => { 993 if (err.code) { 994 console.error(msgStr + ' Failed to destroy the window. err:' + JSON.stringify(err)); 995 return; 996 } 997 console.info('Succeeded in destroying the window.'); 998 }); 999 done(); 1000 }, (err) => { 1001 console.log(msgStr + ' wnd.isShowing failed, err :' + JSON.stringify(err)); 1002 expect().assertFail(); 1003 done(); 1004 }) 1005 }, (err) => { 1006 console.log(msgStr + ' wnd.show failed, err :' + JSON.stringify(err)); 1007 expect().assertFail(); 1008 done(); 1009 }) 1010 }, (err) => { 1011 console.log(msgStr + ' wnd.isShowing failed, err :' + JSON.stringify(err)); 1012 expect().assertFail(); 1013 done(); 1014 }) 1015 }, (err_resetSize) => { 1016 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize)); 1017 }) 1018 }) 1019 }) 1020 1021 /** 1022 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0300 1023 * @tc.name testIsShowing_Callback 1024 * @tc.desc To verify the function of obtaining the display status when a window is hidden and then displayed. 1025 */ 1026 it('testIsShowing_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1027 let msgStr = 'isShowing_Test_002'; 1028 console.log(msgStr + ' begin'); 1029 window.create('subWindow2', window.WindowType.TYPE_APP, (err, data) => { 1030 if (err.code) { 1031 console.log(msgStr + ' window.create fail err ' + JSON.stringify(err)); 1032 expect().assertFail(); 1033 done(); 1034 } else { 1035 expect(data != null).assertTrue(); 1036 data.resetSize(400, 400).then(() => { 1037 console.log(msgStr + ' wnd.resetSize(400, 400) success'); 1038 data.isShowing((err, res1) => { 1039 if (err.code) { 1040 console.log(msgStr + ' data.isShowing fail err ' + JSON.stringify(err)); 1041 expect().assertFail(); 1042 done(); 1043 } else { 1044 expect(!res1).assertTrue(); 1045 data.show(() => { 1046 if (err.code) { 1047 console.log(msgStr + ' data.show fail err ' + JSON.stringify(err)); 1048 expect().assertFail(); 1049 done(); 1050 } else { 1051 data.isShowing((err, res2) => { 1052 if (err.code) { 1053 console.log(msgStr + ' data.show fail err ' + JSON.stringify(err)); 1054 expect().assertFail(); 1055 done(); 1056 } else { 1057 expect(res2).assertTrue(); 1058 data.destroy().then(() => { 1059 console.info(msgStr + 'Succeeded in destroying the window.'); 1060 done(); 1061 }).catch((err) => { 1062 console.error(msgStr + 'Failed to destroy the window. err: ' + JSON.stringify(err)); 1063 }); 1064 } 1065 }) 1066 } 1067 }) 1068 } 1069 }) 1070 }, (err_resetSize) => { 1071 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize)); 1072 }) 1073 1074 } 1075 }) 1076 }) 1077 1078 /** 1079 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0710 1080 * @tc.name testSetColorSpace_IsSupportWideGamut_Wide_Gaumt_Promise 1081 * @tc.desc To verify the setting of the wide color gamut color space 1082 */ 1083 it('testSetColorSpace_IsSupportWideGamut_Wide_Gaumt_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1084 let msgStr = 'setColorSpace_Test_001'; 1085 console.log(msgStr + ' begin'); 1086 window.getTopWindow().then(wnd => { 1087 console.log(msgStr + ' wnd: ' + wnd); 1088 expect(wnd != null).assertTrue(); 1089 wnd.setColorSpace(window.ColorSpace.WIDE_GAMUT).then(() => { 1090 console.log(msgStr + ' setColorSpace WIDE_GAMUT'); 1091 wnd.getColorSpace().then(res => { 1092 expect(res == window.ColorSpace.WIDE_GAMUT).assertTrue(); 1093 console.log(msgStr + ' setColorSpace WIDE_GAMUT success'); 1094 wnd.isSupportWideGamut().then(data => { 1095 expect(data).assertTrue(); 1096 done(); 1097 }, (err) => { 1098 console.log(msgStr + ' wnd.isSupportWideGamut failed, err :' + JSON.stringify(err)); 1099 expect().assertFail(); 1100 done(); 1101 }) 1102 }, (err) => { 1103 console.log(msgStr + ' wnd.getColorSpace failed, err :' + JSON.stringify(err)); 1104 expect().assertFail(); 1105 done(); 1106 }) 1107 }, (err) => { 1108 console.log(msgStr + ' wnd.setColorSpace failed, err :' + JSON.stringify(err)); 1109 expect().assertFail(); 1110 done(); 1111 }) 1112 }, (err) => { 1113 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1114 expect().assertFail(); 1115 done(); 1116 }) 1117 }) 1118 1119 /** 1120 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0730 1121 * @tc.name testSetColorSpace_Parameter_Promise 1122 * @tc.desc To verify that the color space of invaild values is set successfully 1123 */ 1124 it('testSetColorSpace_Parameter_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1125 let msgStr = 'setColorSpace_Test_002'; 1126 console.log(msgStr + ' begin'); 1127 window.getTopWindow().then(wnd => { 1128 console.log(msgStr + ' wnd: ' + wnd); 1129 expect(wnd != null).assertTrue(); 1130 wnd.setColorSpace(-5).then(() => { 1131 console.log(msgStr + ' setColorSpace -5'); 1132 expect().assertFail(); 1133 done(); 1134 }, (err) => { 1135 console.log(msgStr + ' wnd.setColorSpace failed, err :' + JSON.stringify(err)); 1136 expect(err.code).assertEqual(1003); 1137 done(); 1138 }) 1139 }, (err) => { 1140 console.log(msgStr + ' wnd.getTopWindow failed, err :' + JSON.stringify(err)); 1141 expect().assertFail(); 1142 done(); 1143 }) 1144 }) 1145 1146 /** 1147 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0700 1148 * @tc.name testSetColorSpace_IsSupportWideGamut_Wide_Gaumt_Callback 1149 * @tc.desc To verify the setting of the wide color gamut color space 1150 */ 1151 it('testSetColorSpace_IsSupportWideGamut_Wide_Gaumt_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1152 let msgStr = 'setColorSpace_Test_003'; 1153 console.log(msgStr + ' begin'); 1154 window.getTopWindow().then(wnd => { 1155 console.log(msgStr + ' wnd: ' + wnd); 1156 expect(wnd != null).assertTrue(); 1157 wnd.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err) => { 1158 if (err.code != 0) { 1159 console.log(msgStr + ' setColorSpace fail' + JSON.stringify(err)); 1160 expect().assertFail(); 1161 done(); 1162 } else { 1163 wnd.getColorSpace((err, data) => { 1164 if (err.code != 0) { 1165 console.log(msgStr + ' getColorSpace fail ' + JSON.stringify(err)); 1166 expect().assertFail(); 1167 done(); 1168 } else { 1169 expect(data == window.ColorSpace.WIDE_GAMUT).assertTrue(); 1170 wnd.isSupportWideGamut((err, data) => { 1171 if (err.code != 0) { 1172 console.log(msgStr + ' getColorSpace callback fail' + JSON.stringify(err)); 1173 expect().assertFail(); 1174 done(); 1175 } else { 1176 expect(data).assertTrue(); 1177 done(); 1178 } 1179 }) 1180 } 1181 }) 1182 } 1183 }) 1184 }, (err) => { 1185 console.log(msgStr + ' getTopWindow failed,err: ' + JSON.stringify(err)); 1186 expect().assertFail(); 1187 done(); 1188 }) 1189 }) 1190 1191 /** 1192 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0720 1193 * @tc.name testSetColorSpace_Parameter_Callback 1194 * @tc.desc To verify that the color space of invalid values is set successfully 1195 */ 1196 it('testSetColorSpace_Parameter_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1197 let msgStr = 'setColorSpace_Test_004'; 1198 console.log(msgStr + ' begin'); 1199 window.getTopWindow().then(wnd => { 1200 console.log(msgStr + ' wnd: ' + wnd); 1201 expect(wnd != null).assertTrue(); 1202 wnd.setColorSpace(-5, (err) => { 1203 console.log(msgStr + ' setColorSpace callback begin' + JSON.stringify(err)); 1204 if (err.code != 0) { 1205 console.log(msgStr + ' setColorSpace callback fail' + JSON.stringify(err.code)); 1206 expect(err.code).assertEqual(1003); 1207 done(); 1208 } else { 1209 expect().assertFail(); 1210 done(); 1211 } 1212 }) 1213 }, (err) => { 1214 console.log(msgStr + ' getTopWindow failed,err: ' + JSON.stringify(err)); 1215 expect().assertFail(); 1216 done(); 1217 }) 1218 }) 1219 1220 /** 1221 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0020 1222 * @tc.name testCreateWindow_Promise 1223 * @tc.desc To verify the function of creating an application subwindow. 1224 */ 1225 it('testCreateWindow_Promise',TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1226 let msgStr = 'create_Test_001'; 1227 console.log(msgStr + ' begin'); 1228 window.create('subWindow3', window.WindowType.TYPE_APP).then(wnd => { 1229 console.log(msgStr + ' create success wnd' + wnd); 1230 expect(wnd != null).assertTrue(); 1231 wnd.resetSize(400, 400).then(() => { 1232 console.log(msgStr + ' wnd.resetSize(400, 400) success'); 1233 wnd.destroy().then(() => { 1234 console.info(msgStr + 'Succeeded in destroying the window.'); 1235 done(); 1236 }).catch((err) => { 1237 console.error(msgStr + 'Failed to destroy the window. err: ' + JSON.stringify(err)); 1238 }); 1239 }, (err_resetSize) => { 1240 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize)); 1241 }) 1242 1243 }, (err) => { 1244 console.log(msgStr + ' create failed, err :' + JSON.stringify(err)); 1245 expect().assertFail(); 1246 done(); 1247 }) 1248 }) 1249 1250 /** 1251 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0010 1252 * @tc.name testCreateWindow_Callback 1253 * @tc.desc To verify the function of creating an application subwindow 1254 */ 1255 it('testCreateWindow_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1256 let msgStr = 'create_Test_002'; 1257 console.log(msgStr + ' begin'); 1258 window.create('subWindow4', window.WindowType.TYPE_APP, (err, data) => { 1259 if (err.code != 0) { 1260 console.log(msgStr + ' create callback fail' + JSON.stringify(err.code)); 1261 expect().assertFail(); 1262 done(); 1263 } else { 1264 expect(data != null).assertTrue(); 1265 console.log(msgStr + ' callback create success data' + data); 1266 data.resetSize(400, 400).then(() => { 1267 console.log(msgStr + ' wnd.resetSize(400, 400) success'); 1268 data.destroy().then(() => { 1269 console.info(msgStr + 'Succeeded in destroying the window.'); 1270 done(); 1271 }).catch((err) => { 1272 console.error(msgStr + 'Failed to destroy the window. err: ' + JSON.stringify(err)); 1273 }); 1274 }, (err_resetSize) => { 1275 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize)); 1276 }) 1277 } 1278 }) 1279 }) 1280 1281 /** 1282 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0050 1283 * @tc.name testDestroyWiondow_Promise 1284 * @tc.desc Verify that a window is destroyed after being created 1285 */ 1286 it('testDestroyWiondow_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1287 let msgStr = 'destroy_Test_001'; 1288 console.log(msgStr + ' begin'); 1289 window.create('subWindow5', window.WindowType.TYPE_APP).then(wnd => { 1290 console.log(msgStr + ' create success wnd' + wnd); 1291 expect(wnd != null).assertTrue(); 1292 wnd.resetSize(400, 400).then(() => { 1293 console.log(msgStr + ' wnd.resetSize(400, 400) success'); 1294 wnd.destroy().then(() => { 1295 window.find('subWindow5').then((data) => { 1296 console.log(msgStr + ' window.find success, window :' + JSON.stringify(data)); 1297 expect().assertFail(); 1298 done(); 1299 }, (err) => { 1300 console.log(msgStr + ' find failed, err :' + JSON.stringify(err)); 1301 expect(err.code).assertEqual(1001); 1302 done(); 1303 }) 1304 }, (err) => { 1305 console.log(msgStr + ' destroy failed, err :' + JSON.stringify(err)); 1306 expect().assertFail(); 1307 done(); 1308 }) 1309 }, (err_resetSize) => { 1310 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize)); 1311 }) 1312 1313 }, (err) => { 1314 console.log(msgStr + ' create failed, err :' + JSON.stringify(err)); 1315 expect().assertFail(); 1316 done(); 1317 }) 1318 }) 1319 /** 1320 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0040 1321 * @tc.name testDestroyWiondow_Callback 1322 * @tc.desc Verify that a window is destroyed after being created 1323 */ 1324 it('testDestroyWiondow_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1325 let msgStr = 'destroy_Test_002'; 1326 console.log(msgStr + ' begin'); 1327 window.create('subWindow6', window.WindowType.TYPE_APP, (err, data) => { 1328 if (err.code != 0) { 1329 console.log(msgStr + ' create callback fail' + JSON.stringify(err.code)); 1330 expect().assertFail(); 1331 done(); 1332 } else { 1333 expect(data != null).assertTrue(); 1334 data.resetSize(400, 400).then(() => { 1335 console.log(msgStr + ' wnd.resetSize(400, 400) success'); 1336 data.destroy((err) => { 1337 if (err.code != 0) { 1338 console.log(msgStr + ' create callback fail' + JSON.stringify(err)); 1339 expect().assertFail(); 1340 done(); 1341 } else { 1342 window.find('subWindow6', (err, data) => { 1343 console.log(msgStr + ' find callback begin' + JSON.stringify(data)); 1344 if (err.code != 0) { 1345 console.log(msgStr + ' find callback fail' + JSON.stringify(err.code)); 1346 expect(err.code).assertEqual(1001); 1347 done(); 1348 } else { 1349 console.log(msgStr + ' find suceess,err : ' + JSON.stringify(err)); 1350 expect().assertFail(); 1351 done(); 1352 } 1353 }) 1354 } 1355 }) 1356 }, (err_resetSize) => { 1357 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize)); 1358 }) 1359 1360 } 1361 }) 1362 }) 1363 1364 /** 1365 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1000 1366 * @tc.name testSetSystemBarEnable_Parameter1_Promise 1367 * @tc.desc To verify the function of setting a scenario that is visible to the system bar 1368 */ 1369 it('setSystemBarEnable_Test_001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1370 let msgStr = 'setSystemBarEnable_Test_001'; 1371 console.log(msgStr + ' begin'); 1372 var names = ["status", "navigation"]; 1373 window.getTopWindow().then(wnd => { 1374 expect(wnd != null).assertTrue(); 1375 wnd.setLayoutFullScreen(true).then(() => { 1376 wnd.setSystemBarEnable(names).then(() => { 1377 console.log(msgStr + ' setSystemBarEnable success'); 1378 expect(TRUE_WINDOW).assertTrue(); 1379 done(); 1380 }, (err) => { 1381 console.log(msgStr + ' setSystemBarEnable failed, err :' + JSON.stringify(err)); 1382 expect().assertFail(); 1383 done(); 1384 }) 1385 }, (err) => { 1386 console.log(msgStr + ' setLayoutFullScreen failed, err :' + JSON.stringify(err)); 1387 expect().assertFail(); 1388 done(); 1389 }) 1390 }, (err) => { 1391 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1392 expect().assertFail(); 1393 done(); 1394 }) 1395 }) 1396 1397 1398 /** 1399 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1010 1400 * @tc.name testSetSystemBarEnable_Parameter2_Callback 1401 * @tc.desc To verify the function of setting a scenario that is visible to the system bar 1402 */ 1403 it('testSetSystemBarEnable_Parameter2_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1404 let msgStr = 'setSystemBarEnable_Test_002'; 1405 console.log(msgStr + ' begin'); 1406 var names = ["status", "navigation"]; 1407 window.getTopWindow((err, data) => { 1408 if (err.code != 0) { 1409 console.log(msgStr + ' getTopWindow fail: ' + JSON.stringify(err)); 1410 expect().assertFail(); 1411 done(); 1412 } else { 1413 expect(data != null).assertTrue(); 1414 data.setSystemBarEnable(names, (err) => { 1415 if (err.code != 0) { 1416 console.log(msgStr + ' getTopWindow fail' + JSON.stringify(err)); 1417 expect().assertFail(); 1418 done(); 1419 } else { 1420 console.log(msgStr + ' setSystemBarEnable success'); 1421 expect(TRUE_WINDOW).assertTrue(); 1422 done(); 1423 } 1424 }) 1425 } 1426 }) 1427 }) 1428 1429 /** 1430 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1020 1431 * @tc.name testSetSystemBarProperties_Parameter1_Promise 1432 * @tc.desc To verify the function of setting system bar attributes 1433 */ 1434 it('testSetSystemBarProperties_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1435 let msgStr = 'setSystemBarProperties_Test_001'; 1436 console.log(msgStr + ' begin'); 1437 var SystemBarProperties = { 1438 statusBarColor: '#ff00ff', 1439 navigationBarColor: '#00ff00', 1440 isStatusBarLightIcon: true, 1441 isNavigationBarLightIcon: false, 1442 statusBarContentColor: '#ffffff', 1443 navigationBarContentColor: '#00ffff' 1444 }; 1445 window.getTopWindow().then(wnd => { 1446 expect(wnd != null).assertTrue(); 1447 wnd.setSystemBarProperties(SystemBarProperties).then(() => { 1448 console.log(msgStr + ' setSystemBarProperties success '); 1449 expect(TRUE_WINDOW).assertTrue(); 1450 done(); 1451 }, (err) => { 1452 console.log(msgStr + ' setSystemBarProperties failed, err :' + JSON.stringify(err)); 1453 expect().assertFail(); 1454 done(); 1455 }) 1456 }, (err) => { 1457 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1458 expect().assertFail(); 1459 done(); 1460 }) 1461 }) 1462 1463 1464 /** 1465 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_002 1466 * @tc.name testSetSystemBarProperties_Parameter2_Callback 1467 * @tc.desc To verify the function of setting system bar attributes 1468 */ 1469 it('testSetSystemBarProperties_Parameter2_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1470 let msgStr = 'setSystemBarProperties_Test_002'; 1471 console.log(msgStr + ' begin'); 1472 var SystemBarProperties = { 1473 statusBarColor: '#ff00ff', 1474 navigationBarColor: '#00ff00', 1475 isStatusBarLightIcon: true, 1476 isNavigationBarLightIcon: false, 1477 statusBarContentColor: '#ffffff', 1478 navigationBarContentColor: '#00ffff' 1479 }; 1480 window.getTopWindow((err, data) => { 1481 if (err.code != 0) { 1482 console.log(msgStr + ' getTopWindow fail: ' + JSON.stringify(err)); 1483 expect().assertFail(); 1484 done(); 1485 } else { 1486 expect(data != null).assertTrue(); 1487 data.setSystemBarProperties(SystemBarProperties, (err) => { 1488 if (err.code != 0) { 1489 console.log(msgStr + ' setSystemBarProperties fail' + JSON.stringify(err)); 1490 expect().assertFail(); 1491 done(); 1492 } else { 1493 expect(TRUE_WINDOW).assertTrue(); 1494 done(); 1495 } 1496 }) 1497 } 1498 }) 1499 }) 1500 1501 1502 /** 1503 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0330 1504 * @tc.name testMoveTo_Parameter1_Callback 1505 * @tc.desc Verify the scene where the window moves 1506 */ 1507 it('testMoveTo_Parameter1_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { 1508 let msgStr = 'move_Test_001'; 1509 console.log(msgStr + ' begin'); 1510 window.getTopWindow().then(wnd => { 1511 console.log(msgStr + ' getTopWindow wnd' + wnd); 1512 expect(wnd != null).assertTrue(); 1513 wnd.moveTo(200, 200, (err) => { 1514 if (err.code) { 1515 console.log(msgStr + ' moveTo callback fail' + JSON.stringify(err.code)); 1516 expect(err.code).assertEqual(6); 1517 done(); 1518 } else { 1519 console.log(msgStr + ' moveTo callback success'); 1520 expect(TRUE_WINDOW).assertTrue(); 1521 done(); 1522 } 1523 }) 1524 }) 1525 }) 1526 /** 1527 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0340 1528 * @tc.name testMoveTo_Parameter2_Promise 1529 * @tc.desc Verify the scene where the window moves 1530 */ 1531 it('testMoveTo_Parameter2_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 1532 let msgStr = 'move_Test_002'; 1533 console.log(msgStr + ' begin'); 1534 window.getTopWindow().then(wnd => { 1535 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1536 expect(wnd != null).assertTrue(); 1537 wnd.moveTo(100, 100).then(() => { 1538 console.log(msgStr + ' wnd.moveTo success'); 1539 expect(TRUE_WINDOW).assertTrue(); 1540 done(); 1541 }, (err) => { 1542 console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err)); 1543 expect(err.code).assertEqual(6); 1544 done(); 1545 }) 1546 }, (err) => { 1547 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1548 expect().assertFail(); 1549 done(); 1550 }) 1551 }) 1552 1553 /** 1554 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0350 1555 * @tc.name testMoveTo_Parameter3_Promise 1556 * @tc.desc Verify the scene where the window moves 1557 */ 1558 it('testMoveTo_Parameter3_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 1559 let msgStr = 'move_Test_003'; 1560 console.log(msgStr + ' begin'); 1561 window.getTopWindow().then(wnd => { 1562 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1563 expect(wnd != null).assertTrue(); 1564 wnd.moveTo(20000, 20000).then(() => { 1565 console.log(msgStr + ' wnd.moveTo success'); 1566 expect(TRUE_WINDOW).assertTrue(); 1567 done(); 1568 }, (err) => { 1569 console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err)); 1570 expect(err.code).assertEqual(6); 1571 done(); 1572 }) 1573 }, (err) => { 1574 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1575 expect().assertFail(); 1576 done(); 1577 }) 1578 }) 1579 1580 /** 1581 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0360 1582 * @tc.name testMoveTo_Parameter4_Promise 1583 * @tc.desc Verify the scene where the window moves 1584 */ 1585 it('testMoveTo_Parameter4_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 1586 let msgStr = 'move_Test_004'; 1587 console.log(msgStr + ' begin'); 1588 window.getTopWindow().then(wnd => { 1589 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1590 expect(wnd != null).assertTrue(); 1591 wnd.moveTo(-200, -200).then(() => { 1592 console.log(msgStr + ' wnd.moveTo success'); 1593 expect(TRUE_WINDOW).assertTrue(); 1594 done(); 1595 }, (err) => { 1596 console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err)); 1597 expect(err.code).assertEqual(6); 1598 done(); 1599 }) 1600 }, (err) => { 1601 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1602 expect().assertFail(); 1603 done(); 1604 }) 1605 }) 1606 1607 /** 1608 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0370 1609 * @tc.name testMoveTo_Parameter5_Promise 1610 * @tc.desc Verify that the window is moved into the normal scene 1611 */ 1612 it('testMoveTo_Parameter5_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 1613 let msgStr = 'move_Test_005'; 1614 console.log(msgStr + ' begin'); 1615 window.getTopWindow().then(wnd => { 1616 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1617 expect(wnd != null).assertTrue(); 1618 for (var i = 1; i <= 5; i++) { 1619 wnd.moveTo(100, 100).then(() => { 1620 expect(TRUE_WINDOW).assertTrue(); 1621 done(); 1622 }, (err) => { 1623 console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err)); 1624 expect(err.code).assertEqual(6); 1625 done(); 1626 }) 1627 } 1628 }, (err) => { 1629 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1630 expect().assertFail(); 1631 done(); 1632 }) 1633 }) 1634 1635 /** 1636 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0380 1637 * @tc.name testMoveTo_Parameter6_Callback 1638 * @tc.desc Verify the scene where the window moves 1639 */ 1640 it('testMoveTo_Parameter6_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 1641 let msgStr = 'move_Test_006'; 1642 console.log(msgStr + ' begin'); 1643 window.getTopWindow().then(wnd => { 1644 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1645 expect(wnd != null).assertTrue(); 1646 wnd.moveTo(-200, -200, (err) => { 1647 if (err.code) { 1648 console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err)); 1649 expect(err.code).assertEqual(6); 1650 done(); 1651 } else { 1652 console.log(msgStr + ' wnd.moveTo success'); 1653 expect(TRUE_WINDOW).assertTrue(); 1654 done(); 1655 } 1656 }) 1657 }, (err) => { 1658 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1659 expect().assertFail(); 1660 done(); 1661 }) 1662 }) 1663 1664 /** 1665 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0390 1666 * @tc.name testMove_Test_007 1667 * @tc.desc Verify the scene where the window moves 1668 */ 1669 it('testMove_Test_007', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 1670 let msgStr = 'move_Test_007'; 1671 console.log(msgStr + ' begin'); 1672 window.getTopWindow().then(wnd => { 1673 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1674 expect(wnd != null).assertTrue(); 1675 wnd.moveTo(-200, -200).then(() => { 1676 console.log(msgStr + 'moveTo(-200,-200) success'); 1677 expect(TRUE_WINDOW).assertTrue(); 1678 done(); 1679 }, (err) => { 1680 console.log(msgStr + ' moveTo failed, err :' + JSON.stringify(err)); 1681 expect(err.code).assertEqual(6); 1682 done(); 1683 }) 1684 }, (err) => { 1685 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1686 expect().assertFail(); 1687 done(); 1688 }) 1689 }) 1690 1691 /** 1692 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0320 1693 * @tc.name testMoveTo_Multi_Parameter1_Promise 1694 * @tc.desc Verify the scene where the window moves 1695 */ 1696 it('testMoveTo_Multi_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1697 let msgStr = 'move_Test_008'; 1698 console.log(msgStr + ' begin'); 1699 window.getTopWindow().then(wnd => { 1700 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1701 expect(wnd != null).assertTrue(); 1702 wnd.moveTo(-200, 200).then(() => { 1703 wnd.moveTo(200, -300).then(() => { 1704 expect(TRUE_WINDOW).assertTrue(); 1705 done(); 1706 }, (err) => { 1707 console.log(msgStr + ' create failed, err :' + JSON.stringify(err)); 1708 expect(err.code).assertEqual(6); 1709 done(); 1710 }) 1711 }, (err) => { 1712 console.log(msgStr + ' create failed, err :' + JSON.stringify(err)); 1713 expect(err.code).assertEqual(6); 1714 done(); 1715 }) 1716 }, (err) => { 1717 console.log(msgStr + ' create failed, err :' + JSON.stringify(err)); 1718 expect().assertFail(); 1719 done(); 1720 }) 1721 }) 1722 1723 /** 1724 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0420 1725 * @tc.name testResetSize_Parameter1_Promise 1726 * @tc.desc Verify the scene where the window resets size 1727 */ 1728 it('testResetSize_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1729 let msgStr = 'resetSize_Test_001'; 1730 console.log(msgStr + ' begin'); 1731 window.getTopWindow().then(wnd => { 1732 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1733 expect(wnd != null).assertTrue(); 1734 wnd.resetSize(200, 600).then(() => { 1735 console.log(msgStr + ' wnd.resetSize(200, 600) success'); 1736 expect(TRUE_WINDOW).assertTrue(); 1737 done(); 1738 }, (err) => { 1739 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err)); 1740 expect(err.code).assertEqual(6); 1741 done(); 1742 }) 1743 }, (err) => { 1744 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1745 expect().assertFail(); 1746 done(); 1747 }) 1748 }) 1749 1750 /** 1751 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0430 1752 * @tc.name testResetSize_Parameter2_Promise 1753 * @tc.desc Verify the scene where the window resets size 1754 */ 1755 it('testResetSize_Parameter2_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1756 let msgStr = 'resetSize_Test_002'; 1757 console.log(msgStr + ' begin'); 1758 window.getTopWindow().then(wnd => { 1759 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1760 expect(wnd != null).assertTrue(); 1761 wnd.resetSize(20000, 20000).then(() => { 1762 console.log(msgStr + ' wnd.resetSize(20000, 20000) success'); 1763 expect(TRUE_WINDOW).assertTrue(); 1764 done(); 1765 }, (err) => { 1766 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err)); 1767 expect(err.code).assertEqual(6); 1768 done(); 1769 }) 1770 }, (err) => { 1771 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1772 expect().assertFail(); 1773 done(); 1774 }) 1775 }) 1776 1777 /** 1778 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0440 1779 * @tc.name testResetSize_Parameter3_Promise 1780 * @tc.desc Verify the scene where the window resets size 1781 */ 1782 it('testResetSize_Parameter3_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1783 let msgStr = 'resetSize_Test_003'; 1784 console.log(msgStr + ' begin'); 1785 window.getTopWindow().then(wnd => { 1786 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1787 expect(wnd != null).assertTrue(); 1788 wnd.resetSize(0, 0).then(() => { 1789 console.log(msgStr + ' wnd.resetSize(0, 0) success'); 1790 expect(TRUE_WINDOW).assertTrue(); 1791 done(); 1792 }, (err) => { 1793 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err)); 1794 expect(err.code).assertEqual(1003); 1795 done(); 1796 }) 1797 }, (err) => { 1798 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1799 expect().assertFail(); 1800 done(); 1801 }) 1802 }) 1803 1804 /** 1805 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0450 1806 * @tc.name testResetSize_Parameter4_Promise 1807 * @tc.desc Verify the scene where the window resets size 1808 */ 1809 it('testResetSize_Parameter4_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1810 let msgStr = 'resetSize_Test_004'; 1811 console.log(msgStr + ' begin'); 1812 window.getTopWindow().then(wnd => { 1813 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1814 expect(wnd != null).assertTrue(); 1815 wnd.resetSize(-1, -1).then(() => { 1816 console.log(msgStr + ' wnd.resetSize(-1, -1) success'); 1817 expect(TRUE_WINDOW).assertTrue(); 1818 done(); 1819 }, (err) => { 1820 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err)); 1821 expect(err.code).assertEqual(1003); 1822 done(); 1823 }) 1824 }, (err) => { 1825 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1826 expect().assertFail(); 1827 done(); 1828 }) 1829 }) 1830 1831 /** 1832 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0470 1833 * @tc.name testResetSize_Repeat_5_Times_Parameter5_Promise 1834 * @tc.desc Verify the scene where the window resets size 1835 */ 1836 it('testResetSize_Repeat_5_Times_Parameter5_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1837 let msgStr = 'resetSize_Test_005'; 1838 console.log(msgStr + ' begin'); 1839 window.getTopWindow().then(wnd => { 1840 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1841 expect(wnd != null).assertTrue(); 1842 for (var i = 1; i <= 5; i++) { 1843 wnd.resetSize(100, 100).then(() => { 1844 console.log(msgStr + ' wnd.resetSize(100, 100) success, count:"%d\n"', i); 1845 expect(TRUE_WINDOW).assertTrue(); 1846 done(); 1847 }, (err) => { 1848 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err)); 1849 expect(err.code).assertEqual(6); 1850 done(); 1851 }) 1852 } 1853 }, (err) => { 1854 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1855 expect().assertFail(); 1856 done(); 1857 }) 1858 }) 1859 1860 /** 1861 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0460 1862 * @tc.name testResetSize_Parameter6_Callback 1863 * @tc.desc Verify the scene where the window resets size 1864 */ 1865 it('testResetSize_Parameter6_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { 1866 let msgStr = 'resetSize_Test_006'; 1867 console.log(msgStr + ' begin'); 1868 window.getTopWindow().then(wnd => { 1869 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1870 expect(wnd != null).assertTrue(); 1871 wnd.resetSize(200, 200, (err) => { 1872 if (err.code) { 1873 console.log(msgStr + ' resetSize callback fail' + JSON.stringify(err.code)); 1874 expect(err.code).assertEqual(6); 1875 done(); 1876 } else { 1877 console.log(msgStr + ' resetSize callback success'); 1878 expect(TRUE_WINDOW).assertTrue(); 1879 done(); 1880 } 1881 }) 1882 }) 1883 }) 1884 1885 /** 1886 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0480 1887 * @tc.name testResetSize_Repeat_5_Times_Parameter7_Promise 1888 * @tc.desc Verify the scene where the window resets size 1889 */ 1890 it('testResetSize_Repeat_5_Times_Parameter7_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1891 var width = 100; 1892 var height = 100; 1893 let msgStr = 'resetSize_Test_007'; 1894 console.log(msgStr + ' begin'); 1895 window.getTopWindow().then(wnd => { 1896 console.log(msgStr + ' getTopWindow wnd: ' + wnd); 1897 expect(wnd != null).assertTrue(); 1898 for (let i = 1; i <= 5; i++) { 1899 width = width * i; 1900 height = height * i; 1901 wnd.resetSize(width, height).then(() => { 1902 console.log(msgStr + ' resetSizeTestLoop success'); 1903 expect(TRUE_WINDOW).assertTrue(); 1904 done(); 1905 }, (err) => { 1906 console.log(msgStr + ' resetSizeLoop resetSize failed, err :' + JSON.stringify(err)); 1907 expect(err.code).assertEqual(6); 1908 done(); 1909 }) 1910 } 1911 }, (err) => { 1912 console.log(msgStr + ' resetSizeLoop getTopWindow failed, err :' + JSON.stringify(err)); 1913 expect().assertFail(); 1914 done(); 1915 }) 1916 }) 1917 1918 /** 1919 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0290 1920 * @tc.name testGetTopWindow_Promise 1921 * @tc.desc Verify the scene that gets the top window 1922 */ 1923 it('testGetTopWindow_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { 1924 let msgStr = 'getTopWindow_Test_001'; 1925 console.log(msgStr + ' begin'); 1926 window.getTopWindow().then(wnd => { 1927 console.log(msgStr + ' wnd: ' + wnd); 1928 expect(wnd != null).assertTrue(); 1929 done(); 1930 }, (err) => { 1931 console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err)); 1932 expect().assertFail(); 1933 done(); 1934 }) 1935 }) 1936 1937 /** 1938 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1110 1939 * @tc.name testWindowStageEventType_Enum_Value 1940 * @tc.desc To test the enum value of WindowStageEventType. 1941 */ 1942 it('testWindowStageEventType_Enum_Value', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { 1943 let msgStr = 'enumWindowStageEventType_Test_001'; 1944 console.log(msgStr + ' begin'); 1945 try { 1946 expect(1).assertEqual(window.WindowStageEventType.SHOWN); 1947 expect(2).assertEqual(window.WindowStageEventType.ACTIVE); 1948 expect(3).assertEqual(window.WindowStageEventType.INACTIVE); 1949 expect(4).assertEqual(window.WindowStageEventType.HIDDEN); 1950 expect(5).assertEqual(window.WindowStageEventType.RESUMED); 1951 expect(6).assertEqual(window.WindowStageEventType.PAUSED); 1952 done(); 1953 } catch (err) { 1954 console.log(msgStr + ' error ' + JSON.stringify(err)); 1955 } 1956 }) 1957 1958 /** 1959 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1080 1960 * @tc.name testWindowColorSpace_Enum_Value 1961 * @tc.desc To test the enum value of WindowCOLORSPACE. 1962 */ 1963 it('testWindowColorSpace_Enum_Value', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { 1964 let msgStr = 'enumWindowCOLORSPACE_Test_001'; 1965 console.log(msgStr + ' begin'); 1966 try { 1967 expect(0).assertEqual(window.ColorSpace.DEFAULT); 1968 expect(1).assertEqual(window.ColorSpace.WIDE_GAMUT); 1969 done(); 1970 } catch (err) { 1971 console.log(msgStr + ' colorspace error ' + JSON.stringify(err)); 1972 } 1973 }) 1974 1975 /** 1976 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1120 1977 * @tc.name testWindowType_Enum_Value 1978 * @tc.desc To test the enum value of WindowType. 1979 */ 1980 it('testWindowType_Enum_Value', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { 1981 let msgStr = 'enumWindowType_Test_001'; 1982 console.log(msgStr + ' begin'); 1983 try { 1984 expect(0).assertEqual(window.WindowType.TYPE_APP); 1985 done(); 1986 } catch (err) { 1987 console.log(msgStr + ' WindowType error ' + JSON.stringify(err)); 1988 } 1989 }) 1990 1991 /** 1992 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1100 1993 * @tc.name testWindowProperties_Enum_Value 1994 * @tc.desc To test the enum value of WindowProperties. 1995 */ 1996 it('testWindowProperties_Enum_Value', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 1997 let msgStr = 'enumWindowProperties_Test_001'; 1998 console.log(msgStr + ' begin'); 1999 try { 2000 var windowP = { 2001 windowRect: { 2002 left: 20, 2003 top: 20, 2004 width: 20, 2005 height: 20 2006 }, 2007 drawableRect: { 2008 left: 20, 2009 top: 20, 2010 width: 20, 2011 height: 20 2012 }, 2013 type: 0, 2014 isFullScreen: false, 2015 isLayoutFullScreen: false, 2016 focusable: false, 2017 touchable: false, 2018 brightness: 0.5, 2019 dimBehindValue: 3, 2020 isKeepScreenOn: false, 2021 isPrivacyMode: false, 2022 isRoundCorner: false, 2023 isTransparent: false 2024 } 2025 expect(20).assertEqual(windowP.windowRect.left); 2026 expect(20).assertEqual(windowP.windowRect.top); 2027 expect(20).assertEqual(windowP.windowRect.width); 2028 expect(20).assertEqual(windowP.windowRect.height); 2029 expect(20).assertEqual(windowP.drawableRect.left); 2030 expect(20).assertEqual(windowP.drawableRect.top); 2031 expect(20).assertEqual(windowP.drawableRect.width); 2032 expect(20).assertEqual(windowP.drawableRect.height); 2033 expect(0).assertEqual(windowP.type); 2034 expect(!windowP.isFullScreen).assertTrue(); 2035 expect(!windowP.isLayoutFullScreen).assertTrue(); 2036 expect(!windowP.focusable).assertTrue(); 2037 expect(!windowP.touchable).assertTrue(); 2038 expect(0.5).assertEqual(windowP.brightness); 2039 expect(3).assertEqual(windowP.dimBehindValue); 2040 expect(!windowP.isKeepScreenOn).assertTrue(); 2041 expect(!windowP.isPrivacyMode).assertTrue(); 2042 expect(!windowP.isRoundCorner).assertTrue(); 2043 expect(!windowP.isTransparent).assertTrue(); 2044 done(); 2045 } catch (err) { 2046 console.error(msgStr + ' windowproperties error ' + JSON.stringify(err)); 2047 expect.assertFail(); 2048 done(); 2049 } 2050 }) 2051 2052 /** 2053 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0770 2054 * @tc.name testSetFocusable_Parameter1_Promise 2055 * @tc.desc Setting window focus acquisition and defocus 2056 */ 2057 it('testSetFocusable_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2058 let msgStr = 'setFocusable_Test_001'; 2059 console.log(msgStr + ' begin'); 2060 window.getTopWindow().then(wnd => { 2061 console.log(msgStr + ' getTopWindow wnd' + wnd); 2062 expect(wnd != null).assertTrue(); 2063 wnd.getProperties().then(data => { 2064 expect(data.focusable).assertTrue(); 2065 wnd.setFocusable(false).then(() => { 2066 console.log(msgStr + ' setFocusable(false) success '); 2067 wnd.getProperties().then(data => { 2068 expect(!data.focusable).assertTrue(); 2069 wnd.setFocusable(true).then(() => { 2070 console.log(msgStr + ' setFocusable(true) success '); 2071 expect(TRUE_WINDOW).assertTrue(); 2072 done(); 2073 }) 2074 }, (err) => { 2075 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2076 expect().assertFail(); 2077 done(); 2078 }) 2079 }, (err) => { 2080 console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err)); 2081 expect().assertFail(); 2082 done(); 2083 }) 2084 }, (err) => { 2085 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2086 expect().assertFail(); 2087 done(); 2088 }) 2089 }, (err) => { 2090 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2091 expect().assertFail(); 2092 done(); 2093 }) 2094 }) 2095 2096 /** 2097 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0780 2098 * @tc.name testSetFocusable_Parameter2_Promise 2099 * @tc.desc The setting window loses focus and cannot be touched 2100 */ 2101 it('testSetFocusable_Parameter2_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 2102 let msgStr = 'setFocusable_Test_002'; 2103 console.log(msgStr + ' begin'); 2104 window.getTopWindow().then(wnd => { 2105 console.log(msgStr + ' getTopWindow wnd' + wnd); 2106 expect(wnd != null).assertTrue(); 2107 wnd.setFocusable(false).then(() => { 2108 console.log(msgStr + ' setFocusable(false) success '); 2109 wnd.getProperties().then(data => { 2110 expect(!data.focusable).assertTrue(); 2111 wnd.setTouchable(false).then(() => { 2112 console.log(msgStr + ' setTouchable(false) success '); 2113 wnd.getProperties().then(data => { 2114 expect(!data.touchable).assertTrue(); 2115 done(); 2116 }, (err) => { 2117 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2118 expect().assertFail(); 2119 done(); 2120 }) 2121 }, (err) => { 2122 console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err)); 2123 expect().assertFail(); 2124 done(); 2125 }) 2126 }, (err) => { 2127 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2128 expect().assertFail(); 2129 done(); 2130 }) 2131 }, (err) => { 2132 console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err)); 2133 expect().assertFail(); 2134 done(); 2135 }) 2136 }, (err) => { 2137 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2138 expect().assertFail(); 2139 done(); 2140 }) 2141 }) 2142 2143 /** 2144 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0790 2145 * @tc.name testSetFocusable_Parameter3_Promise 2146 * @tc.desc Set the window to lose focus and be touchable 2147 */ 2148 it('testSetFocusable_Parameter3_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2149 let msgStr = 'setFocusable_Test_003'; 2150 console.log(msgStr + ' begin'); 2151 window.getTopWindow().then(wnd => { 2152 console.log(msgStr + ' getTopWindow wnd' + wnd); 2153 expect(wnd != null).assertTrue(); 2154 wnd.setFocusable(false).then(() => { 2155 console.log(msgStr + ' setFocusable(false) success '); 2156 wnd.getProperties().then(data => { 2157 expect(!data.focusable).assertTrue(); 2158 wnd.setTouchable(true).then(() => { 2159 console.log(msgStr + ' setTouchable(true) success '); 2160 wnd.getProperties().then(data => { 2161 expect(data.touchable).assertTrue(); 2162 done(); 2163 }, (err) => { 2164 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2165 expect().assertFail(); 2166 done(); 2167 }) 2168 }, (err) => { 2169 console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err)); 2170 expect().assertFail(); 2171 done(); 2172 }) 2173 }, (err) => { 2174 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2175 expect().assertFail(); 2176 done(); 2177 }) 2178 }, (err) => { 2179 console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err)); 2180 expect().assertFail(); 2181 done(); 2182 }) 2183 }, (err) => { 2184 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2185 expect().assertFail(); 2186 done(); 2187 }) 2188 }) 2189 2190 /** 2191 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0800 2192 * @tc.name testSetFocusable_Parameter4_Promise 2193 * @tc.desc Setting the window to get focus is not touchable 2194 */ 2195 it('testSetFocusable_Parameter4_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2196 let msgStr = 'setFocusable_Test_004'; 2197 console.log(msgStr + ' begin'); 2198 window.getTopWindow().then(wnd => { 2199 console.log(msgStr + ' getTopWindow wnd' + wnd); 2200 expect(wnd != null).assertTrue(); 2201 wnd.setFocusable(true).then(() => { 2202 console.log(msgStr + ' setFocusable(true) success '); 2203 wnd.getProperties().then(data => { 2204 expect(data.focusable).assertTrue(); 2205 wnd.setTouchable(false).then(() => { 2206 console.log(msgStr + ' setTouchable(false) success '); 2207 wnd.getProperties().then(data => { 2208 expect(!data.touchable).assertTrue(); 2209 done(); 2210 }, (err) => { 2211 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2212 expect().assertFail(); 2213 done(); 2214 }) 2215 }, (err) => { 2216 console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err)); 2217 expect().assertFail(); 2218 done(); 2219 }) 2220 }, (err) => { 2221 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2222 expect().assertFail(); 2223 done(); 2224 }) 2225 }, (err) => { 2226 console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err)); 2227 expect().assertFail(); 2228 done(); 2229 }) 2230 }, (err) => { 2231 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2232 expect().assertFail(); 2233 done(); 2234 }) 2235 }) 2236 2237 /** 2238 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0810 2239 * @tc.name testSetFocusable_Parameter5_Promise 2240 * @tc.desc Set the window to get focus and touch 2241 */ 2242 it('testSetFocusable_Parameter5_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2243 let msgStr = 'setFocusable_Test_005'; 2244 console.log(msgStr + ' begin'); 2245 window.getTopWindow().then(wnd => { 2246 console.log(msgStr + ' getTopWindow wnd' + wnd); 2247 expect(wnd != null).assertTrue(); 2248 wnd.setFocusable(true).then(() => { 2249 console.log(msgStr + ' setFocusable(true) success '); 2250 wnd.getProperties().then(data => { 2251 expect(data.focusable).assertTrue(); 2252 wnd.setTouchable(true).then(() => { 2253 console.log(msgStr + ' setTouchable(true) success '); 2254 wnd.getProperties().then(data => { 2255 expect(data.touchable).assertTrue(); 2256 done(); 2257 }, (err) => { 2258 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2259 expect().assertFail(); 2260 done(); 2261 }) 2262 }, (err) => { 2263 console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err)); 2264 expect().assertFail(); 2265 done(); 2266 }) 2267 }, (err) => { 2268 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2269 expect().assertFail(); 2270 done(); 2271 }) 2272 }, (err) => { 2273 console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err)); 2274 expect().assertFail(); 2275 done(); 2276 }) 2277 }, (err) => { 2278 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2279 expect().assertFail(); 2280 done(); 2281 }) 2282 }) 2283 2284 /** 2285 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1050 2286 * @tc.name testTouchable_Parameter1_Promise 2287 * @tc.desc Set whether the window can be touched or not 2288 */ 2289 it('testTouchable_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2290 let msgStr = 'setTouchable_Test_001'; 2291 console.log(msgStr + ' begin'); 2292 window.getTopWindow().then(wnd => { 2293 console.log(msgStr + ' getTopWindow wnd' + wnd); 2294 expect(wnd != null).assertTrue(); 2295 wnd.getProperties().then(data => { 2296 expect(data.touchable).assertTrue(); 2297 wnd.setTouchable(false).then(() => { 2298 console.log(msgStr + ' setTouchable(false) success '); 2299 wnd.getProperties().then(data => { 2300 expect(!data.touchable).assertTrue(); 2301 wnd.setTouchable(true).then(() => { 2302 console.log(msgStr + ' setTouchable(true) success '); 2303 wnd.getProperties().then(data => { 2304 expect(data.touchable).assertTrue(); 2305 done(); 2306 }, (err) => { 2307 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2308 expect().assertFail(); 2309 done(); 2310 }) 2311 }, (err) => { 2312 console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err)); 2313 expect().assertFail(); 2314 done(); 2315 }) 2316 }, (err) => { 2317 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2318 expect().assertFail(); 2319 done(); 2320 }) 2321 }, (err) => { 2322 console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err)); 2323 expect().assertFail(); 2324 done(); 2325 }) 2326 }, (err) => { 2327 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2328 expect().assertFail(); 2329 done(); 2330 }) 2331 }, (err) => { 2332 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2333 expect().assertFail(); 2334 done(); 2335 }) 2336 }) 2337 2338 /** 2339 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0860 2340 * @tc.name testSetKeepScreenOn_Parameter3_Promise 2341 * @tc.desc Set whether the window can be touched or not 2342 */ 2343 it('testSetKeepScreenOn_Parameter3_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2344 let msgStr = 'setKeepScreenOn_Test_001'; 2345 console.log(msgStr + ' begin'); 2346 window.getTopWindow().then(wnd => { 2347 console.log(msgStr + ' getTopWindow wnd' + wnd); 2348 expect(wnd != null).assertTrue(); 2349 wnd.getProperties().then(data => { 2350 expect(!data.isKeepScreenOn).assertTrue(); 2351 wnd.setKeepScreenOn(true).then(() => { 2352 console.log(msgStr + ' setKeepScreenOn(true) success '); 2353 wnd.getProperties().then(data => { 2354 expect(data.isKeepScreenOn).assertTrue(); 2355 wnd.setKeepScreenOn(false).then(() => { 2356 console.log(msgStr + ' setKeepScreenOn(false) success '); 2357 wnd.getProperties().then(data => { 2358 expect(!data.isKeepScreenOn).assertTrue(); 2359 done(); 2360 }, (err) => { 2361 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2362 expect().assertFail(); 2363 done(); 2364 }) 2365 }, (err) => { 2366 console.log(msgStr + ' setKeepScreenOn failed: err' + JSON.stringify(err)); 2367 expect().assertFail(); 2368 done(); 2369 }) 2370 }, (err) => { 2371 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2372 expect().assertFail(); 2373 done(); 2374 }) 2375 }, (err) => { 2376 console.log(msgStr + ' setKeepScreenOn failed: err' + JSON.stringify(err)); 2377 expect().assertFail(); 2378 done(); 2379 }) 2380 }, (err) => { 2381 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2382 expect().assertFail(); 2383 done(); 2384 }) 2385 }, (err) => { 2386 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2387 expect().assertFail(); 2388 done(); 2389 }) 2390 }) 2391 2392 /** 2393 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0870 2394 * @tc.name testSetKeepScreenOn_Parameter4_Promise 2395 * @tc.desc Set whether the window can be touched or not 2396 */ 2397 it('testSetKeepScreenOn_Parameter4_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2398 let msgStr = 'setKeepScreenOn_Test_002'; 2399 console.log(msgStr + ' begin'); 2400 window.getTopWindow().then(wnd => { 2401 console.log(msgStr + ' getTopWindow wnd' + wnd); 2402 expect(wnd != null).assertTrue(); 2403 for (let i = 0; i < 5; i++) { 2404 wnd.getProperties().then(data => { 2405 expect(!data.isKeepScreenOn).assertTrue(); 2406 wnd.setKeepScreenOn(true).then(() => { 2407 console.log(msgStr + ' setKeepScreenOn(true) success '); 2408 wnd.getProperties().then(data => { 2409 expect(data.isKeepScreenOn).assertTrue(); 2410 wnd.setKeepScreenOn(false).then(() => { 2411 console.log(msgStr + ' setKeepScreenOn(false) success '); 2412 wnd.getProperties().then(data => { 2413 expect(!data.isKeepScreenOn).assertTrue(); 2414 }, (err) => { 2415 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2416 expect().assertFail(); 2417 done(); 2418 }) 2419 }, (err) => { 2420 console.log(msgStr + ' setKeepScreenOn failed: err' + JSON.stringify(err)); 2421 expect().assertFail(); 2422 done(); 2423 }) 2424 }, (err) => { 2425 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2426 expect().assertFail(); 2427 done(); 2428 }) 2429 }, (err) => { 2430 console.log(msgStr + ' setKeepScreenOn failed: err' + JSON.stringify(err)); 2431 expect().assertFail(); 2432 done(); 2433 }) 2434 }, (err) => { 2435 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2436 expect().assertFail(); 2437 done(); 2438 }) 2439 } 2440 done(); 2441 }, (err) => { 2442 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2443 expect().assertFail(); 2444 done(); 2445 }) 2446 }) 2447 2448 /** 2449 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0560 2450 * @tc.name testSetBackgroundColor_IsTransparent_RGB_Promise 2451 * @tc.desc Set the window background color to red and Default opacity 2452 */ 2453 it('testSetBackgroundColor_IsTransparent_RGB_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2454 let msgStr = 'setBackgroundColor_Test_001'; 2455 console.log(msgStr + ' begin'); 2456 window.getTopWindow().then(wnd => { 2457 console.log(msgStr + ' getTopWindow wnd' + wnd); 2458 expect(wnd != null).assertTrue(); 2459 wnd.setBackgroundColor("#ffff00").then(() => { 2460 console.log(msgStr + ' setBrightness(#ffff00) success '); 2461 wnd.getProperties().then(data => { 2462 expect(!data.isTransparent).assertTrue(); 2463 done(); 2464 }, (err) => { 2465 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2466 expect().assertFail(); 2467 done(); 2468 }) 2469 }, (err) => { 2470 console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err)); 2471 expect().assertFail(); 2472 done(); 2473 }) 2474 }, (err) => { 2475 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2476 expect().assertFail(); 2477 done(); 2478 }) 2479 }) 2480 2481 /** 2482 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0550 2483 * @tc.name testSetBackgroundColor_IsTransparent_RGBA_Promise 2484 * @tc.desc Set the window background color to red opaque 2485 */ 2486 it('testSetBackgroundColor_IsTransparent_RGBA_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 2487 let msgStr = 'setBackgroundColor_Test_002'; 2488 console.log(msgStr + ' begin'); 2489 window.getTopWindow().then(wnd => { 2490 console.log(msgStr + ' getTopWindow wnd' + wnd); 2491 expect(wnd != null).assertTrue(); 2492 wnd.setBackgroundColor("#ffffff00").then(() => { 2493 console.log(msgStr + ' setBrightness(#ffffff00) success '); 2494 wnd.getProperties().then(data => { 2495 expect(!data.isTransparent).assertTrue(); 2496 done(); 2497 }, (err) => { 2498 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2499 expect().assertFail(); 2500 done(); 2501 }) 2502 }, (err) => { 2503 console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err)); 2504 expect().assertFail(); 2505 done(); 2506 }) 2507 }, (err) => { 2508 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2509 expect().assertFail(); 2510 done(); 2511 }) 2512 }) 2513 2514 /** 2515 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0570 2516 * @tc.name testSetBackgroundColor_IsTransparent_Transparent_RGBA_Promise 2517 * @tc.desc Set the window background color to red transparent 2518 */ 2519 it('testSetBackgroundColor_IsTransparent_Transparent_RGBA_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 2520 let msgStr = 'setBackgroundColor_Test_003'; 2521 console.log(msgStr + ' begin'); 2522 window.getTopWindow().then(wnd => { 2523 console.log(msgStr + ' getTopWindow wnd' + wnd); 2524 expect(wnd != null).assertTrue(); 2525 wnd.setBackgroundColor("#00ffff00").then(() => { 2526 console.log(msgStr + ' setBrightness(#00ffff00) success '); 2527 wnd.getProperties().then(data => { 2528 expect(data.isTransparent).assertTrue(); 2529 done(); 2530 }, (err) => { 2531 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2532 expect().assertFail(); 2533 done(); 2534 }) 2535 }, (err) => { 2536 console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err)); 2537 expect().assertFail(); 2538 done(); 2539 }) 2540 }, (err) => { 2541 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2542 expect().assertFail(); 2543 done(); 2544 }) 2545 }) 2546 2547 /** 2548 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0540 2549 * @tc.name testSetBackgroundColor_Invalid_Parameter_Promise 2550 * @tc.desc Set the background color input parameter as an outlier 2551 */ 2552 it('testSetBackgroundColor_Invalid_Parameter_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 2553 let msgStr = 'setBackgroundColor_Test_004'; 2554 console.log(msgStr + ' begin'); 2555 window.getTopWindow().then(wnd => { 2556 console.log(msgStr + ' getTopWindow wnd' + wnd); 2557 expect(wnd != null).assertTrue(); 2558 wnd.setBackgroundColor("ff00").then(() => { 2559 console.log(msgStr + ' setBrightness(#ff00) success '); 2560 expect().assertFail(); 2561 done(); 2562 }, (err) => { 2563 console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err)); 2564 expect(err.code).assertEqual(1003); 2565 done(); 2566 }) 2567 }, (err) => { 2568 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2569 expect().assertFail(); 2570 done(); 2571 }) 2572 }) 2573 2574 /** 2575 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0500 2576 * @tc.name testSetBackgroundColor_16bit_Invalid_Parameter_Promise 2577 * @tc.desc Setting window background color input exception ARGB 2578 */ 2579 it('testSetBackgroundColor_16bit_Invalid_Parameter_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 2580 let msgStr = 'setBackgroundColor_Test_005'; 2581 console.log(msgStr + ' begin'); 2582 window.getTopWindow().then(wnd => { 2583 console.log(msgStr + ' getTopWindow wnd' + wnd); 2584 expect(wnd != null).assertTrue(); 2585 wnd.setBackgroundColor("#hhgghhgg").then(() => { 2586 console.log(msgStr + ' setBrightness(#hhgghhgg) success '); 2587 expect().assertFail(); 2588 done(); 2589 }, (err) => { 2590 console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err)); 2591 expect(err.code).assertEqual(1003); 2592 done(); 2593 }) 2594 }, (err) => { 2595 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2596 expect().assertFail(); 2597 done(); 2598 }) 2599 }) 2600 2601 /** 2602 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0520 2603 * @tc.name testSetBackgroundColor_8bit_Invalid_Parameter_Promise 2604 * @tc.desc Setting window background color input exception RGB 2605 */ 2606 it('testSetBackgroundColor_8bit_Invalid_Parameter_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 2607 let msgStr = 'setBackgroundColor_Test_006'; 2608 console.log(msgStr + ' begin'); 2609 window.getTopWindow().then(wnd => { 2610 console.log(msgStr + ' getTopWindow wnd' + wnd); 2611 expect(wnd != null).assertTrue(); 2612 wnd.setBackgroundColor("#gghhkk").then(() => { 2613 console.log(msgStr + ' setBrightness(#gghhkk) success '); 2614 expect().assertFail(); 2615 done(); 2616 }, (err) => { 2617 console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err)); 2618 expect(err.code).assertEqual(1003); 2619 done(); 2620 }) 2621 }, (err) => { 2622 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2623 expect().assertFail(); 2624 done(); 2625 }) 2626 }) 2627 2628 /** 2629 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0660 2630 * @tc.name testSetBrightness_Multi_Parameter1_Promise 2631 * @tc.desc Setting the brightness bar input parameter is normal 2632 */ 2633 it('testSetBrightness_Multi_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2634 let msgStr = 'setBrightness_Test_001'; 2635 console.log(msgStr + ' begin'); 2636 window.getTopWindow().then(wnd => { 2637 console.log(msgStr + ' getTopWindow wnd' + wnd); 2638 expect(wnd != null).assertTrue(); 2639 wnd.setBrightness(0).then(() => { 2640 console.log(msgStr + ' setBrightness(0) success '); 2641 wnd.getProperties().then(data => { 2642 console.log(msgStr + ' getProperties data ' + data); 2643 expect(data.brightness).assertEqual(0); 2644 wnd.setBrightness(0.5).then(() => { 2645 console.log(msgStr + ' setBrightness(0.5) success '); 2646 wnd.getProperties().then(data => { 2647 console.log(msgStr + ' getProperties data ' + data); 2648 expect(data.brightness).assertEqual(0.5); 2649 wnd.setBrightness(1).then(() => { 2650 console.log(msgStr + ' setBrightness(1) success '); 2651 wnd.getProperties().then(data => { 2652 console.log(msgStr + ' getProperties data ' + data); 2653 expect(data.brightness).assertEqual(1); 2654 done(); 2655 }, (err) => { 2656 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2657 expect().assertFail(); 2658 done(); 2659 }) 2660 }, (err) => { 2661 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 2662 expect().assertFail(); 2663 done(); 2664 }) 2665 }, (err) => { 2666 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2667 expect().assertFail(); 2668 done(); 2669 }) 2670 2671 }, (err) => { 2672 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 2673 expect().assertFail(); 2674 done(); 2675 }) 2676 }, (err) => { 2677 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2678 expect().assertFail(); 2679 done(); 2680 }) 2681 }, (err) => { 2682 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 2683 expect().assertFail(); 2684 done(); 2685 }) 2686 }, (err) => { 2687 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2688 expect().assertFail(); 2689 done(); 2690 }) 2691 }) 2692 2693 /** 2694 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0680 2695 * @tc.name testSetBrightness_Parameter1_Promise 2696 * @tc.desc Set the brightness bar input parameter to decimal 2697 */ 2698 it('testSetBrightness_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2699 let msgStr = 'setBrightness_Test_002'; 2700 console.log(msgStr + ' begin'); 2701 window.getTopWindow().then(wnd => { 2702 console.log(msgStr + ' getTopWindow wnd' + wnd); 2703 expect(wnd != null).assertTrue(); 2704 wnd.setBrightness(0.564789).then(() => { 2705 console.log(msgStr + ' setBrightness(0.564789) success '); 2706 wnd.getProperties().then(data => { 2707 console.log(msgStr + ' getProperties data ' + data); 2708 expect(TRUE_WINDOW).assertTrue(); 2709 done(); 2710 }, (err) => { 2711 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 2712 expect().assertFail(); 2713 done(); 2714 }) 2715 }, (err) => { 2716 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 2717 expect().assertFail(); 2718 done(); 2719 }) 2720 }, (err) => { 2721 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2722 expect().assertFail(); 2723 done(); 2724 }) 2725 }) 2726 2727 /** 2728 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0630 2729 * @tc.name testSetBrightness_Invalid_Parameter_MAX_Value_Promise 2730 * @tc.desc Set the brightness bar input parameter to number max 2731 */ 2732 it('testSetBrightness_Invalid_Parameter_MAX_Value_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2733 let msgStr = 'setBrightness_Test_003'; 2734 console.log(msgStr + ' begin'); 2735 window.getTopWindow().then(wnd => { 2736 console.log(msgStr + ' getTopWindow wnd' + wnd); 2737 expect(wnd != null).assertTrue(); 2738 wnd.setBrightness(Number.MAX_VALUE).then(() => { 2739 console.log(msgStr + ' setBrightness(Number.MAX_VALUE) success '); 2740 expect().assertFail(); 2741 done(); 2742 }, (err) => { 2743 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 2744 expect(err.code).assertEqual(1003); 2745 done(); 2746 }) 2747 }, (err) => { 2748 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2749 expect().assertFail(); 2750 done(); 2751 }) 2752 }) 2753 2754 /** 2755 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0650 2756 * @tc.name testSetBrightness_Invalid_Parameter_MIN_Value_Promise 2757 * @tc.desc Set the brightness bar input parameter to number min 2758 */ 2759 it('testSetBrightness_Invalid_Parameter_MIN_Value_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 2760 let msgStr = 'setBrightness_Test_004'; 2761 console.log(msgStr + ' begin'); 2762 window.getTopWindow().then(wnd => { 2763 console.log(msgStr + ' getTopWindow wnd' + wnd); 2764 expect(wnd != null).assertTrue(); 2765 wnd.setBrightness(Number.MIN_VALUE).then(() => { 2766 console.log(msgStr + ' setBrightness(Number.MIN_VALUE) success '); 2767 expect(TRUE_WINDOW).assertTrue(); 2768 done(); 2769 }, (err) => { 2770 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 2771 expect().assertFail(); 2772 done(); 2773 }) 2774 }, (err) => { 2775 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2776 expect().assertFail(); 2777 done(); 2778 }) 2779 }) 2780 2781 /** 2782 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0610 2783 * @tc.name testSetBrightness_Invalid_Multi_Parameter1_Promise 2784 * @tc.desc Setting brightness bar input parameter exception 2785 */ 2786 it('testSetBrightness_Invalid_Multi_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2787 let msgStr = 'setBrightness_Test_005'; 2788 console.log(msgStr + ' begin'); 2789 window.getTopWindow().then(wnd => { 2790 console.log(msgStr + ' getTopWindow wnd' + wnd); 2791 expect(wnd != null).assertTrue(); 2792 wnd.setBrightness(1.1).then(() => { 2793 console.log(msgStr + ' setBrightness(1.1) success '); 2794 expect().assertFail(); 2795 done(); 2796 }, (err) => { 2797 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 2798 expect(err.code).assertEqual(1003); 2799 wnd.setBrightness(-0.1).then(() => { 2800 console.log(msgStr + ' setBrightness(-0.1) success '); 2801 expect().assertFail(); 2802 done(); 2803 }, (err) => { 2804 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 2805 expect(err.code).assertEqual(1003); 2806 done(); 2807 }) 2808 }) 2809 }, (err) => { 2810 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2811 expect().assertFail(); 2812 done(); 2813 }) 2814 }) 2815 2816 /** 2817 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0750 2818 * @tc.name testSetDimBehind_DeviceNotSupport_Promise 2819 * @tc.desc Set the setDimBehind interface invalid 2820 */ 2821 it('testSetDimBehind_DeviceNotSupport_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2822 let msgStr = 'setDimBehindDeviceNotSupport_Test_001'; 2823 console.log(msgStr + ' begin'); 2824 window.getTopWindow().then(wnd => { 2825 console.info(msgStr + ' getTopWindow wnd' + wnd); 2826 expect(wnd != null).assertTrue(); 2827 wnd.setDimBehind(0.5).then(() => { 2828 console.info(msgStr + ' not support success '); 2829 expect().assertFail(); 2830 done(); 2831 }, err => { 2832 console.info(msgStr + ' failed: err' + JSON.stringify(err)); 2833 expect(err.code).assertEqual(801); 2834 done(); 2835 }) 2836 }, (err) => { 2837 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2838 expect().assertFail(); 2839 done(); 2840 }) 2841 }) 2842 2843 /** 2844 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0740 2845 * @tc.name testSetDimBehind_DeviceNotSupport_Callback 2846 * @tc.desc Set the setDimBehind interface invalid 2847 */ 2848 it('testSetDimBehind_DeviceNotSupport_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2849 let msgStr = 'setDimBehindDeviceNotSupport_Test_002'; 2850 console.log(msgStr + ' begin'); 2851 window.getTopWindow().then(wnd => { 2852 console.info(msgStr + ' getTopWindow wnd' + wnd); 2853 expect(wnd != null).assertTrue(); 2854 wnd.setDimBehind(0.5, (err, data) => { 2855 if (err.code) { 2856 console.error(msgStr + 'Failed to set the dimness2. Cause: ' + JSON.stringify(err)); 2857 expect(err.code).assertEqual(801); 2858 done(); 2859 } else { 2860 console.info(msgStr + ' not support success '); 2861 expect().assertFail(); 2862 done(); 2863 } 2864 }) 2865 }, (err) => { 2866 console.log('windowTest setDimBehind2 getTopWindow failed: err' + JSON.stringify(err)); 2867 expect().assertFail(); 2868 done(); 2869 }) 2870 }) 2871 2872 /** 2873 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0960 2874 * @tc.name testSetOutsideTouchable_Parameter1_Promise 2875 * @tc.desc Set the setOutsideTouchable interface invalid 2876 */ 2877 it('testSetOutsideTouchable_Parameter1_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2878 let msgStr = 'setOutsideTouchable_Test_001'; 2879 console.log(msgStr + ' begin'); 2880 window.getTopWindow().then(wnd => { 2881 console.info(msgStr + ' getTopWindow wnd' + wnd); 2882 expect(wnd != null).assertTrue(); 2883 wnd.setOutsideTouchable(true).then(() => { 2884 console.info(msgStr + ' not support success '); 2885 expect().assertFail(); 2886 done(); 2887 }, err => { 2888 console.info(msgStr + ' failed: err' + JSON.stringify(err)); 2889 expect(err.code).assertEqual(801); 2890 done(); 2891 }) 2892 }, (err) => { 2893 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2894 expect().assertFail(); 2895 done(); 2896 }) 2897 }) 2898 2899 /** 2900 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0970 2901 * @tc.name testSetOutsideTouchable_Parameter2_Promise 2902 * @tc.desc Set the setOutsideTouchable interface invalid 2903 */ 2904 it('testSetOutsideTouchable_Parameter2_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2905 let msgStr = 'setOutsideTouchable_Test_002'; 2906 console.log(msgStr + ' begin'); 2907 window.getTopWindow().then(wnd => { 2908 console.info(msgStr + ' getTopWindow wnd' + wnd); 2909 expect(wnd != null).assertTrue(); 2910 wnd.setOutsideTouchable(false).then(() => { 2911 console.info(msgStr + ' not support success '); 2912 expect().assertFail(); 2913 done(); 2914 }, err => { 2915 console.info(msgStr + ' failed: err' + JSON.stringify(err)); 2916 expect(err.code).assertEqual(801); 2917 done(); 2918 }) 2919 }, (err) => { 2920 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2921 expect().assertFail(); 2922 done(); 2923 }) 2924 }) 2925 2926 /** 2927 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0980 2928 * @tc.name testSetOutsideTouchable_Parameter3_Callback 2929 * @tc.desc Set the setOutsideTouchable interface invalid 2930 */ 2931 it('testSetOutsideTouchable_Parameter3_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2932 let msgStr = 'setOutsideTouchable_Test_003'; 2933 console.log(msgStr + ' begin'); 2934 window.getTopWindow().then(wnd => { 2935 console.info(msgStr + ' getTopWindow wnd' + wnd); 2936 expect(wnd != null).assertTrue(); 2937 wnd.setOutsideTouchable(true, (err, data) => { 2938 if (err.code) { 2939 console.error(msgStr + 'Failed to set the area to be touchable1. err: ' + JSON.stringify(err)); 2940 expect(err.code).assertEqual(801); 2941 done(); 2942 } else { 2943 console.info(msgStr + ' not support success '); 2944 expect().assertFail(); 2945 done(); 2946 } 2947 }) 2948 }, (err) => { 2949 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2950 expect().assertFail(); 2951 done(); 2952 }) 2953 }) 2954 2955 /** 2956 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0990 2957 * @tc.name testSetOutsideTouchable_Parameter4_Callback 2958 * @tc.desc Set the setOutsideTouchable interface invalid 2959 */ 2960 it('testSetOutsideTouchable_Parameter4_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 2961 let msgStr = 'setOutsideTouchable_Test_004'; 2962 console.log(msgStr + ' begin'); 2963 window.getTopWindow().then(wnd => { 2964 console.info(msgStr + ' getTopWindow wnd' + wnd); 2965 expect(wnd != null).assertTrue(); 2966 wnd.setOutsideTouchable(false, (err, data) => { 2967 if (err.code) { 2968 console.error(msgStr + 'Failed to set the area to be touchable4. err: ' + JSON.stringify(err)); 2969 expect(err.code).assertEqual(801); 2970 done(); 2971 } else { 2972 console.info(msgStr + ' not support success '); 2973 expect().assertFail(); 2974 done(); 2975 } 2976 }) 2977 }, (err) => { 2978 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 2979 expect().assertFail(); 2980 done(); 2981 }) 2982 }) 2983 2984 /** 2985 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1090 2986 * @tc.name testWindowOrientation_Enum_Value 2987 * @tc.desc To test the enum value of Orientation. 2988 */ 2989 it('testWindowOrientation_Enum_Value', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { 2990 let msgStr = 'setOutsideTouchable_Test_004'; 2991 console.log(msgStr + ' begin'); 2992 try { 2993 expect(0).assertEqual(window.Orientation.UNSPECIFIED); 2994 expect(1).assertEqual(window.Orientation.PORTRAIT); 2995 expect(2).assertEqual(window.Orientation.LANDSCAPE); 2996 expect(3).assertEqual(window.Orientation.PORTRAIT_INVERTED); 2997 expect(4).assertEqual(window.Orientation.LANDSCAPE_INVERTED); 2998 expect(5).assertEqual(window.Orientation.AUTO_ROTATION); 2999 expect(6).assertEqual(window.Orientation.AUTO_ROTATION_PORTRAIT); 3000 expect(7).assertEqual(window.Orientation.AUTO_ROTATION_LANDSCAPE); 3001 expect(8).assertEqual(window.Orientation.AUTO_ROTATION_RESTRICTED); 3002 expect(9).assertEqual(window.Orientation.AUTO_ROTATION_PORTRAIT_RESTRICTED); 3003 expect(10).assertEqual(window.Orientation.AUTO_ROTATION_LANDSCAPE_RESTRICTED); 3004 expect(11).assertEqual(window.Orientation.LOCKED); 3005 done(); 3006 } catch (err) { 3007 console.info(msgStr + 'test enum value of windowStageEventType error ' + JSON.stringify(err)); 3008 expect().assertFail(); 3009 done(); 3010 } 3011 }) 3012 3013 /** 3014 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0840 3015 * @tc.name testSetKeepScreenOn_Parameter1_Callback 3016 * @tc.desc Set whether setKeepScreenOn or not 3017 */ 3018 it('testSetKeepScreenOn_Parameter1_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3019 let msgStr = 'setKeepScreenOnCallBack_Test_001'; 3020 console.log(msgStr + ' begin'); 3021 window.getTopWindow().then(wnd => { 3022 console.info(msgStr + ' getTopWindow wnd' + wnd); 3023 expect(wnd != null).assertTrue(); 3024 wnd.getProperties().then(data => { 3025 expect(!data.isKeepScreenOn).assertTrue(); 3026 wnd.setKeepScreenOn(true, (err, data) => { 3027 if (err.code) { 3028 console.error(msgStr + 'Failed to set the screen to be always on. err: ' + JSON.stringify(err)); 3029 expect().assertFail(); 3030 done(); 3031 } else { 3032 console.info(msgStr + 'success set the screen to be always on. data: ' + JSON.stringify(data)); 3033 wnd.getProperties().then(data => { 3034 expect(data.isKeepScreenOn).assertTrue(); 3035 done(); 3036 }, (err) => { 3037 console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3038 expect().assertFail(); 3039 done(); 3040 }) 3041 } 3042 }) 3043 }, (err) => { 3044 console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3045 expect().assertFail(); 3046 done(); 3047 }) 3048 }, (err) => { 3049 console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3050 expect().assertFail(); 3051 done(); 3052 }) 3053 }) 3054 3055 /** 3056 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0850 3057 * @tc.name testSetKeepScreenOn_Parameter2_Callback 3058 * @tc.desc Set whether the window can be touched or not 3059 */ 3060 it('testSetKeepScreenOn_Parameter2_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3061 let msgStr = 'setKeepScreenOnCallBack_Test_002'; 3062 console.log(msgStr + ' begin'); 3063 window.getTopWindow().then(wnd => { 3064 console.info(msgStr + ' getTopWindow wnd' + wnd); 3065 expect(wnd != null).assertTrue(); 3066 for (let i = 0; i < 5; i++) { 3067 wnd.setKeepScreenOn(true, (err, data) => { 3068 if (err.code) { 3069 console.error(msgStr + 'Failed to set the screen to be always on. err: ' + JSON.stringify(err)); 3070 expect().assertFail(); 3071 done(); 3072 } else { 3073 wnd.getProperties().then(data => { 3074 expect(data.isKeepScreenOn).assertTrue(); 3075 wnd.setKeepScreenOn(false, (err, data) => { 3076 if (err.code) { 3077 console.error(msgStr + 'Failed to set the screen to be always on. err: ' + JSON.stringify(err)); 3078 expect().assertFail(); 3079 done(); 3080 } else { 3081 console.info(msgStr + 'success set the screen to be always on. data: ' + JSON.stringify(data)); 3082 wnd.getProperties().then(data => { 3083 expect(!data.isKeepScreenOn).assertTrue(); 3084 done(); 3085 }, (err) => { 3086 console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3087 expect().assertFail(); 3088 done(); 3089 }) 3090 } 3091 }) 3092 }, (err) => { 3093 console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3094 expect().assertFail(); 3095 done(); 3096 }) 3097 } 3098 }) 3099 } 3100 done(); 3101 }, (err) => { 3102 console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3103 expect().assertFail(); 3104 done(); 3105 }) 3106 }) 3107 3108 /** 3109 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0590 3110 * @tc.name testSetBackgroundColor_RGB_Callback 3111 * @tc.desc Set the window background color to red and Default opacity 3112 */ 3113 it('testSetBackgroundColor_RGB_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3114 let msgStr = 'setBackgroundColorCallBack_Test_001'; 3115 console.log(msgStr + ' begin'); 3116 window.getTopWindow().then(wnd => { 3117 console.log(msgStr + ' getTopWindow wnd' + wnd); 3118 expect(wnd != null).assertTrue(); 3119 wnd.setBackgroundColor("#ffff00", (err, data) => { 3120 if (err.code) { 3121 console.error(msgStr + 'Failed to set the background color. err: ' + JSON.stringify(err)); 3122 expect().assertFail(); 3123 done(); 3124 } else { 3125 console.info(msgStr + 'Succeeded in setting the background color. Data: ' + JSON.stringify(data)); 3126 wnd.getProperties().then(data => { 3127 expect(!data.isTransparent).assertTrue(); 3128 done(); 3129 }, (err) => { 3130 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3131 expect().assertFail(); 3132 done(); 3133 }) 3134 } 3135 }) 3136 }, (err) => { 3137 console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3138 expect().assertFail(); 3139 done(); 3140 }) 3141 }) 3142 3143 /** 3144 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0580 3145 * @tc.name testSetBackgroundColor_RGBA_Callback 3146 * @tc.desc Set the window background color to red opaque 3147 */ 3148 it('testSetBackgroundColor_RGBA_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3149 let msgStr = 'setBackgroundColorCallBack_Test_002'; 3150 console.log(msgStr + ' begin'); 3151 window.getTopWindow().then(wnd => { 3152 console.log(msgStr + ' getTopWindow wnd' + wnd); 3153 expect(wnd != null).assertTrue(); 3154 wnd.setBackgroundColor("#ffffff00", (err, data) => { 3155 if (err.code) { 3156 console.error(msgStr + 'Failed to set the background color2. err: ' + JSON.stringify(err)); 3157 expect().assertFail(); 3158 done(); 3159 } else { 3160 console.info(msgStr + 'Succeeded in setting the background color2. Data: ' + JSON.stringify(data)); 3161 wnd.getProperties().then(data => { 3162 expect(!data.isTransparent).assertTrue(); 3163 done(); 3164 }, (err) => { 3165 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3166 expect().assertFail(); 3167 done(); 3168 }) 3169 } 3170 }) 3171 }, (err) => { 3172 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3173 expect().assertFail(); 3174 done(); 3175 }) 3176 }) 3177 3178 /** 3179 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0600 3180 * @tc.name testSetBackgroundColor_Transparent_RGBA_Callback 3181 * @tc.desc Set the window background color to red transparent 3182 */ 3183 it('testSetBackgroundColor_Transparent_RGBA_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3184 let msgStr = 'setBackgroundColorCallBack_Test_003'; 3185 console.log(msgStr + ' begin'); 3186 window.getTopWindow().then(wnd => { 3187 console.info(msgStr + ' getTopWindow wnd' + wnd); 3188 expect(wnd != null).assertTrue(); 3189 wnd.setBackgroundColor("#00ffff00", (err, data) => { 3190 if (err.code) { 3191 console.error(msgStr + 'Failed to set the background color2. err: ' + JSON.stringify(err)); 3192 expect().assertFail(); 3193 done(); 3194 } else { 3195 console.info(msgStr + 'Succeeded in setting the background color2. Data: ' + JSON.stringify(data)); 3196 wnd.getProperties().then(data => { 3197 expect(data.isTransparent).assertTrue(); 3198 done(); 3199 }, (err) => { 3200 console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3201 expect().assertFail(); 3202 done(); 3203 }) 3204 } 3205 }) 3206 }, (err) => { 3207 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3208 expect().assertFail(); 3209 done(); 3210 }) 3211 }) 3212 3213 /** 3214 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0530 3215 * @tc.name testSetBackgroundColor_Invalid_Parameter_Callback 3216 * @tc.desc Set the background color input parameter as an outlier 3217 */ 3218 it('testSetBackgroundColor_Invalid_Parameter_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3219 let msgStr = 'setBackgroundColorCallBack_Test_004'; 3220 console.log(msgStr + ' begin'); 3221 window.getTopWindow().then(wnd => { 3222 console.info(msgStr + ' getTopWindow wnd' + wnd); 3223 expect(wnd != null).assertTrue(); 3224 wnd.setBackgroundColor("ff00", (err, data) => { 3225 if (err.code) { 3226 console.error(msgStr + 'Failed to set the background color2. err: ' + JSON.stringify(err)); 3227 expect(err.code).assertEqual(1003); 3228 done(); 3229 } else { 3230 console.info(msgStr + 'Succeeded in setting the background color2. Data: ' + JSON.stringify(data)); 3231 expect().assertFail(); 3232 done(); 3233 } 3234 }) 3235 }, (err) => { 3236 console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3237 expect().assertFail(); 3238 done(); 3239 }) 3240 }) 3241 3242 /** 3243 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0510 3244 * @tc.name testSetBackgroundColor_8bit_Invalid_Parameter_Callback 3245 * @tc.desc Setting window background color input exception ARGB 3246 */ 3247 it('testSetBackgroundColor_8bit_Invalid_Parameter_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 3248 let msgStr = 'setBackgroundColorCallBack_Test_005'; 3249 console.log(msgStr + ' begin'); 3250 window.getTopWindow().then(wnd => { 3251 console.log(msgStr + ' getTopWindow wnd' + wnd); 3252 expect(wnd != null).assertTrue(); 3253 wnd.setBackgroundColor("#hhgghhgg", (err, data) => { 3254 if (err.code) { 3255 console.error(msgStr + 'Failed to set the background color5. err: ' + JSON.stringify(err)); 3256 expect(err.code).assertEqual(1003); 3257 done(); 3258 } else { 3259 console.info(msgStr + 'Succeeded in setting the background color5. Data: ' + JSON.stringify(data)); 3260 expect().assertFail(); 3261 done(); 3262 } 3263 }) 3264 }, (err) => { 3265 console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3266 expect().assertFail(); 3267 done(); 3268 }) 3269 }) 3270 3271 /** 3272 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0490 3273 * @tc.name testSetBackgroundColor_16bit_Invalid_Parameter_Callback 3274 * @tc.desc Setting window background color input exception RGB 3275 */ 3276 it('testSetBackgroundColor_16bit_Invalid_Parameter_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3277 let msgStr = 'setBackgroundColorCallBack_Test_006'; 3278 console.log(msgStr + ' begin'); 3279 window.getTopWindow().then(wnd => { 3280 console.log(msgStr + ' getTopWindow wnd' + wnd); 3281 expect(wnd != null).assertTrue(); 3282 wnd.setBackgroundColor("#gghhkk", (err, data) => { 3283 if (err.code) { 3284 console.error(msgStr + 'Failed to set the background color6. err: ' + JSON.stringify(err)); 3285 expect(err.code).assertEqual(1003); 3286 done(); 3287 } else { 3288 console.info(msgStr + 'Succeeded in setting the background color6. Data: ' + JSON.stringify(data)); 3289 expect().assertFail(); 3290 done(); 3291 } 3292 }) 3293 }, (err) => { 3294 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3295 expect().assertFail(); 3296 done(); 3297 }) 3298 }) 3299 3300 /** 3301 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0670 3302 * @tc.name testSetBrightness_Parameter1_Callback 3303 * @tc.desc Set the brightness bar input parameter to decimal 3304 */ 3305 it('testSetBrightness_Parameter1_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3306 let msgStr = 'setBrightnessCallBack_Test_002'; 3307 console.log(msgStr + ' begin'); 3308 window.getTopWindow().then(wnd => { 3309 console.log(msgStr + ' getTopWindow wnd' + wnd); 3310 expect(wnd != null).assertTrue(); 3311 wnd.setBrightness(1, (err, data) => { 3312 if (err.code) { 3313 console.error(msgStr + 'Failed to set the brightness2. err: ' + JSON.stringify(err)); 3314 expect().assertFail(); 3315 done(); 3316 } else { 3317 console.info(msgStr + 'Succeeded in setting the brightness2. Data: ' + JSON.stringify(data)); 3318 wnd.getProperties().then(data => { 3319 console.info(msgStr + ' getProperties data ' + data); 3320 expect(data.brightness).assertEqual(1); 3321 done(); 3322 }, (err) => { 3323 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3324 expect().assertFail(); 3325 done(); 3326 }) 3327 } 3328 3329 }) 3330 }, (err) => { 3331 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3332 expect().assertFail(); 3333 done(); 3334 }) 3335 }) 3336 3337 /** 3338 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0620 3339 * @tc.name testSetBrightness_Invalid_Parameter_MAX_Value_Callback 3340 * @tc.desc Set the brightness bar input parameter to number max 3341 */ 3342 it('testSetBrightness_Invalid_Parameter_MAX_Value_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 3343 let msgStr = 'setBrightnessCallBack_Test_003'; 3344 console.log(msgStr + ' begin'); 3345 window.getTopWindow().then(wnd => { 3346 console.log(msgStr + ' getTopWindow wnd' + wnd); 3347 expect(wnd != null).assertTrue(); 3348 wnd.setBrightness(Number.MAX_VALUE, (err, data) => { 3349 if (err.code) { 3350 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 3351 expect(err.code).assertEqual(1003); 3352 done(); 3353 } else { 3354 console.log(msgStr + ' setBrightness(Number.MAX_VALUE) success '); 3355 expect().assertFail(); 3356 done(); 3357 } 3358 }) 3359 }, (err) => { 3360 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3361 expect().assertFail(); 3362 done(); 3363 }) 3364 }) 3365 3366 /** 3367 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0640 3368 * @tc.name testSetBrightness_Invalid_Parameter_MIN_Value_Callback 3369 * @tc.desc Set the brightness bar input parameter to number min 3370 */ 3371 it('testSetBrightness_Invalid_Parameter_MIN_Value_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 3372 let msgStr = 'setBrightnessCallBack_Test_004'; 3373 console.log(msgStr + ' begin'); 3374 window.getTopWindow().then(wnd => { 3375 console.log(msgStr + ' getTopWindow wnd' + wnd); 3376 expect(wnd != null).assertTrue(); 3377 wnd.setBrightness(Number.MIN_VALUE, (err, data) => { 3378 if (err.code) { 3379 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 3380 expect(err.code).assertEqual(1003); 3381 done(); 3382 } else { 3383 console.log(msgStr + ' setBrightness(Number.MIN_VALUE) success '); 3384 expect(TRUE_WINDOW).assertTrue(); 3385 done(); 3386 } 3387 }) 3388 }, (err) => { 3389 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3390 expect().assertFail(); 3391 done(); 3392 }) 3393 }) 3394 3395 /** 3396 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0690 3397 * @tc.name testSetBrightness_Parameter2_Callback 3398 * @tc.desc Setting brightness bar input parameter exception 3399 */ 3400 it('testSetBrightness_Parameter2_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 3401 let msgStr = 'setBrightnessCallBack_Test_004'; 3402 console.log(msgStr + ' begin'); 3403 window.getTopWindow().then(wnd => { 3404 console.log(msgStr + ' getTopWindow wnd' + wnd); 3405 expect(wnd != null).assertTrue(); 3406 wnd.setBrightness(1.1, (err, data) => { 3407 if (err.code) { 3408 console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err)); 3409 expect(err.code).assertEqual(1003); 3410 done(); 3411 } else { 3412 console.log(msgStr + ' setBrightness(1.1) success '); 3413 expect().assertFail(); 3414 done(); 3415 } 3416 }) 3417 }, (err) => { 3418 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3419 expect().assertFail(); 3420 done(); 3421 }) 3422 }) 3423 3424 /** 3425 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1040 3426 * @tc.name testSetTouchable_Parameter1_Callback 3427 * @tc.desc Set whether the window can be touched or not 3428 */ 3429 it('testSetTouchable_Parameter1_Callback',TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3430 let msgStr = 'setTouchableCallBack_Test_001'; 3431 console.log(msgStr + ' begin'); 3432 window.getTopWindow().then(wnd => { 3433 console.log(msgStr + ' getTopWindow wnd' + wnd); 3434 expect(wnd != null).assertTrue(); 3435 wnd.setTouchable(false, (err, data) => { 3436 if (err.code) { 3437 console.error(msgStr + 'Failed to set the window to be touchable. err:' + JSON.stringify(err)); 3438 expect().assertFail(); 3439 done(); 3440 } else { 3441 wnd.getProperties().then(data => { 3442 expect(!data.touchable).assertTrue(); 3443 wnd.setTouchable(true, (err, data) => { 3444 if (err.code) { 3445 console.error(msgStr + 'Failed to set the window to be touchable. err:' + JSON.stringify(err)); 3446 expect().assertFail(); 3447 done(); 3448 } else { 3449 wnd.getProperties().then(data => { 3450 expect(data.touchable).assertTrue(); 3451 done(); 3452 }, (err) => { 3453 console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3454 expect().assertFail(); 3455 done(); 3456 }) 3457 } 3458 }) 3459 }, (err) => { 3460 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3461 expect().assertFail(); 3462 done(); 3463 }) 3464 } 3465 }) 3466 }, (err) => { 3467 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3468 expect().assertFail(); 3469 done(); 3470 }) 3471 }) 3472 3473 /** 3474 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0760 3475 * @tc.name testSetFocusable_Callback 3476 * @tc.desc Setting window focus acquisition and defocus 3477 */ 3478 it('testSetFocusable_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3479 let msgStr = 'setFocusableCallBack_Test_001'; 3480 console.log(msgStr + ' begin'); 3481 window.getTopWindow().then(wnd => { 3482 console.log(msgStr + ' getTopWindow wnd' + wnd); 3483 expect(wnd != null).assertTrue(); 3484 wnd.setFocusable(false, (err, data) => { 3485 if (err.code) { 3486 console.error(msgStr + 'Failed to set the window to be setFocusable. err:' + JSON.stringify(err)); 3487 expect().assertFail(); 3488 done(); 3489 } else { 3490 wnd.getProperties().then(data => { 3491 expect(!data.focusable).assertTrue(); 3492 wnd.setFocusable(true, (err, data) => { 3493 if (err.code) { 3494 console.error(msgStr + 'Failed to set the window to be setFocusable. err:' + JSON.stringify(err)); 3495 expect().assertFail(); 3496 done(); 3497 } else { 3498 wnd.getProperties().then(data => { 3499 expect(data.focusable).assertTrue(); 3500 done(); 3501 }, (err) => { 3502 console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3503 expect().assertFail(); 3504 done(); 3505 }) 3506 } 3507 }) 3508 }, (err) => { 3509 console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err)); 3510 expect().assertFail(); 3511 done(); 3512 }) 3513 } 3514 }) 3515 }, (err) => { 3516 console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err)); 3517 expect().assertFail(); 3518 done(); 3519 }) 3520 3521 }) 3522 3523 /** 3524 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1070 3525 * @tc.name testWindowAvoidAreaType_Enum_Value 3526 * @tc.desc To test the enum value of avoidareatype. 3527 */ 3528 it('testWindowAvoidAreaType_Enum_Value', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { 3529 let msgStr = 'enumAvoidAreaType_Test_001'; 3530 console.log(msgStr + ' begin'); 3531 try { 3532 expect(0).assertEqual(window.AvoidAreaType.TYPE_SYSTEM); 3533 expect(1).assertEqual(window.AvoidAreaType.TYPE_CUTOUT); 3534 expect(2).assertEqual(window.AvoidAreaType.TYPE_SYSTEM_GESTURE); 3535 expect(3).assertEqual(window.AvoidAreaType.TYPE_KEYBOARD); 3536 expect(4).assertEqual(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); 3537 done(); 3538 } catch (err) { 3539 console.info(msgStr + 'test enum value of AvoidArea error :' + JSON.stringify(err)); 3540 expect().assertFail(); 3541 done(); 3542 } 3543 }) 3544 3545 /** 3546 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0200 3547 * @tc.name testGetAvoidArea_Sytem_Type_Callback 3548 * @tc.desc Get System type avoidance area 3549 */ 3550 it('testGetAvoidArea_Sytem_Type_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 3551 let msgStr = 'enumAvoidAreaType_Test_001'; 3552 console.log(msgStr + ' begin'); 3553 window.getTopWindow().then(wnd => { 3554 console.info(msgStr + ' window.getTopWindow wnd: ' + wnd); 3555 expect(wnd != null).assertTrue(); 3556 wnd.getAvoidArea(window.AvoidAreaType.TYPE_KEYBOARD, (err, data) => { 3557 if (err.code != 0) { 3558 console.log(msgStr + ' wnd.getAvoidArea callback fail err:' + JSON.stringify(err)); 3559 expect().assertFail(); 3560 done(); 3561 } else { 3562 expect(data.visible).assertTrue(); 3563 expect(data.topRect != null).assertTrue(); 3564 expect(data.rightRect != null).assertTrue(); 3565 expect(data.bottomRect != null).assertTrue(); 3566 expect(data.leftRect != null).assertTrue(); 3567 done(); 3568 } 3569 }) 3570 }) 3571 }) 3572 3573 /** 3574 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_0150 3575 * @tc.name testGetAvoidArea_Invalid_Parameter_Callback 3576 * @tc.desc Get invalid parameter avoidarea 3577 */ 3578 it('testGetAvoidArea_Invalid_Parameter_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 3579 let msgStr = 'getAvoidAreaAdd_Test_002'; 3580 console.log(msgStr + ' begin'); 3581 window.getTopWindow().then(wnd => { 3582 console.info(msgStr + ' window.getTopWindow wnd: ' + wnd); 3583 expect(wnd != null).assertTrue(); 3584 wnd.getAvoidArea(-1, (err, data) => { 3585 console.info(msgStr + ' data:' + JSON.stringify(data)); 3586 if (err.code != 0) { 3587 console.log(msgStr + ' wnd.getAvoidArea callback fail' + JSON.stringify(err)); 3588 expect(err.code).assertEqual(1003); 3589 done(); 3590 } else { 3591 expect().assertFail(); 3592 done(); 3593 } 3594 }) 3595 }) 3596 }) 3597 3598 3599 /** 3600 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1130 3601 * @tc.name testIsFoldable_Test 3602 * @tc.desc To test the function of isFoldable 3603 */ 3604 it('testIsFoldable_Test', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { 3605 3606 let tag = 'isFoldable_Test_001 ' 3607 try { 3608 display.isFoldable(); 3609 expect(true).assertTrue(); 3610 done(); 3611 } catch (err) { 3612 console.log(tag + 'get isFoldable failed, err : ' + JSON.stringify(err)) 3613 expect().assertFail(); 3614 done(); 3615 } 3616 }) 3617 3618 /** 3619 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1140 3620 * @tc.name testGetFoldStatus_Test 3621 * @tc.desc To test the function of getFoldStatus 3622 */ 3623 it('testGetFoldStatus_Test', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async function (done) { 3624 3625 let tag = 'getFoldStatus_Test_001 ' 3626 3627 console.info(tag + ' begin'); 3628 try { 3629 display.getFoldStatus(); 3630 expect(display.FoldStatus.FOLD_STATUS_EXPANDED != null).assertTrue(); 3631 expect(display.FoldStatus.FOLD_STATUS_UNKNOWN != null).assertTrue(); 3632 expect(display.FoldStatus.FOLD_STATUS_FOLDED != null).assertTrue(); 3633 expect(display.FoldStatus.FOLD_STATUS_HALF_FOLDED != null).assertTrue(); 3634 done(); 3635 } catch (err) { 3636 console.log(tag + 'getFoldStatus failed, err : ' + JSON.stringify(err)) 3637 expect().assertFail(); 3638 done(); 3639 } 3640 }) 3641 3642 /** 3643 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1150 3644 * @tc.name testGetFoldDisplayMode_Test 3645 * @tc.desc To test the function of getFoldDisplayMode 3646 */ 3647 it('testGetFoldDisplayMode_Test', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async function (done) { 3648 3649 let tag = 'getFoldDisplayMode_Test_001 ' 3650 3651 console.info(tag + ' begin'); 3652 try { 3653 display.getFoldDisplayMode(); 3654 expect(display.FoldDisplayMode.FOLD_DISPLAY_MODE_UNKNOWN != null).assertTrue(); 3655 expect(display.FoldDisplayMode.FOLD_DISPLAY_MODE_FULL != null).assertTrue(); 3656 expect(display.FoldDisplayMode.FOLD_DISPLAY_MODE_MAIN != null).assertTrue(); 3657 expect(display.FoldDisplayMode.FOLD_DISPLAY_MODE_SUB != null).assertTrue(); 3658 expect(display.FoldDisplayMode.FOLD_DISPLAY_MODE_COORDINATION != null).assertTrue(); 3659 done(); 3660 } catch (err) { 3661 console.log(tag + 'getFoldStatus failed, err : ' + JSON.stringify(err)) 3662 expect().assertFail(); 3663 done(); 3664 } 3665 }) 3666 3667 /** 3668 * @tc.number SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1160 3669 * @tc.name testGetCurrentFoldCreaseRegion_Test 3670 * @tc.desc To test the function of getCurrentFoldCreaseRegion 3671 */ 3672 it('testGetCurrentFoldCreaseRegion_Test', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async function (done) { 3673 3674 let tag = 'getCurrentFoldCreaseRegion_Test_001 ' 3675 3676 console.info(tag + ' begin'); 3677 try { 3678 let region = display.getCurrentFoldCreaseRegion(); 3679 if (region != null) { 3680 expect(region.displayId != null).assertTrue() 3681 expect(region.creaseRects != null).assertTrue() 3682 done() 3683 } else { 3684 console.log(tag + "region : " + JSON.stringify(region)) 3685 expect(true).assertTrue(); 3686 done(); 3687 } 3688 } catch (err) { 3689 console.log(tag + 'getCurrentFoldCreaseRegion failed, err : ' + JSON.stringify(err)) 3690 expect().assertFail(); 3691 done(); 3692 } 3693 }) 3694 3695 /** 3696 * @tc.number : SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1170 3697 * @tc.name : testGetWindowLimits_Test 3698 * @tc.desc : test the function of getWindowLimits 3699 * @tc.size : MediumTest 3700 * @tc.type : Function 3701 * @tc.level : Level4 3702 */ 3703 it('testGetWindowLimits_Test', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async function (done) { 3704 console.log('www data testGetWindowLimits_Test begin') 3705 try { 3706 let windowClass = await window.getTopWindow(); 3707 let WindowLimits = windowClass.getWindowLimits(); 3708 console.log('www data Succeeded in window limits'+ JSON.stringify(WindowLimits)) 3709 expect(WindowLimits.maxWidth != null).assertTrue(); 3710 expect(WindowLimits.maxHeight != null).assertTrue(); 3711 expect(WindowLimits.minWidth != null).assertTrue(); 3712 expect(WindowLimits.minHeight != null).assertTrue(); 3713 done(); 3714 } catch (error) { 3715 console.log('www data Failed to obtain the window limits of window. Cause: ' + JSON.stringify(error)); 3716 if (error.code == 801) { 3717 expect(true).assertTrue() 3718 done() 3719 } else { 3720 expect().assertFail(); 3721 done(); 3722 } 3723 } 3724 }) 3725 3726 3727 /** 3728 * @tc.number : SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1190 3729 * @tc.name : testMinimize_Function_Callback 3730 * @tc.desc : test the function of minimize callback 3731 * @tc.size : MediumTest 3732 * @tc.type : Function 3733 * @tc.level : Level4 3734 */ 3735 it('testMinimize_Function_Callback', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3736 let msgStr = 'testMinimize_Function_Callback'; 3737 console.log(msgStr + ' begin'); 3738 window.create('subWindow11', window.WindowType.TYPE_APP).then(wnd => { 3739 expect(wnd != null).assertTrue(); 3740 console.log(msgStr + ' wnd.resetSize(400, 400) begin'); 3741 wnd.resetSize(400, 400).then(() => { 3742 console.log(msgStr + ' wnd.resetSize(400, 400) success'); 3743 wnd.isShowing().then(res => { 3744 console.log(msgStr + ' wnd.isShowing data:' + res); 3745 expect(!res).assertTrue(); 3746 wnd.show().then(() => { 3747 console.info(msgStr + 'show come in....'); 3748 try { 3749 wnd.minimize((err) => { 3750 if (err.code) { 3751 console.error(msgStr + 'Failed to minimize the window. Cause: ' + JSON.stringify(err)); 3752 expect().assertFail() 3753 } 3754 console.info(msgStr + 'Succeeded in minimizing the window.'); 3755 expect(true).assertTrue() 3756 wnd.destroy((err) => { 3757 if (err.code) { 3758 console.error(msgStr + ' Failed to destroy the window. err:' + JSON.stringify(err)); 3759 return 3760 } 3761 console.info(msgStr + 'Succeeded in destroying the window.'); 3762 }); 3763 done(); 3764 }); 3765 } catch (err) { 3766 console.error(msgStr + 'catched Failed to minimize the window. Cause: ' + JSON.stringify(err)+'errCode'+ err.code); 3767 wnd.destroy((err) => { 3768 if (err.code) { 3769 console.error(msgStr + ' Failed to destroy the window. err:' + JSON.stringify(err)); 3770 return 3771 } 3772 console.info(msgStr + 'Succeeded in destroying the window.'); 3773 }); 3774 if(err.code == 801){ 3775 done(); 3776 }else{ 3777 expect().assertFail(); 3778 done(); 3779 } 3780 } 3781 3782 }, (err) => { 3783 console.log(msgStr + ' wnd.show failed, err :' + JSON.stringify(err)); 3784 expect().assertFail(); 3785 done(); 3786 }) 3787 }, (err) => { 3788 console.log(msgStr + ' wnd.isShowing failed, err :' + JSON.stringify(err)); 3789 expect().assertFail(); 3790 done(); 3791 }) 3792 }, (err_resetSize) => { 3793 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize)); 3794 }) 3795 }) 3796 }) 3797 3798 /** 3799 * @tc.number : SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1200 3800 * @tc.name : testMinimize_Function_Promise 3801 * @tc.desc : test the function of minimize promise 3802 * @tc.size : MediumTest 3803 * @tc.type : Function 3804 * @tc.level : Level4 3805 */ 3806 it('testMinimize_Function_Promise', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { 3807 let msgStr = 'testMinimize_Function_Promise'; 3808 console.log(msgStr + ' begin'); 3809 window.create('subWindow12', window.WindowType.TYPE_APP).then(wnd => { 3810 expect(wnd != null).assertTrue(); 3811 console.log(msgStr + ' wnd.resetSize(400, 400) begin'); 3812 wnd.resetSize(400, 400).then(() => { 3813 console.log(msgStr + ' wnd.resetSize(400, 400) success'); 3814 wnd.isShowing().then(res => { 3815 console.log(msgStr + ' wnd.isShowing data:' + res); 3816 expect(!res).assertTrue(); 3817 wnd.show().then(() => { 3818 console.info(msgStr + 'show come in....'); 3819 try { 3820 let promise = wnd.minimize(); 3821 promise.then(() => { 3822 console.info(msgStr + 'Succeeded in minimizing the window.'); 3823 expect(true).assertTrue() 3824 wnd.destroy((err) => { 3825 if (err.code) { 3826 console.error(msgStr + ' Failed to destroy the window. err:' + JSON.stringify(err)); 3827 return 3828 } 3829 console.info(msgStr + 'Succeeded in destroying the window.'); 3830 }); 3831 done(); 3832 }).catch((err) => { 3833 console.error(msgStr + 'Failed to minimize the window. Cause: ' + JSON.stringify(err)); 3834 expect().assertFail() 3835 done(); 3836 }); 3837 } catch (err) { 3838 console.error(msgStr + 'catched Failed to minimize the window. Cause: ' + JSON.stringify(err)+'errCode'+ err.code); 3839 wnd.destroy((err) => { 3840 if (err.code) { 3841 console.error(msgStr + ' Failed to destroy the window. err:' + JSON.stringify(err)); 3842 return 3843 } 3844 console.info(msgStr + 'Succeeded in destroying the window.'); 3845 }); 3846 if(err.code == 801){ 3847 done(); 3848 }else{ 3849 expect().assertFail(); 3850 done(); 3851 } 3852 } 3853 3854 }, (err) => { 3855 console.log(msgStr + ' wnd.show failed, err :' + JSON.stringify(err)); 3856 expect().assertFail(); 3857 done(); 3858 }) 3859 }, (err) => { 3860 console.log(msgStr + ' wnd.isShowing failed, err :' + JSON.stringify(err)); 3861 expect().assertFail(); 3862 done(); 3863 }) 3864 }, (err_resetSize) => { 3865 console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize)); 3866 }) 3867 }) 3868 }) 3869 3870 3871 /** 3872 * @tc.number : SUB_BASIC_WMS_SPCIAL_XTS_STANDARD_JS_API_1210 3873 * @tc.name : testWindowStatusType_attr 3874 * @tc.desc : test the enum value of WindowStatusType 3875 * @tc.size : MediumTest 3876 * @tc.type : Function 3877 * @tc.level : Level4 3878 */ 3879 it('testWindowStatusType_attr', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) { 3880 let msgStr = 'testWindowStatusType_attr'; 3881 console.log(msgStr + ' begin'); 3882 try { 3883 if (window.WindowStatusType) { 3884 expect(window.WindowStatusType.UNDEFINED).assertEqual(0); 3885 expect(window.WindowStatusType.FULL_SCREEN).assertEqual(1); 3886 expect(window.WindowStatusType.MAXIMIZE).assertEqual(2); 3887 expect(window.WindowStatusType.MINIMIZE).assertEqual(3); 3888 expect(window.WindowStatusType.FLOATING).assertEqual(4); 3889 expect(window.WindowStatusType.SPLIT_SCREEN).assertEqual(5); 3890 done(); 3891 } else { 3892 console.log(msgStr + 'WindowStatusType is not calleble') 3893 expect(false).assertTrue(); 3894 done(); 3895 } 3896 3897 } catch(err) { 3898 if (err.code) { 3899 console.log(msgStr + "failed to test enum value" + JSON.stringify(err)) 3900 expect().assertFail() 3901 done(); 3902 } else { 3903 expect(true).assertTrue() 3904 console.log(msgStr + "failed to test enum value" + JSON.stringify(err)) 3905 done() 3906 } 3907 } 3908 3909 }) 3910 3911 }) 3912} 3913