window.test.js 85.6 KB
Newer Older
M
mamingshuai 已提交
1
/*
2
 * Copyright (C) 2022 Huawei Device Co., Ltd.
M
mamingshuai 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import window from '@ohos.window'
18
import screen from '@ohos.screen'
19
import display from '@ohos.display'
20
const TRUE_WINDOW = true;
21
const avoidAreaType = 3;
M
mamingshuai 已提交
22

23
describe('window_test', function () {
M
mamingshuai 已提交
24
    var wnd;
25
    var topWindow;
26
    const DELAY_TIME = 3000;
27
    var height;
28

29 30 31 32 33 34 35 36
    function windowSizeChangeCallback(data) {
        console.log('windowTest OnOffTest1 callback  ' + JSON.stringify(data));
		height = data.height;
    }
	
	function systemAvoidAreaChangeCallback(data) {
        console.log('windowTest OnOffTest2 callback  ' + JSON.stringify(data));
		height = data.bottomRect.height;
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    }

    beforeAll(function (done) {
        console.log('windowTest beforeAll begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest beforeAll window.getTopWindow wnd: ' + wnd);
            if (wnd) {
                topWindow = wnd;
            } else {
                console.log('windowTest beforeAll window.getTopWindow empty');
            }
        }, (err) => {
            console.log('windowTest beforeAll window.getTopWindow failed, err : ' + JSON.stringify(err));
        })
        setTimeout(() => {
            done();
        }, 5000);
M
mamingshuai 已提交
54
    })
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
    beforeEach(function (done) {
        if (topWindow) {
            topWindow.show().then(() => {
                console.log('windowTest beforeEach wnd.show success');
                topWindow.getProperties().then(data => {
                    if (data.isFullScreen) {
                        topWindow.setFullScreen(false).then(() => {
                            console.log('windowTest beforeEach wnd.setFullScreen(false) success');
                        }, (err) => {
                            console.log('windowTest beforeEach wnd.getProperties failed, err : ' + JSON.stringify(err));
                        })
                    }
                }, (err) => {
                    console.log('windowTest beforeEach wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err));
                })
            }, (err) => {
                console.log('windowTest beforeEach wnd.show failed, err : ' + JSON.stringify(err));
            })
            setTimeout(() => {
                done();
            }, DELAY_TIME);
        } else {
            done();
        }
M
mamingshuai 已提交
79
    })
80
    afterEach(function () {
M
mamingshuai 已提交
81
    })
82
    afterAll(function () {
M
mamingshuai 已提交
83
    })
84

M
mamingshuai 已提交
85
    /**
86 87 88 89 90 91
	 * @tc.number     SUB_WMS_GETPROPERTIES_JSAPI_001
	 * @tc.name       Test getProperties_Test_001
	 * @tc.desc       Get the current application main window properties
	 */
    it('getProperties_Test_001', 0, async function (done) {
        console.log('windowTest getPropertiesTest1 begin');
M
mamingshuai 已提交
92
        window.getTopWindow().then(wnd => {
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
            console.log('windowTest getPropertiesTest1 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.getProperties().then((data) => {
                console.log('windowTest getPropertiesTest1 wnd.getProperties success, data : ' + JSON.stringify(data));
                expect(data.type != null).assertTrue();
                expect(data.windowRect != null).assertTrue();
                expect(!data.isFullScreen).assertTrue();
                expect(!data.isLayoutFullScreen).assertTrue();
                expect(data.focusable).assertTrue();
                expect(data.touchable).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest getPropertiesTest1 wnd.getProperties failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest getPropertiesTest1 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
113 114
        })
    })
115

M
mamingshuai 已提交
116
    /**
117 118 119 120 121 122
     * @tc.number    SUB_WMS_GETPROPERTIES_JSAPI_002
     * @tc.name      Test getProperties_Test_002
     * @tc.desc      Get the current application main window properties
     */
    it('getProperties_Test_002', 0, async function (done) {
        console.log('windowTest GetPropertiesTest2 begin');
M
mamingshuai 已提交
123
        window.getTopWindow().then(wnd => {
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
            console.log('windowTest GetPropertiesTest2 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.getProperties((err, data) => {
                if (err.code != 0) {
                    console.log('windowTest GetPropertiesTest2 window.getProperties callback fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    expect(data.type != null).assertTrue();
                    expect(data.windowRect != null).assertTrue();
                    expect(!data.isFullScreen).assertTrue();
                    expect(!data.isLayoutFullScreen).assertTrue();
                    expect(data.focusable).assertTrue();
                    expect(data.touchable).assertTrue();
                    done();
                }
M
mamingshuai 已提交
140
            })
141 142 143 144
        }, (err) => {
            console.log('windowTest getPropertiesTest2 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
145 146
        })
    })
147

M
mamingshuai 已提交
148
    /**
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
	 * @tc.number     SUB_WMS_GETAVOIDAREA_JSAPI_001
	 * @tc.name       Test getAvoidArea_Test_001
	 * @tc.desc       Get SystemUI type avoidance area
	 */
    it('getAvoidArea_Test_001', 0, async function (done) {
        console.log('windowTest getAvoidAreaTest1 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest getAvoidAreaTest1 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.getAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).then((data) => {
                console.log('windowTest getAvoidAreaTest1 wnd.getAvoidArea success, data :' + JSON.stringify(data));
                expect(data.rightRect != null).assertTrue();
                expect(data.topRect != null).assertTrue();
                expect(data.bottomRect != null).assertTrue();
                expect(data.leftRect != null).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest getAvoidAreaTest1 wnd.getAvoidArea failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest getAvoidAreaTest1 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
	 * @tc.number     SUB_WMS_GETAVOIDAREA_JSAPI_002
	 * @tc.name       Test getAvoidArea_Test_002
	 * @tc.desc       Get Notch type avoidance area
	 */
    it('getAvoidArea_Test_002', 0, async function (done) {
        console.log('windowTest getAvoidAreaTest2 begin');
M
mamingshuai 已提交
184
        window.getTopWindow().then(wnd => {
185 186 187 188 189 190 191 192 193 194 195 196 197
            console.log('windowTest getAvoidAreaTest2 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.getAvoidArea(window.AvoidAreaType.TYPE_CUTOUT).then((data) => {
                console.log('windowTest getAvoidAreaTest2 wnd.getAvoidArea success, data :' + JSON.stringify(data));
                expect(data.rightRect != null).assertTrue();
                expect(data.topRect != null).assertTrue();
                expect(data.bottomRect != null).assertTrue();
                expect(data.leftRect != null).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest getAvoidAreaTest2 wnd.getAvoidArea failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
198
            })
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
        }, (err) => {
            console.log('windowTest getAvoidAreaTest2 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
	 * @tc.number     SUB_WMS_GETAVOIDAREA_JSAPI_003
	 * @tc.name       Test getAvoidArea_Test_003
	 * @tc.desc       Get system gesture type avoidance area
	 */
    it('getAvoidArea_Test_003', 0, async function (done) {
        console.log('windowTest getAvoidAreaTest3 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest getAvoidAreaTest3 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
216
            wnd.getAvoidArea(avoidAreaType).then((data) => {
217 218 219 220 221 222 223 224 225 226
                console.log('windowTest getAvoidAreaTest3 wnd.getAvoidArea success, data :' + JSON.stringify(data));
                expect(data.rightRect != null).assertTrue();
                expect(data.topRect != null).assertTrue();
                expect(data.bottomRect != null).assertTrue();
                expect(data.leftRect != null).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest getAvoidAreaTest3 wnd.getAvoidArea failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
227
            })
228 229 230 231
        }, (err) => {
            console.log('windowTest getAvoidAreaTest3 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
232 233
        })
    })
234

M
mamingshuai 已提交
235
    /**
236 237 238 239 240 241
     * @tc.number    SUB_WMS_GETAVOIDAREA_JSAPI_004
     * @tc.name      Test getAvoidArea_Test_004
     * @tc.desc      Get System type avoidance area
     */
    it('getAvoidArea_Test_004', 0, async function (done) {
        console.log('windowTest getAvoidAreaTest4 begin');
M
mamingshuai 已提交
242
        window.getTopWindow().then(wnd => {
243 244 245 246 247 248 249 250 251 252 253 254 255 256
            console.log('windowTest getAvoidAreaTest4 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.getAvoidArea(window.AvoidAreaType.TYPE_SYSTEM, (err, data) => {
                if (err.code != 0) {
                    console.log('windowTest getAvoidAreaTest4 wnd.getAvoidArea callback fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    expect(data.topRect != null).assertTrue();
                    expect(data.rightRect != null).assertTrue();
                    expect(data.bottomRect != null).assertTrue();
                    expect(data.leftRect != null).assertTrue();
                    done();
                }
M
mamingshuai 已提交
257 258 259
            })
        })
    })
260

M
mamingshuai 已提交
261
    /**
262 263 264 265 266 267
     * @tc.number    SUB_WMS_GETAVOIDAREA_JSAPI_005
     * @tc.name      Test getAvoidArea_Test_005
     * @tc.desc      Get Cutout type avoidance area
     */
    it('getAvoidArea_Test_005', 0, async function (done) {
        console.log('windowTest getAvoidAreaTest5 begin');
M
mamingshuai 已提交
268
        window.getTopWindow().then(wnd => {
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
            console.log('windowTest getAvoidAreaTest5 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.getAvoidArea(window.AvoidAreaType.TYPE_CUTOUT, (err, data) => {
                if (err.code != 0) {
                    console.log('windowTest getAvoidAreaTest5 wnd.getAvoidArea callback fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    expect(data.topRect != null).assertTrue();
                    expect(data.rightRect != null).assertTrue();
                    expect(data.bottomRect != null).assertTrue();
                    expect(data.leftRect != null).assertTrue();
                    console.log('windowTest getAvoidAreaTest5 wnd.getAvoidArea callback end');
                    done();
                }
M
mamingshuai 已提交
284
            })
285 286 287 288
        }, (err) => {
            console.log('windowTest getAvoidAreaTest5 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
289 290
        })
    })
291

M
mamingshuai 已提交
292
    /**
293 294 295 296 297 298
     * @tc.number    SUB_WMS_GETAVOIDAREA_JSAPI_006
     * @tc.name      Test getAvoidArea_Test_006
     * @tc.desc      Get system gesture type avoidance area
     */
    it('getAvoidArea_Test_006', 0, async function (done) {
        console.log('windowTest getAvoidAreaTest6 begin');
M
mamingshuai 已提交
299
        window.getTopWindow().then(wnd => {
300 301
            console.log('windowTest getAvoidAreaTest6 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
302
            wnd.getAvoidArea(avoidAreaType, (err, data) => {
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
                if (err.code != 0) {
                    console.log('windowTest getAvoidAreaTest6 wnd.getAvoidArea callback fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    expect(data.topRect != null).assertTrue();
                    expect(data.rightRect != null).assertTrue();
                    expect(data.bottomRect != null).assertTrue();
                    expect(data.leftRect != null).assertTrue();
                    done();
                }
            })
        }, (err) => {
            console.log('windowTest getAvoidAreaTest6 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
	 * @tc.number     SUB_WMS_SETFULLSCREEN_JSAPI_001
	 * @tc.name       Test setFullScreen_Test_001
	 * @tc.desc       Set the window to be non-fullscreen first and then fullscreen
	 */
    it('setFullScreen_Test_001', 0, async function (done) {
        console.log('windowTest setFullScreenTest1 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest setFullScreenTest1 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(false).then(() => {
                wnd.getProperties().then((data) => {
                    console.log('windowTest setFullScreenTest1 wnd.getProperties success, data : ' + JSON.stringify(data));
                    expect(data != null).assertTrue();
                    expect(!data.isFullScreen).assertTrue();
                    wnd.setFullScreen(true).then(() => {
                        wnd.getProperties().then((data) => {
                            console.log('windowTest setFullScreenTest1 wnd.getProperties success, data : ' + JSON.stringify(data));
                            expect(data != null).assertTrue();
                            expect(data.isFullScreen).assertTrue();
                            done();
                        }, (err) => {
                            console.log('windowTest setFullScreenTest1 wnd.getProperties failed, err : ' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
                        console.log('windowTest setFullScreenTest1 wnd.setFullScreen(true) failed, err : ' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
                    console.log('windowTest setFullScreenTest1 wnd.getProperties failed, err : ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
            }, (err) => {
                console.log('windowTest setFullScreenTest1 wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest setFullScreenTest1 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number    SUB_WMS_SETFULLSCREEN_JSAPI_002
     * @tc.name      Test setFullScreen_Test_002
     * @tc.desc      Set the window to be non-fullscreen first and then fullscreen.
     */
    it('setFullScreen_Test_002', 0, async function (done) {
        window.getTopWindow().then(wnd => {
            console.log('windowTest SetFullScreenTest2 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(false, (err) => {
                if (err.code != 0) {
                    console.log('windowTest SetFullScreenTest2 window.setFullScreen(false) callback fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    wnd.getProperties((err, data) => {
                        if (err.code != 0) {
                            console.log('windowTest SetFullScreenTest2 window.getProperties callback fail' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        } else {
                            expect(!data.isFullScreen).assertTrue();
                            wnd.setFullScreen(true, (err) => {
                                if (err.code != 0) {
                                    console.log('windowTest SetFullScreenTest2 window.setFullScreen(true) callback fail' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                } else {
                                    wnd.getProperties((err, data) => {
                                        if (err.code != 0) {
                                            console.log('windowTest SetFullScreenTest2 window.getProperties callback fail' + JSON.stringify(err));
                                            expect().assertFail();
                                            done();
                                        } else {
                                            expect(data.isFullScreen).assertTrue();
                                            console.log('windowTest SetFullScreenTest2 window.getProperties callback end');
                                            done();
                                        }
                                    })
                                }
                            })
                        }
                    })
                }
            })
        }, (err) => {
            console.log('windowTest setFullScreenTest1 window.getTopWindow fail : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
	 * @tc.number     SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_001
	 * @tc.name       Test setLayoutFullScreen_Test_001
	 * @tc.desc       Set window and layout to full screen
	 */
    it('setLayoutFullScreen_Test_001', 0, async function (done) {
        console.log('windowTest setLayoutFullScreenTest1 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest setLayoutFullScreenTest1 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(true).then(() => {
                wnd.getProperties().then((data) => {
                    console.log('windowTest setLayoutFullScreenTest1 wnd.getProperties success, data : ' + JSON.stringify(data));
                    expect(data.isFullScreen).assertTrue();
                    wnd.setLayoutFullScreen(true).then(() => {
                        wnd.getProperties().then((data) => {
                            console.log('windowTest setLayoutFullScreenTest1 wnd.getProperties success, data : ' + JSON.stringify(data));
                            expect(data != null).assertTrue();
                            expect(data.isLayoutFullScreen).assertTrue();
                            done();
                        }, (err) => {
                            console.log('windowTest setLayoutFullScreenTest1 wnd.getProperties failed, err : ' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
                        console.log('windowTest setLayoutFullScreenTest1 wnd.setLayoutFullScreen(true) failed, err : ' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
                    console.log('windowTest setLayoutFullScreenTest1 wnd.getProperties failed, err : ' + JSON.stringify(err));
                    expect().assertFail();
M
mamingshuai 已提交
455
                })
456 457 458 459 460 461 462 463 464 465 466 467 468
            }, (err) => {
                console.log('windowTest setLayoutFullScreenTest1 wnd.setFullScreen(true) failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest setLayoutFullScreenTest1 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
469
     * @tc.number    SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_002
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843
     * @tc.name      Test setLayoutFullScreen_Test_002
     * @tc.desc      Set window and layout to full screen.
     */
    it('setLayoutFullScreen_Test_002', 0, async function (done) {
        console.log('windowTest SetLayoutFullScreenTest2 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest SetLayoutFullScreenTest2 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(true, (err) => {
                console.log('windowTest SetLayoutFullScreenTest2 wnd.setFullScreen(true) callback begin');
                if (err.code != 0) {
                    console.log('windowTest SetLayoutFullScreenTest2 wnd.setFullScreen callback fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    wnd.getProperties((err, data) => {
                        if (err.code != 0) {
                            console.log('windowTest SetLayoutFullScreenTest2 wnd.getProperties callback fail' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        } else {
                            expect(data.isFullScreen).assertTrue();
                            wnd.setLayoutFullScreen(true, (err) => {
                                if (err.code != 0) {
                                    console.log('windowTest SetLayoutFullScreenTest2 wnd.setLayoutFullScreen callback fail' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                } else {
                                    wnd.getProperties((err, data) => {
                                        if (err.code != 0) {
                                            console.log('windowTest SetLayoutFullScreenTest2 wnd.getProperties callback fail' + JSON.stringify(err));
                                            expect().assertFail();
                                            done();
                                        } else {
                                            console.log('windowTest SetLayoutFullScreenTest2 wnd.getProperties callback end');
                                            expect(data.isLayoutFullScreen).assertTrue();
                                            done();
                                        }
                                    })
                                }
                            })
                        }

                    })
                }
            })
        }, (err) => {
            console.log('windowTest SetLayoutFullScreenTest2 window.getTopWindow fail : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
	 * @tc.number     SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_003
	 * @tc.name       Test setLayoutFullScreen_Test_003
	 * @tc.desc       Set the window to full screen, the layout is not full screen
	 */
    it('setLayoutFullScreen_Test_003', 0, async function (done) {
        console.log('windowTest setLayoutFullScreenTest3 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest setLayoutFullScreenTest3 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(true).then(() => {
                wnd.getProperties().then((data) => {
                    console.log('windowTest setLayoutFullScreenTest3 wnd.getProperties success, data : ' + JSON.stringify(data));
                    expect(data.isFullScreen).assertTrue();
                    wnd.setLayoutFullScreen(false).then(() => {
                        wnd.getProperties().then((data) => {
                            console.log('windowTest setLayoutFullScreenTest3 wnd.getProperties success, data : ' + JSON.stringify(data));
                            expect(data != null).assertTrue();
                            expect(!data.isLayoutFullScreen).assertTrue();
                            done();
                        }, (err) => {
                            console.log('windowTest setLayoutFullScreenTest3 wnd.getProperties failed, err : ' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
                        console.log('windowTest setLayoutFullScreenTest3 wnd.setLayoutFullScreen(false) failed, err : ' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
                    console.log('windowTest setLayoutFullScreenTest3 wnd.getProperties failed, err : ' + JSON.stringify(err));
                    expect().assertFail();
                })
            }, (err) => {
                console.log('windowTest setLayoutFullScreenTest3 wnd.setFullScreen(true) failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest setLayoutFullScreenTest3 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number    SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_004
     * @tc.name      Test setLayoutFullScreen_Test_004
     * @tc.desc      Set the window to full screen, the layout is not full screen
     */
    it('setLayoutFullScreen_Test_004', 0, async function (done) {
        console.log('windowTest SetLayoutFullScreenTest4 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest SetLayoutFullScreenTest4 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(true, (err) => {
                if (err.code != 0) {
                    console.log('windowTest SetLayoutFullScreenTest4 wnd.setFullScreen(true) callback fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    wnd.getProperties((err, data) => {
                        if (err.code != 0) {
                            console.log('windowTest SetLayoutFullScreenTest4 wnd.getProperties callback fail' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        } else {
                            expect(data.isFullScreen).assertTrue();
                            wnd.setLayoutFullScreen(false, (err) => {
                                if (err.code != 0) {
                                    console.log('windowTest SetLayoutFullScreenTest4 wnd.setLayoutFullScreen(false) callback fail' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                } else {
                                    wnd.getProperties((err, data) => {
                                        if (err.code != 0) {
                                            console.log('windowTest SetLayoutFullScreenTest4 wnd.getProperties callback fail' + JSON.stringify(err));
                                            expect().assertFail();
                                            done();
                                        } else {
                                            console.log('windowTest SetLayoutFullScreenTest4 wnd.getProperties callback end');
                                            expect(!data.isLayoutFullScreen).assertTrue();
                                            done();
                                        }
                                    })
                                }
                            })
                        }
                    })
                }
            })
        }, (err) => {
            console.log('windowTest SetLayoutFullScreenTest4 window.getTopWindow fail : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
	 * @tc.number     SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_005
	 * @tc.name       Test setLayoutFullScreen_Test_005
	 * @tc.desc       Set the window to be non-full-screen and the layout to be full-screen
	 */
    it('setLayoutFullScreen_Test_005', 0, async function (done) {
        console.log('windowTest setLayoutFullScreenTest5 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest setLayoutFullScreenTest5 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(false).then(() => {
                wnd.getProperties().then((data) => {
                    console.log('windowTest setLayoutFullScreenTest5 wnd.getProperties success, data : ' + JSON.stringify(data));
                    expect(data != null).assertTrue();
                    expect(!data.isFullScreen).assertTrue();
                    wnd.setLayoutFullScreen(true).then(() => {
                        wnd.getProperties().then((data) => {
                            console.log('windowTest setLayoutFullScreenTest5 wnd.getProperties success, data : ' + JSON.stringify(data));
                            expect(data.isLayoutFullScreen).assertTrue();
                            done();
                        }, (err) => {
                            console.log('windowTest setLayoutFullScreenTest5 wnd.getProperties failed, err : ' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
                        console.log('windowTest setLayoutFullScreenTest5 wnd.setLayoutFullScreen(true) failed, err : ' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
                    console.log('windowTest setLayoutFullScreenTest5 wnd.getProperties failed, err : ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
            }, (err) => {
                console.log('windowTest setLayoutFullScreenTest5 wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest setLayoutFullScreenTest5 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number    SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_006
     * @tc.name      Test setLayoutFullScreen_Test_006
     * @tc.desc      Set the window to be non-full-screen and the layout to be full-screen.
     */
    it('setLayoutFullScreen_Test_006', 0, async function (done) {
        console.log('windowTest SetLayoutFullScreenTest6 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest SetLayoutFullScreenTest6 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(false, (err) => {
                if (err.code != 0) {
                    console.log('windowTest SetLayoutFullScreenTest6 wnd.setFullScreen fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    wnd.getProperties((err, data) => {
                        if (err.code != 0) {
                            console.log('windowTest SetLayoutFullScreenTest6 wnd.getProperties fail' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        } else {
                            expect(!data.isFullScreen).assertTrue();
                            wnd.setLayoutFullScreen(true, (err) => {
                                if (err.code != 0) {
                                    console.log('windowTest SetLayoutFullScreenTest6 wnd.setLayoutFullScreen fail' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                } else {
                                    wnd.getProperties((err, data) => {
                                        if (err.code != 0) {
                                            console.log('windowTest SetLayoutFullScreenTest6 wnd.getProperties fail' + JSON.stringify(err));
                                            expect().assertFail();
                                            done();
                                        } else {
                                            expect(data.isLayoutFullScreen).assertTrue();
                                            done();
                                        }
                                    })
                                }
                            })
                        }
                    })
                }
            })
        }, (err) => {
            console.log('windowTest SetLayoutFullScreenTest6 window.getTopWindow fail : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
	 * @tc.number     SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_007
	 * @tc.name       Test setLayoutFullScreen_Test_007
	 * @tc.desc       Setting windows and layouts to be non-fullscreen
	 */
    it('setLayoutFullScreen_Test_007', 0, async function (done) {
        console.log('windowTest setLayoutFullScreenTest7 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest setLayoutFullScreenTest7 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(false).then(() => {
                wnd.getProperties().then((data) => {
                    console.log('windowTest setLayoutFullScreenTest7 wnd.getProperties success, data : ' + JSON.stringify(data));
                    expect(!data.isFullScreen).assertTrue();
                    wnd.setLayoutFullScreen(false).then(() => {
                        wnd.getProperties().then((data) => {
                            console.log('windowTest setLayoutFullScreenTest7 wnd.getProperties success, data : ' + JSON.stringify(data));
                            expect(!data.isLayoutFullScreen).assertTrue();
                            done();
                        }, (err) => {
                            console.log('windowTest setLayoutFullScreenTest7 wnd.getProperties failed, err : ' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
                        console.log('windowTest setLayoutFullScreenTest7 wnd.setLayoutFullScreen(false) failed, err : ' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
                    console.log('windowTest setLayoutFullScreenTest7 wnd.getProperties failed, err : ' + JSON.stringify(err));
                    expect().assertFail();
                })
            }, (err) => {
                console.log('windowTest setLayoutFullScreenTest7 wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest setLayoutFullScreenTest7 window.getTopWindow failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number    SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_008
     * @tc.name      Test setLayoutFullScreen_Test_008
     * @tc.desc      Setting window and layouts to be non-fullscreen.
     */
    it('setLayoutFullScreen_Test_008', 0, async function (done) {
        console.log('windowTest SetLayoutFullScreenTest8 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest SetLayoutFullScreenTest8 window.getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setFullScreen(false, (err) => {
                if (err.code != 0) {
                    console.log('windowTest SetLayoutFullScreenTest8 window.setFullScreen callback fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    wnd.getProperties((err, data) => {
                        if (err.code != 0) {
                            console.log('windowTest SetLayoutFullScreenTest8 window.getProperties callback fail' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        } else {
                            expect(!data.isFullScreen).assertTrue();
                            wnd.setLayoutFullScreen(false, (err) => {
                                if (err.code != 0) {
                                    console.log('windowTest SetLayoutFullScreenTest8 window.setLayoutFullScreen callback fail' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                } else {
                                    wnd.getProperties((err, data) => {
                                        if (err.code != 0) {
                                            console.log('windowTest SetLayoutFullScreenTest8 window.getProperties callback fail' + JSON.stringify(err));
                                            expect().assertFail();
                                            done();
                                        } else {
                                            expect(!data.isLayoutFullScreen).assertTrue();
                                            done();
                                        }
                                    })
                                }
                            })
                        }
                    })
                }
            })
        }, (err) => {
            console.log('windowTest setLayoutFullScreen_Test_008 window.getTopWindow fail : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })


    /**
	 * @tc.number     SUB_WMS_FIND_JSAPI_001
	 * @tc.name       Test find_Test_001
	 * @tc.desc       Query main window
	 */
    it('find_Test_001', 0, async function (done) {
        console.log('windowTest findTest1 begin');
        window.find('window0').then((data) => {
            console.log('windowTest findTest1 wnd.find success, data : ' + JSON.stringify(data));
            expect(data != null).assertTrue();
            done();
        }, (err) => {
            console.log('windowTest findTest1 wnd.find failed, err : ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
	 * @tc.number     SUB_WMS_FIND_JSAPI_002
	 * @tc.name       Test find_Test_002
	 * @tc.desc       Query for non-existing windows
	 */
    it('find_Test_002', 0, async function (done) {
        console.log('windowTest findTest2 begin');
844
        window.find('window').then((window) => {
845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870
            console.log('windowTest findTest2 wnd.find success, window : ' + JSON.stringify(window));
            expect().assertFail();
            done();
        }, (err) => {
            console.log('windowTest findTest2 wnd.find failed, err : ' + JSON.stringify(err));
            expect(TRUE_WINDOW).assertTrue();
            done();
        })
    })

    /**
     * @tc.number    SUB_WMS_FIND_JSAPI_004
     * @tc.name      Test find_Test_003
     * @tc.desc      Query main window.
     */
    it('find_Test_003', 0, async function (done) {
        console.log('windowTest findTest3 begin');
        window.find('window0', (err, data) => {
            if (err.code) {
                console.log('windowTest findTest3 wnd.find fail, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            } else {
                console.log('windowTest findTest3 wnd.find fail');
                expect(data != null).assertTrue();
                done();
M
mamingshuai 已提交
871 872 873
            }
        })
    })
874

M
mamingshuai 已提交
875
    /**
876 877 878 879 880 881
     * @tc.number    SUB_WMS_FIND_JSAPI_004
     * @tc.name      Test find_Test_004
     * @tc.desc      Query for non-existing windows
     */
    it('find_Test_004', 0, async function (done) {
        console.log('windowTest findTest4 begin');
882
        window.find('window', (err, data) => {
883 884 885 886 887 888 889 890 891 892 893 894 895 896 897
            if (err.code) {
                console.log('windowTest findTest4 wnd.find fail, err : ' + JSON.stringify(err));
                expect(TRUE_WINDOW).assertTrue();
                done();
            } else {
                console.log('windowTest findTest4 wnd.find success');
                expect().assertFail();
                done();
            }
        })
    })


    /**
     * @tc.number    SUB_WMS_ONOFF_JSAPI_001
898
     * @tc.name      Test onOff_Test_001.
899 900
     * @tc.desc      To verify the function of enabling and disabling intercepting when the window size changes.
     */
901
    it('onOff_Test_001', 0, async function (done) {
902
        console.log('windowTest OnOffTest1 begin');
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939
	    display.getDefaultDisplay().then(dsp => {
            window.getTopWindow((err, data) => {
				if (err.code != 0) {
					console.log('windowTest OnOffTest1 getTopWindow  fail ' + JSON.stringify(err.code));
					expect().assertFail();
					done();
				} else {
					expect(data != null).assertTrue();
					data.on('windowSizeChange', windowSizeChangeCallback);
					data.setLayoutFullScreen(true, (err) => {
						if (err.code != 0) {
							console.log('windowTest OnOffTest1 setLayoutFullScreen  fail ' + JSON.stringify(err.code));
							expect().assertFail();
							done();
						} else {
							setTimeout((async function () {
								expect(dsp.height == height).assertTrue();
								data.off('windowSizeChange');
								data.setLayoutFullScreen(false, (err) => {
									if (err.code != 0) {
										console.log('windowTest OnOffTest1 setLayoutFullScreen callback fail ' + JSON.stringify(err));
										expect().assertFail();
										done();
									} else {
										expect(dsp.height == height).assertTrue();
										done();
									}
								})
							}), 3000)
						}
					})
				}
			})
        }, (err) => {
            console.log('displayTest OnOffTest1 getDefaultDisplay failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
940 941 942 943 944
        })
    })

    /**
     * @tc.number    SUB_WMS_ONOFF_JSAPI_002
945
     * @tc.name      Test onOff_Test_002
946 947
     * @tc.desc      To verify the function of enabling and disabling lawful interception in the system and window
     */
948
    it('onOff_Test_002', 0, async function (done) {
949
        console.log('windowTest OnOffTest2 begin');
950 951 952 953 954 955 956
        window.getTopWindow((err, data) => {
            if (err.code != 0) {
                console.log('windowTest OnOffTest2 getTopWindow callback fail ' + JSON.stringify(err.code));
                expect().assertFail();
                done();
            } else {
                expect(data != null).assertTrue();
957
                data.on('systemAvoidAreaChange', systemAvoidAreaChangeCallback);
958 959 960 961 962 963 964
                data.setFullScreen(true, (err) => {
                    if (err.code != 0) {
                        console.log('windowTest OnOffTest2 setLayoutFullScreen callback fail ' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        setTimeout((async function () {
965 966
                            expect(height == 0).assertTrue();
                            data.off('systemAvoidAreaChange');
967
                            data.setFullScreen(false, (err) => {
968
                                if (err.code != 0) {
969 970 971 972 973
                                    console.log('windowTest OnOffTest2 setLayoutFullScreen callback fail ' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                } else {
                                    console.log('windowTest OnOffTest2 off callback success');
974
                                    expect(height == 0).assertTrue();
975 976 977 978 979 980 981 982 983 984 985 986
                                    done();
                                }
                            })
                        }), 3000)
                    }
                })
            }
        })
    })

    /**
     * @tc.number      SUB_WMS_ISSHOWING_JSAPI_001
987
     * @tc.name        Test isShowing_Test_001.
988 989
     * @tc.desc        To verify the function of obtaining the display status when a window is hidden and then displayed.
     */
990
    it('isShowing_Test_001', 0, async function (done) {
991
        console.log('windowTest IsShowingTest1 begin');
992
        window.create('subWindow1', window.WindowType.TYPE_APP).then(wnd => {
993 994 995 996 997 998 999
            expect(wnd != null).assertTrue();
            wnd.isShowing().then(res => {
                console.log('windowTest IsShowingTest1 wnd.isShowing data:' + res);
                expect(!res).assertTrue();
                wnd.show().then(() => {
                    wnd.isShowing().then(res => {
                        expect(res).assertTrue();
1000
                        done();
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020
                    }, (err) => {
                        console.log('windowTest IsShowingTest1 wnd.isShowing failed, err :' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
                    console.log('windowTest IsShowingTest1 wnd.show failed, err :' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
            }, (err) => {
                console.log('windowTest IsShowingTest1 wnd.isShowing failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        })
    })

    /**
     * @tc.number    SUB_WMS_ISSHOWING_JSAPI_002
1021
     * @tc.name      Test isShowing_Test_002.
1022 1023
     * @tc.desc      To verify the function of obtaining the display status when a window is hidden and then displayed.
     */
1024
    it('isShowing_Test_002', 0, async function (done) {
1025
        console.log('windowTest IsShowingTest2 begin');
1026
        window.create('subWindow2', window.WindowType.TYPE_APP, (err, data) => {
1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052
            if (err.code) {
                console.log('windowTest IsShowingTest2 window.create fail err ' + JSON.stringify(err));
                expect().assertFail();
                done();
            } else {
                expect(data != null).assertTrue();
                data.isShowing((err, res1) => {
                    if (err.code) {
                        console.log('windowTest IsShowingTest2 data.isShowing fail err ' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        expect(!res1).assertTrue();
                        data.show(() => {
                            if (err.code) {
                                console.log('windowTest IsShowingTest2 data.show fail err ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            } else {
                                data.isShowing((err, res2) => {
                                    if (err.code) {
                                        console.log('windowTest IsShowingTest2 data.show fail err ' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    } else {
                                        expect(res2).assertTrue();
1053
                                        done();
1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065
                                    }
                                })
                            }
                        })
                    }
                })
            }
        })
    })

    /**
     * @tc.number      SUB_WMS_SETCOLORSPACE_JSAPI_001
1066
     * @tc.name        Test setColorSpace_Test_001
1067 1068
     * @tc.desc        To verify the setting of the wide color gamut color space
     */
1069
    it('setColorSpace_Test_001', 0, async function (done) {
1070 1071 1072 1073 1074 1075 1076
        console.log('windowTest SetColorSpaceTest1 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest SetColorSpaceTest1 wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setColorSpace(window.ColorSpace.WIDE_GAMUT).then(() => {
                console.log('windowTest SetColorSpaceTest1 setColorSpace WIDE_GAMUT');
                wnd.getColorSpace().then(res => {
1077
                    expect(res == window.ColorSpace.WIDE_GAMUT).assertTrue();
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105
                    console.log('windowTest SetColorSpaceTest1 setColorSpace WIDE_GAMUT success');
                    wnd.isSupportWideGamut().then(data => {
                        expect(data).assertTrue();
                        done();
                    }, (err) => {
                        console.log('windowTest SetColorSpaceTest1 wnd.isSupportWideGamut failed, err :' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
                    console.log('windowTest SetColorSpaceTest1 wnd.getColorSpace failed, err :' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
            }, (err) => {
                console.log('windowTest SetColorSpaceTest1 wnd.setColorSpace failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest SetColorSpaceTest1 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number      SUB_WMS_SETCOLORSPACE_JSAPI_002
1106
     * @tc.name        Test setColorSpace_Test_002
1107 1108
     * @tc.desc        To verify that the color space of invaild values is set successfully
     */
1109
    it('setColorSpace_Test_002', 0, async function (done) {
1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131
        console.log('windowTest SetColorSpaceTest2 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest SetColorSpaceTest2 wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setColorSpace(-5).then(() => {
                console.log('windowTest SetColorSpaceTest2 setColorSpace -5');
                expect().assertFail();
                done();
            },(err) => {
                console.log('windowTest SetColorSpaceTest2 wnd.setColorSpace failed, err :' + JSON.stringify(err));
                expect(err.code).assertEqual(130);
                done();
            })
        },(err) => {
            console.log('windowTest SetColorSpaceTest2 wnd.getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number    SUB_WMS_SETCOLORSPACE_JSAPI_003
1132
     * @tc.name      Test setColorSpace_Test_003
1133 1134
     * @tc.desc      To verify the setting of the wide color gamut color space
     */
1135
    it('setColorSpace_Test_003', 0, async function (done) {
1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151
        console.log('windowTest SetColorSpaceTest3 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest SetColorSpaceTest3 wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err) => {
                if (err.code != 0) {
                    console.log('windowTest SetColorSpaceTest3 setColorSpace  fail' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    wnd.getColorSpace((err, data) => {
                        if (err.code != 0) {
                            console.log('windowTest SetColorSpaceTest3 getColorSpace  fail ' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        } else {
1152
                            expect(data == window.ColorSpace.WIDE_GAMUT).assertTrue();
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175
                            wnd.isSupportWideGamut((err, data) => {
                                if (err.code != 0) {
                                    console.log('windowTest SetColorSpaceTest3 getColorSpace callback fail' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                } else {
                                    expect(data).assertTrue();
                                    done();
                                }
                            })
                        }
                    })
                }
            })
        }, (err) => {
            console.log('windowTest SetColorSpaceTest3 getTopWindow failed,err: ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number    SUB_WMS_SETCOLORSPACE_JSAPI_004
1176
     * @tc.name      Test setColorSpace_Test_004
1177 1178
     * @tc.desc      To verify that the color space of invalid values is set successfully
     */
1179
    it('setColorSpace_Test_004', 0, async function (done) {
1180
        console.log('windowTest SetColorSpaceTest4 begin');
M
mamingshuai 已提交
1181
        window.getTopWindow().then(wnd => {
1182 1183 1184 1185 1186 1187
            console.log('windowTest SetColorSpaceTest4 wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.setColorSpace(-5, (err) => {
                console.log('windowTest SetColorSpaceTest4 setColorSpace callback begin' + JSON.stringify(err));
                if (err.code != 0) {
                    console.log('windowTest SetColorSpaceTest4 setColorSpace callback fail' + JSON.stringify(err.code));
1188
                    expect(err.code).assertEqual(130);
1189 1190 1191 1192 1193
                    done();
                } else {
                    expect().assertFail();
                    done();
                }
M
mamingshuai 已提交
1194
            })
1195 1196 1197 1198 1199 1200 1201 1202 1203
        }, (err) => {
            console.log('windowTest SetColorSpaceTest4 getTopWindow failed,err: ' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number		SUB_WMS_CREATE_JSAPI_001
1204
     * @tc.name			Test create_Test_001.
1205 1206
     * @tc.desc			To verify the function of creating an application subwindow.
     */
1207
    it('create_Test_001', 0, async function (done) {
1208
        console.log('windowTest CreateTest1 begin');
1209
        window.create('subWindow3', window.WindowType.TYPE_APP).then(wnd => {
1210 1211 1212 1213 1214 1215 1216
            console.log('windowTest CreateTest1 create success wnd' + wnd);
            expect(wnd != null).assertTrue();
            done();
        }, (err) => {
            console.log('windowTest CreateTest1 create failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
1217 1218
        })
    })
1219

M
mamingshuai 已提交
1220
    /**
1221
     * @tc.number    SUB_WMS_CREATE_JSAPI_001
1222
     * @tc.name      Test create_Test_002
1223 1224
     * @tc.desc      To verify the function of creating an application subwindow
     */
1225
    it('create_Test_002', 0, async function (done) {
1226
        console.log('windowTest CreateTest2 begin');
1227
        window.create('subWindow4', window.WindowType.TYPE_APP, (err, data) => {
1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241
            if (err.code != 0) {
                console.log('windowTest CreateTest2 create callback fail' + JSON.stringify(err.code));
                expect().assertFail();
                done();
            } else {
                expect(data != null).assertTrue();
                console.log('windowTest CreateTest2 callback create success data' + data);
                done();
            }
        })
    })

    /**
     * @tc.number		SUB_WMS_DESTROY_JSAPI_001
1242
     * @tc.name			Test destroy_Test_001
1243 1244
     * @tc.desc			Verify that a window is destroyed after being created
     */
1245
    it('destroy_Test_001', 0, async function (done) {
1246
        console.log('windowTest DestroyTest1 begin');
1247
        window.create('subWindow5', window.WindowType.TYPE_APP).then(wnd => {
1248 1249 1250
            console.log('windowTest DestroyTest1 create success wnd' + wnd);
            expect(wnd != null).assertTrue();
            wnd.destroy().then(() => {
1251
                window.find('subWindow5').then((data) => {
1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274
                    console.log('windowTest DestroyTest1 window.find success, window :' + JSON.stringify(data));
                    expect().assertFail();
                    done();
                }, (err) => {
                    console.log('windowTest DestroyTest1 find failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(120);
                    done();
                })
            }, (err) => {
                console.log('windowTest CreateTest1 destroy failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest CreateTest1 create failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })


    /**
     * @tc.number    SUB_WMS_DESTROY_JSAPI_002
1275
     * @tc.name      Test destroy_Test_002
1276 1277
     * @tc.desc      Verify that a window is destroyed after being created
     */
1278
    it('destroy_Test_002', 0, async function (done) {
1279
        console.log('windowTest DestroyTest2 begin');
1280
        window.create('subWindow6', window.WindowType.TYPE_APP, (err, data) => {
1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292
            if (err.code != 0) {
                console.log('windowTest DestroyTest2 create callback fail' + JSON.stringify(err.code));
                expect().assertFail();
                done();
            } else {
                expect(data != null).assertTrue();
                data.destroy((err) => {
                    if (err.code != 0) {
                        console.log('windowTest DestroyTest2 create callback fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
1293
                        window.find('subWindow6', (err, data) => {
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312
                            console.log('windowTest DestroyTest2 find callback begin' + JSON.stringify(data));
                            if (err.code != 0) {
                                console.log('windowTest DestroyTest2 find callback fail' + JSON.stringify(err.code));
                                expect(err.code).assertEqual(120);
                                done();
                            } else {
                                console.log('windowTest DestroyTest2 find suceess,err : ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            }
                        })
                    }
                })
            }
        })
    })

    /**
     * @tc.number		SUB_WMS_SETSYSTEMBARENABLE_JSAPI_001
1313
     * @tc.name			Test setSystemBarEnable_Test_001
1314 1315
     * @tc.desc			To verify the function of setting a scenario that is visible to the system bar
     */
1316
    it('setSystemBarEnable_Test_001', 0, async function (done) {
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345
        console.log('windowTest SetSystemBarEnableTest1 begin');
        var names = ["status", "navigation"];
        window.getTopWindow().then(wnd => {
            expect(wnd != null).assertTrue();
            wnd.setLayoutFullScreen(true).then(() => {
                wnd.setSystemBarEnable(names).then(() => {
                    console.log('windowTest SetSystemBarEnableTest1 setSystemBarEnable success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log('windowTest SetSystemBarEnableTest1 setSystemBarEnable failed, err :' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
            }, (err) => {
                console.log('windowTest SetSystemBarEnableTest1 setLayoutFullScreen failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest SetSystemBarEnableTest1 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })


    /**
     * @tc.number    SUB_WMS_SETSYSTEMBARENABLE_JSAPI_002
1346
     * @tc.name      Test setSystemBarEnable_Test_002
1347 1348
     * @tc.desc      To verify the function of setting a scenario that is visible to the system bar
     */
1349
    it('setSystemBarEnable_Test_002', 0, async function (done) {
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375
        console.log('windowTest SetSystemBarEnableTest2 begin');
        var names = ["status", "navigation"];
        window.getTopWindow((err, data) => {
            if (err.code != 0) {
                console.log('windowTest SetSystemBarEnableTest2 getTopWindow fail: ' + JSON.stringify(err));
                expect().assertFail();
                done();
            } else {
                expect(data != null).assertTrue();
                data.setSystemBarEnable(names, (err) => {
                    if (err.code != 0) {
                        console.log('windowTest SetSystemBarEnableTest2 getTopWindow fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        console.log('windowTest SetSystemBarEnableTest2 setSystemBarEnable success');
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }
                })
            }
        })
    })

    /**
     * @tc.number		SUB_WMS_SETSYSTEMBARPROPERTIES_JSAPI_001
1376
     * @tc.name			Test setSystemBarProperties_Test_001
1377 1378
     * @tc.desc			To verify the function of setting system bar attributes
     */
1379
    it('setSystemBarProperties_Test_001', 0, async function (done) {
1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409
        console.log('windowTest SetSystemBarPropertiesTest1 begin');
        var SystemBarProperties = {
            statusBarColor: '#ff00ff',
            navigationBarColor: '#00ff00',
            isStatusBarLightIcon: true,
            isNavigationBarLightIcon: false,
            statusBarContentColor: '#ffffff',
            navigationBarContentColor: '#00ffff'
        };
        window.getTopWindow().then(wnd => {
            expect(wnd != null).assertTrue();
            wnd.setSystemBarProperties(SystemBarProperties).then(() => {
                console.log('windowTest SetSystemBarPropertiesTest1 setSystemBarProperties success ');
                expect(TRUE_WINDOW).assertTrue();
                done();
            },(err) => {
                console.log('windowTest SetSystemBarPropertiesTest1 setSystemBarProperties failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        },(err) => {
            console.log('windowTest SetSystemBarPropertiesTest1 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })


    /**
     * @tc.number    SUB_WMS_SETSYSTEMBARPROPERTIES_JSAPI_002
1410
     * @tc.name      Test setSystemBarProperties_Test_002
1411 1412
     * @tc.desc      To verify the function of setting system bar attributes
     */
1413
    it('setSystemBarProperties_Test_002', 0, async function (done) {
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471
        console.log('windowTest SetSystemBarPropertiesTest2 begin');
        var SystemBarProperties = {
            statusBarColor: '#ff00ff',
            navigationBarColor: '#00ff00',
            isStatusBarLightIcon: true,
            isNavigationBarLightIcon: false,
            statusBarContentColor: '#ffffff',
            navigationBarContentColor: '#00ffff'
        };
        window.getTopWindow((err, data) => {
            if (err.code != 0) {
                console.log('windowTest SetSystemBarPropertiesTest2 getTopWindow fail: ' + JSON.stringify(err));
                expect().assertFail();
                done();
            } else {
                expect(data != null).assertTrue();
                data.setSystemBarProperties(SystemBarProperties, (err) => {
                    if (err.code != 0) {
                        console.log('windowTest SetSystemBarPropertiesTest2 setSystemBarProperties fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }
                })
            }
        })
    })


    /**
     * @tc.number    SUB_WMS_MOVETO_JSAPI_007
     * @tc.name      Test move_Test_001
     * @tc.desc      Verify the scene where the window moves
     */
    it('move_Test_001', 0, function () {
        console.log('windowTest moveTest1 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest moveTest1 getTopWindow wnd' + wnd);
            expect(wnd != null).assertTrue();
            wnd.moveTo(200, 200, (err) => {
                if (err.code) {
                    console.log('windowTest moveTest1 moveTo callback fail' + JSON.stringify(err.code));
                    expect().assertFail();
                    done();
                } else {
                    console.log('windowTest moveTest1 moveTo callback success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }
            })
        })
    })
    /**
    * @tc.number     SUB_WMS_MOVETO_JSAPI_002
    * @tc.name       Test move_Test_002
    * @tc.desc       Verify the scene where the window moves
M
mamingshuai 已提交
1472
    */
1473 1474
    it('move_Test_002', 0, async function (done) {
        console.log('windowTest moveTest2 begin');
M
mamingshuai 已提交
1475
        window.getTopWindow().then(wnd => {
1476 1477 1478 1479 1480 1481 1482 1483 1484 1485
            console.log('windowTest moveTest2 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.moveTo(100, 100).then(() => {
                console.log('windowTest moveTest2 wnd.moveTo success');
                expect(TRUE_WINDOW).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest moveTest2 wnd.moveTo failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1486
            })
1487 1488 1489 1490
        }, (err) => {
            console.log('windowTest moveTest2 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
1491 1492
        })
    })
1493

M
mamingshuai 已提交
1494
    /**
1495 1496 1497
    * @tc.number     SUB_WMS_MOVETO_JSAPI_003
    * @tc.name       Test move_Test_003
    * @tc.desc       Verify the scene where the window moves
M
mamingshuai 已提交
1498
    */
1499 1500
    it('move_Test_003', 0, async function (done) {
        console.log('windowTest moveTest3 begin');
M
mamingshuai 已提交
1501
        window.getTopWindow().then(wnd => {
1502 1503 1504 1505 1506 1507 1508 1509 1510 1511
            console.log('windowTest moveTest3 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.moveTo(20000, 20000).then(() => {
                console.log('windowTest moveTest3 wnd.moveTo success');
                expect(TRUE_WINDOW).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest moveTest3 wnd.moveTo failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1512
            })
1513 1514 1515 1516
        }, (err) => {
            console.log('windowTest moveTest3 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
1517 1518
        })
    })
1519

M
mamingshuai 已提交
1520
    /**
1521 1522 1523
    * @tc.number     SUB_WMS_MOVETO_JSAPI_004
    * @tc.name       Test move_Test_004
    * @tc.desc       Verify the scene where the window moves
M
mamingshuai 已提交
1524
    */
1525 1526
    it('move_Test_004', 0, async function (done) {
        console.log('windowTest moveTest4 begin');
M
mamingshuai 已提交
1527
        window.getTopWindow().then(wnd => {
1528 1529 1530 1531 1532 1533 1534 1535 1536 1537
            console.log('windowTest moveTest4 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.moveTo(-200, -200).then(() => {
                console.log('windowTest moveTest4 wnd.moveTo success');
                expect(TRUE_WINDOW).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest moveTest4 wnd.moveTo failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1538
            })
1539 1540 1541 1542
        }, (err) => {
            console.log('windowTest moveTest4 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
1543 1544
        })
    })
1545

M
mamingshuai 已提交
1546
    /**
1547 1548 1549
    * @tc.number     SUB_WMS_MOVETO_JSAPI_005
    * @tc.name       Test move_Test_005
    * @tc.desc       Verify that the window is moved into the normal scene
M
mamingshuai 已提交
1550
    */
1551 1552
    it('move_Test_005', 0, async function (done) {
        console.log('windowTest moveTest5 begin');
M
mamingshuai 已提交
1553
        window.getTopWindow().then(wnd => {
1554 1555
            console.log('windowTest moveTest5 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
M
mamingshuai 已提交
1556
            for (var i = 1; i <= 5; i++) {
1557 1558 1559 1560 1561 1562
                wnd.moveTo(100, 100).then(() => {
                    expect(TRUE_WINDOW).assertTrue();
                },(err) => {
                    console.log('windowTest moveTest5 wnd.moveTo failed, err :' + JSON.stringify(err));
                    expect().assertFail();
                    done();
M
mamingshuai 已提交
1563 1564
                })
            }
1565 1566 1567 1568 1569 1570
            console.log('windowTest moveTest5 end');
            done();
        }, (err) => {
            console.log('windowTest moveTest5 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
1571 1572
        })
    })
1573

M
mamingshuai 已提交
1574
    /**
1575 1576 1577
    * @tc.number     SUB_WMS_MOVETO_JSAPI_001
    * @tc.name       Test move_Test_006
    * @tc.desc       Verify that the window is moved into the normal scene
M
mamingshuai 已提交
1578
    */
1579 1580
    it('move_Test_006', 0, async function (done) {
        console.log('windowTest moveTest6 begin');
M
mamingshuai 已提交
1581
        window.getTopWindow().then(wnd => {
1582 1583 1584 1585 1586 1587 1588 1589 1590 1591
            console.log('windowTest moveTest6 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.moveTo(200, 200).then(() => {
                console.log('windowTest moveTest6 wnd.moveTo success');
                expect(TRUE_WINDOW).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest moveTest6 wnd.moveTo failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1592
            })
1593 1594 1595 1596
        }, (err) => {
            console.log('windowTest moveTest6 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
1597 1598
        })
    })
1599

M
mamingshuai 已提交
1600
    /**
1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660
	* @tc.number    SUB_WMS_MOVETO_JSAPI_007
	* @tc.name      Test move_Test_007
	* @tc.desc      Verify the scene where the window moves
	*/
    it('move_Test_007', 0, async function (done) {
        console.log('windowTest moveTestNegative begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest moveTestNegative getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.moveTo(-200, -200).then(() => {
                console.log('moveTo(-200,-200) success');
                expect(TRUE_WINDOW).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest moveTestNegative moveTo failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest moveTestNegative getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
	* @tc.number    SUB_WMS_MOVETO_JSAPI_008
	* @tc.name      Test move_Test_008
	* @tc.desc      Verify the scene where the window moves
	*/
    it('move_Test_008', 0, async function (done) {
        console.log('windowTest moveTest8 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest moveTest8 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.moveTo(-200, 200).then(() => {
                wnd.moveTo(200, -300).then(() => {
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log('windowTest moveTest8 create failed, err :' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
            }, (err) => {
                console.log('windowTest moveTest8 create failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        }, (err) => {
            console.log('windowTest moveTest8 create failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
    * @tc.number     SUB_WMS_RESETSIZE_JSAPI_001
    * @tc.name       Test resetSize_Test_001
    * @tc.desc       Verify the scene where the window resets size
M
mamingshuai 已提交
1661
    */
1662 1663
    it('resetSize_Test_001', 0, async function (done) {
        console.log('windowTest resetSizeTest1 begin');
M
mamingshuai 已提交
1664
        window.getTopWindow().then(wnd => {
1665 1666 1667 1668 1669 1670 1671 1672 1673 1674
            console.log('windowTest resetSizeTest1 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.resetSize(200, 600).then(() => {
                console.log('windowTest resetSizeTest1 wnd.resetSize(200, 600) success');
                expect(TRUE_WINDOW).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest resetSizeTest1 wnd.resetSize failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1675
            })
1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700
        }, (err) => {
            console.log('windowTest resetSizeTest1 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
    * @tc.number     SUB_WMS_RESETSIZE_JSAPI_002
    * @tc.name       Test resetSize_Test_002
    * @tc.desc       Verify the scene where the window resets size
    */
    it('resetSize_Test_002', 0, async function (done) {
        console.log('windowTest resetSizeTest2 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest resetSizeTest2 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.resetSize(20000, 20000).then(() => {
                console.log('windowTest resetSizeTest2 wnd.resetSize(20000, 20000) success');
                expect(TRUE_WINDOW).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest resetSizeTest2 wnd.resetSize failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1701
            })
1702 1703 1704 1705
        }, (err) => {
            console.log('windowTest resetSizeTest2 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
1706 1707
        })
    })
1708

M
mamingshuai 已提交
1709
    /**
1710 1711 1712
    * @tc.number     SUB_WMS_RESETSIZE_JSAPI_003
    * @tc.name       Test resetSize_Test_003
    * @tc.desc       Verify the scene where the window resets size
M
mamingshuai 已提交
1713
    */
1714 1715
    it('resetSize_Test_003', 0, async function (done) {
        console.log('windowTest resetSizeTest3 begin');
M
mamingshuai 已提交
1716
        window.getTopWindow().then(wnd => {
1717 1718 1719 1720 1721 1722 1723 1724 1725 1726
            console.log('windowTest resetSizeTest3 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.resetSize(0, 0).then(() => {
                console.log('windowTest resetSizeTest3 wnd.resetSize(0, 0) success');
                expect(TRUE_WINDOW).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest resetSizeTest3 wnd.resetSize failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1727
            })
1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752
        }, (err) => {
            console.log('windowTest resetSizeTest3 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
    * @tc.number     SUB_WMS_RESETSIZE_JSAPI_004
    * @tc.name       Test resetSize_Test_004
    * @tc.desc       Verify the scene where the window resets size
    */
    it('resetSize_Test_004', 0, async function (done) {
        console.log('windowTest resetSizeTest4 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest resetSizeTest4 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.resetSize(-1, -1).then(() => {
                console.log('windowTest resetSizeTest4 wnd.resetSize(-1, -1) success');
                expect(TRUE_WINDOW).assertTrue();
                done();
            }, (err) => {
                console.log('windowTest resetSizeTest4 wnd.resetSize failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1753
            })
1754 1755 1756 1757
        }, (err) => {
            console.log('windowTest resetSizeTest4 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
M
mamingshuai 已提交
1758 1759
        })
    })
1760

M
mamingshuai 已提交
1761
    /**
1762 1763 1764
    * @tc.number     SUB_WMS_RESETSIZE_JSAPI_005
    * @tc.name       Test resetSize_Test_005
    * @tc.desc       Verify the scene where the window resets size
M
mamingshuai 已提交
1765
    */
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795
    it('resetSize_Test_005', 0, async function (done) {
        console.log('windowTest resetSizeTest5 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest resetSizeTest5 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            for (var i = 1; i <= 5; i++) {
                wnd.resetSize(100, 100).then(() => {
                    console.log('windowTest resetSizeTest5 wnd.resetSize(100, 100) success, count:"%d\n"', i);
                    expect(TRUE_WINDOW).assertTrue();
                },(err) => {
                    console.log('windowTest resetSizeTest5 wnd.resetSize failed, err :' + JSON.stringify(err));
                    expect().assertFail();
                })
            }
            console.log('windowTest resetSizeTest5 end');
            done();
        }, (err) => {
            console.log('windowTest resetSizeTest5 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number    SUB_WMS_RESETSIZETEST_JSAPI_006
     * @tc.name      Test resetSize_Test_006
     * @tc.desc      Verify the scene where the window resets size
     */
    it('resetSize_Test_006', 0, function () {
        console.log('windowTest ResetSizeTest6 begin');
M
mamingshuai 已提交
1796
        window.getTopWindow().then(wnd => {
1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808
            console.log('windowTest ResetSizeTest6 getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            wnd.resetSize(200, 200, (err) => {
                if (err.code) {
                    console.log('windowTest ResetSizeTest6 resetSize callback fail' + JSON.stringify(err.code));
                    expect().assertFail();
                    done();
                } else {
                    console.log('windowTest ResetSizeTest6 resetSize callback success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }
M
mamingshuai 已提交
1809
            })
1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882
        })
    })

    /**
	* @tc.number    SUB_WMS_RESETSIZE_JSAPI_007
	* @tc.name      Test resetSize_Test_007
	* @tc.desc      Verify the scene where the window resets size
	*/
    it('resetSize_Test_007', 0, async function (done) {
        var width = 100;
        var height = 100;
        console.log('windowTest resetSizeLoop begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest resetSizeLoop getTopWindow wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            for (let i = 1; i <= 5; i++) {
                width = width * i;
                height = height * i;
                wnd.resetSize(width, height).then(() => {
                    console.log('windowTest  resetSizeTestLoop success');
                    expect(TRUE_WINDOW).assertTrue();
                },(err) => {
                    console.log('windowTest resetSizeLoop resetSize failed, err :' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
            }
            console.log('windowTest resetSizeLoop end');
            done();
        },(err) => {
            console.log('windowTest resetSizeLoop getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
    * @tc.number     SUB_WMS_GETTOPWINDOW_JSAPI_001
    * @tc.name       Test getTopWindow_Test_001
    * @tc.desc       Verify the scene that gets the top window
    */
    it('getTopWindow_Test_001', 0, async function (done) {
        console.log('windowTest getTopWindowTest1 begin');
        window.getTopWindow().then(wnd => {
            console.log('windowTest getTopWindowTest1 wnd: ' + wnd);
            expect(wnd != null).assertTrue();
            done();
        },(err) => {
            console.log('windowTest getTopWindowTest1 getTopWindow failed, err :' + JSON.stringify(err));
            expect().assertFail();
            done();
        })
    })

    /**
     * @tc.number		SUB_WMS_SETSCREENACTIVEMODE_JSAPI_001
     * @tc.name			Test setScreenActiveMode_Test_001.
     * @tc.desc			To set the function of setting screen parameters
     */
    it('setScreenActiveMode_Test_001', 0, async function (done) {
        console.log('screenshotTest setScreenActiveModeTest1 begin');
        screen.getAllScreen().then(src => {
            console.log('screenshotTest setScreenActiveModeTest1 getAllScreen src' + src);
            expect(src[0] != null).assertTrue();
            let screenIndex = src[0];
            screenIndex.setScreenActiveMode(0).then(res => {
                console.log('screenshotTest setScreenActiveModeTest1 setScreenActiveMode 0 res: ' + res);
                expect(res).assertTrue();
                done();
            },(err) => {
                console.log('screenshotTest setScreenActiveModeTest1 setScreenActiveMode 0 failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1883
            })
1884
        }, (err) => {
1885 1886
            console.log('screenshotTest setScreenActiveModeTest1 failed: err: ' + JSON.stringify(err));
            done();
1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908
        })
    })

    /**
     * @tc.number		SUB_WMS_SETSCREENACTIVEMODE_JSAPI_002
     * @tc.name			Test setScreenActiveMode_Test_002.
     * @tc.desc			To set the function of screen parameters to abnormal values.
     */
    it('setScreenActiveMode_Test_002', 0, async function (done) {
        console.log('screenshotTest setScreenActiveModeTest2 begin');
        screen.getAllScreen().then(src => {
            console.log('screenshotTest setScreenActiveModeTest2 getAllScreen src' + src);
            expect(src[0] != null).assertTrue();
            let screenIndex = src[0];
            screenIndex.setScreenActiveMode(-5).then(res => {
                console.log('screenshotTest setScreenActiveModeTest2 setScreenActiveMode -5 res: ' + res);
                expect().assertFail();
                done();
            },(err) => {
                console.log('screenshotTest setScreenActiveModeTest2 setScreenActiveMode -5 failed: err' + JSON.stringify(err));
                expect(err.code).assertEqual(0);
                done();
M
mamingshuai 已提交
1909 1910 1911
            })
        })
    })
1912

M
mamingshuai 已提交
1913
})