window.test.js 169.3 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
 * 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'
华华小仙女 已提交
16
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
M
mamingshuai 已提交
17
import window from '@ohos.window'
H
hekun18@huawei.com 已提交
18
import display from '@ohos.display'
华华小仙女 已提交
19

L
liziqiang 已提交
20
const TRUE_WINDOW = true;
21
const avoidAreaType = 3;
M
mamingshuai 已提交
22

J
jiyong_sd 已提交
23
export default function window_test() {
华华小仙女 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
    describe('window_test', function () {
        var wnd;
        var topWindow;
        const DELAY_TIME = 3000;
        var height;

        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;
        }

        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');
                }
L
liziqiang 已提交
49
            }, (err) => {
华华小仙女 已提交
50
                console.log('windowTest beforeAll window.getTopWindow failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
51 52 53
            })
            setTimeout(() => {
                done();
华华小仙女 已提交
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 79 80 81 82 83 84
            }, 5000);
        })
        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();
            }
        })
        afterEach(function () {
        })
        afterAll(function () {
        })
L
liziqiang 已提交
85

华华小仙女 已提交
86
        /**
L
liziqiang 已提交
87 88 89 90
	 * @tc.number     SUB_WMS_GETPROPERTIES_JSAPI_001
	 * @tc.name       Test getProperties_Test_001
	 * @tc.desc       Get the current application main window properties
	 */
华华小仙女 已提交
91 92 93 94 95 96 97 98
        it('getProperties_Test_001', 0, async function (done) {
            let msgStr = 'getProperties_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getProperties().then((data) => {
                    console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data));
L
liziqiang 已提交
99
                    expect(data.type != null).assertTrue();
L
liziqiang 已提交
100 101 102 103
                    expect(data.windowRect.height != null).assertTrue();
                    expect(data.windowRect.left != null).assertTrue();
                    expect(data.windowRect.top != null).assertTrue();
                    expect(data.windowRect.width != null).assertTrue();
L
liziqiang 已提交
104 105 106 107
                    expect(!data.isFullScreen).assertTrue();
                    expect(!data.isLayoutFullScreen).assertTrue();
                    expect(data.focusable).assertTrue();
                    expect(data.touchable).assertTrue();
L
liziqiang 已提交
108 109 110
                    expect(!data.isKeepScreenOn).assertTrue();
                    expect(!data.isTransparent).assertTrue();
                    expect(data.brightness != null).assertTrue();
H
hk_js 已提交
111
                    expect(data.dimBehindValue).assertEqual(0);
L
liziqiang 已提交
112 113
                    expect(!data.isRoundCorner).assertTrue();
                    expect(!data.isPrivacyMode).assertTrue();
L
liziqiang 已提交
114
                    done();
华华小仙女 已提交
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
                }, (err) => {
                    console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
            }, (err) => {
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        })

        /**
        * @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) {
            let msgStr = 'getProperties_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getProperties((err, data) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' window.getProperties callback fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        expect(data.type != null).assertTrue();
                        expect(data.windowRect.height != null).assertTrue();
                        expect(data.windowRect.left != null).assertTrue();
                        expect(data.windowRect.top != null).assertTrue();
                        expect(data.windowRect.width != null).assertTrue();
                        expect(!data.isFullScreen).assertTrue();
                        expect(!data.isLayoutFullScreen).assertTrue();
                        expect(data.focusable).assertTrue();
                        expect(data.touchable).assertTrue();
                        expect(!data.isKeepScreenOn).assertTrue();
                        expect(!data.isTransparent).assertTrue();
                        expect(data.brightness != null).assertTrue();
                        expect(data.dimBehindValue).assertEqual(0);
                        expect(!data.isRoundCorner).assertTrue();
                        expect(!data.isPrivacyMode).assertTrue();
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
166 167
            })
        })
L
liziqiang 已提交
168

华华小仙女 已提交
169
        /**
L
liziqiang 已提交
170 171 172 173
	 * @tc.number     SUB_WMS_GETAVOIDAREA_JSAPI_001
	 * @tc.name       Test getAvoidArea_Test_001
	 * @tc.desc       Get SystemUI type avoidance area
	 */
华华小仙女 已提交
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
        it('getAvoidArea_Test_001', 0, async function (done) {
            let msgStr = 'getAvoidArea_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).then((data) => {
                    console.log(msgStr + ' wnd.getAvoidArea success, data :' + JSON.stringify(data));
                    expect(data.visible).assertTrue();
                    expect(data.rightRect != null).assertTrue();
                    expect(data.topRect != null).assertTrue();
                    expect(data.bottomRect != null).assertTrue();
                    expect(data.leftRect != null).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.getAvoidArea failed, err : ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
L
liziqiang 已提交
193
            }, (err) => {
华华小仙女 已提交
194
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
195 196 197 198 199
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
200
        /**
L
liziqiang 已提交
201 202 203 204
	 * @tc.number     SUB_WMS_GETAVOIDAREA_JSAPI_002
	 * @tc.name       Test getAvoidArea_Test_002
	 * @tc.desc       Get Notch type avoidance area
	 */
华华小仙女 已提交
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
        it('getAvoidArea_Test_002', 0, async function (done) {
            let msgStr = 'getAvoidArea_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getAvoidArea(window.AvoidAreaType.TYPE_CUTOUT).then((data) => {
                    console.log(msgStr + ' wnd.getAvoidArea success, data :' + JSON.stringify(data));
                    expect(!data.visible).assertTrue();
                    expect(data.rightRect != null).assertTrue();
                    expect(data.topRect != null).assertTrue();
                    expect(data.bottomRect != null).assertTrue();
                    expect(data.leftRect != null).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.getAvoidArea failed, err : ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
L
liziqiang 已提交
224
            }, (err) => {
华华小仙女 已提交
225
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
226 227
                expect().assertFail();
                done();
M
mamingshuai 已提交
228
            })
L
liziqiang 已提交
229 230
        })

华华小仙女 已提交
231
        /**
L
liziqiang 已提交
232 233 234 235
	 * @tc.number     SUB_WMS_GETAVOIDAREA_JSAPI_003
	 * @tc.name       Test getAvoidArea_Test_003
	 * @tc.desc       Get system gesture type avoidance area
	 */
华华小仙女 已提交
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
        it('getAvoidArea_Test_003', 0, async function (done) {
            let msgStr = 'getAvoidArea_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getAvoidArea(avoidAreaType).then((data) => {
                    console.log(msgStr + ' wnd.getAvoidArea success, data :' + JSON.stringify(data));
                    expect(data.visible).assertTrue();
                    expect(data.rightRect != null).assertTrue();
                    expect(data.topRect != null).assertTrue();
                    expect(data.bottomRect != null).assertTrue();
                    expect(data.leftRect != null).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.getAvoidArea failed, err : ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
L
liziqiang 已提交
255
            }, (err) => {
华华小仙女 已提交
256
                console.log('windowTest getAvoidAreaTest3 window.getTopWindow failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
257 258
                expect().assertFail();
                done();
M
mamingshuai 已提交
259 260
            })
        })
L
liziqiang 已提交
261

华华小仙女 已提交
262
        /**
L
liziqiang 已提交
263 264 265 266
     * @tc.number    SUB_WMS_GETAVOIDAREA_JSAPI_004
     * @tc.name      Test getAvoidArea_Test_004
     * @tc.desc      Get System type avoidance area
     */
华华小仙女 已提交
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
        it('getAvoidArea_Test_004', 0, async function (done) {
            let msgStr = 'getAvoidArea_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getAvoidArea(window.AvoidAreaType.TYPE_SYSTEM, (err, data) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' wnd.getAvoidArea callback fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        expect(data.visible).assertTrue();
                        expect(data.topRect != null).assertTrue();
                        expect(data.rightRect != null).assertTrue();
                        expect(data.bottomRect != null).assertTrue();
                        expect(data.leftRect != null).assertTrue();
                        done();
                    }
                })
M
mamingshuai 已提交
287 288
            })
        })
L
liziqiang 已提交
289

华华小仙女 已提交
290
        /**
L
liziqiang 已提交
291 292 293 294
     * @tc.number    SUB_WMS_GETAVOIDAREA_JSAPI_005
     * @tc.name      Test getAvoidArea_Test_005
     * @tc.desc      Get Cutout type avoidance area
     */
华华小仙女 已提交
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
        it('getAvoidArea_Test_005', 0, async function (done) {
            let msgStr = 'getAvoidArea_Test_005';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getAvoidArea(window.AvoidAreaType.TYPE_CUTOUT, (err, data) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' wnd.getAvoidArea callback fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        expect(!data.visible).assertTrue();
                        expect(data.topRect != null).assertTrue();
                        expect(data.rightRect != null).assertTrue();
                        expect(data.bottomRect != null).assertTrue();
                        expect(data.leftRect != null).assertTrue();
                        console.log(msgStr + ' wnd.getAvoidArea callback end');
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
320 321
            })
        })
L
liziqiang 已提交
322

华华小仙女 已提交
323
        /**
L
liziqiang 已提交
324 325 326 327
     * @tc.number    SUB_WMS_GETAVOIDAREA_JSAPI_006
     * @tc.name      Test getAvoidArea_Test_006
     * @tc.desc      Get system gesture type avoidance area
     */
华华小仙女 已提交
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
        it('getAvoidArea_Test_006', 0, async function (done) {
            let msgStr = 'getAvoidArea_Test_006';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getAvoidArea(avoidAreaType, (err, data) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' wnd.getAvoidArea callback fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        expect(data.visible).assertTrue();
                        expect(data.topRect != null).assertTrue();
                        expect(data.rightRect != null).assertTrue();
                        expect(data.bottomRect != null).assertTrue();
                        expect(data.leftRect != null).assertTrue();
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
L
liziqiang 已提交
352 353 354
            })
        })

华华小仙女 已提交
355
        /**
L
liziqiang 已提交
356 357 358 359
	 * @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
	 */
华华小仙女 已提交
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
        it('setFullScreen_Test_001', 0, async function (done) {
            let msgStr = 'setFullScreen_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(false).then(() => {
                    wnd.getProperties().then((data) => {
                        console.log(msgStr + ' 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(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data));
                                expect(data != null).assertTrue();
                                expect(data.isFullScreen).assertTrue();
                                done();
                            }, (err) => {
                                console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
L
liziqiang 已提交
382
                        }, (err) => {
华华小仙女 已提交
383
                            console.log(msgStr + ' wnd.setFullScreen(true) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
384 385 386 387
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
388
                        console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
389 390 391 392
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
393
                    console.log(msgStr + ' wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
394 395 396 397
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
398
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
399 400 401 402 403
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
404
        /**
L
liziqiang 已提交
405 406 407 408
     * @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.
     */
华华小仙女 已提交
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
        it('setFullScreen_Test_002', 0, async function (done) {
            let msgStr = 'setFullScreen_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(false, (err) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' window.setFullScreen(false) callback fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        wnd.getProperties((err, data) => {
                            if (err.code != 0) {
                                console.log(msgStr + ' 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(msgStr + ' window.setFullScreen(true) callback fail' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    } else {
                                        wnd.getProperties((err, data) => {
                                            if (err.code != 0) {
                                                console.log(msgStr + ' window.getProperties callback fail' + JSON.stringify(err));
                                                expect().assertFail();
                                                done();
                                            } else {
                                                expect(data.isFullScreen).assertTrue();
                                                console.log(msgStr + ' window.getProperties callback end');
                                                done();
                                            }
                                        })
                                    }
                                })
                            }
                        })
                    }
                })
            }, (err) => {
                console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err));
                expect().assertFail();
                done();
L
liziqiang 已提交
455 456 457
            })
        })

华华小仙女 已提交
458
        /**
L
liziqiang 已提交
459 460 461 462
	 * @tc.number     SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_001
	 * @tc.name       Test setLayoutFullScreen_Test_001
	 * @tc.desc       Set window and layout to full screen
	 */
华华小仙女 已提交
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
        it('setLayoutFullScreen_Test_001', 0, async function (done) {
            let msgStr = 'setLayoutFullScreen_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(true).then(() => {
                    wnd.getProperties().then((data) => {
                        console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data));
                        expect(data.isFullScreen).assertTrue();
                        wnd.setLayoutFullScreen(true).then(() => {
                            wnd.getProperties().then((data) => {
                                console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data));
                                expect(data != null).assertTrue();
                                expect(data.isLayoutFullScreen).assertTrue();
                                done();
                            }, (err) => {
                                console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
L
liziqiang 已提交
484
                        }, (err) => {
华华小仙女 已提交
485
                            console.log(msgStr + ' wnd.setLayoutFullScreen(true) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
486 487 488 489
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
490
                        console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
491 492 493
                        expect().assertFail();
                    })
                }, (err) => {
华华小仙女 已提交
494
                    console.log(msgStr + ' wnd.setFullScreen(true) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
495
                    expect().assertFail();
华华小仙女 已提交
496
                    done();
M
mamingshuai 已提交
497
                })
L
liziqiang 已提交
498
            }, (err) => {
华华小仙女 已提交
499
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
500 501 502 503 504
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
505
        /**
506
     * @tc.number    SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_002
L
liziqiang 已提交
507 508 509
     * @tc.name      Test setLayoutFullScreen_Test_002
     * @tc.desc      Set window and layout to full screen.
     */
华华小仙女 已提交
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
        it('setLayoutFullScreen_Test_002', 0, async function (done) {
            let msgStr = 'setLayoutFullScreen_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(true, (err) => {
                    console.log(msgStr + ' wnd.setFullScreen(true) callback begin');
                    if (err.code != 0) {
                        console.log(msgStr + ' wnd.setFullScreen callback fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        wnd.getProperties((err, data) => {
                            if (err.code != 0) {
                                console.log(msgStr + ' 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(msgStr + ' wnd.setLayoutFullScreen callback fail' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    } else {
                                        wnd.getProperties((err, data) => {
                                            if (err.code != 0) {
                                                console.log(msgStr + ' wnd.getProperties callback fail' + JSON.stringify(err));
                                                expect().assertFail();
                                                done();
                                            } else {
                                                console.log(msgStr + ' wnd.getProperties callback end');
                                                expect(data.isLayoutFullScreen).assertTrue();
                                                done();
                                            }
                                        })
                                    }
                                })
                            }
L
liziqiang 已提交
550

华华小仙女 已提交
551 552 553 554 555 556 557
                        })
                    }
                })
            }, (err) => {
                console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err));
                expect().assertFail();
                done();
L
liziqiang 已提交
558 559 560
            })
        })

华华小仙女 已提交
561
        /**
L
liziqiang 已提交
562 563 564 565
	 * @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
	 */
华华小仙女 已提交
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586
        it('setLayoutFullScreen_Test_003', 0, async function (done) {
            let msgStr = 'setLayoutFullScreen_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(true).then(() => {
                    wnd.getProperties().then((data) => {
                        console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data));
                        expect(data.isFullScreen).assertTrue();
                        wnd.setLayoutFullScreen(false).then(() => {
                            wnd.getProperties().then((data) => {
                                console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data));
                                expect(data != null).assertTrue();
                                expect(!data.isLayoutFullScreen).assertTrue();
                                done();
                            }, (err) => {
                                console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
L
liziqiang 已提交
587
                        }, (err) => {
华华小仙女 已提交
588
                            console.log(msgStr + ' wnd.setLayoutFullScreen(false) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
589 590 591 592
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
593
                        console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
594 595 596
                        expect().assertFail();
                    })
                }, (err) => {
华华小仙女 已提交
597
                    console.log(msgStr + ' wnd.setFullScreen(true) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
598
                    expect().assertFail();
华华小仙女 已提交
599
                    done();
L
liziqiang 已提交
600 601
                })
            }, (err) => {
华华小仙女 已提交
602
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
603 604 605 606 607
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
608
        /**
L
liziqiang 已提交
609 610 611 612
     * @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
     */
华华小仙女 已提交
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
        it('setLayoutFullScreen_Test_004', 0, async function (done) {
            let msgStr = 'setLayoutFullScreen_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(true, (err) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' wnd.setFullScreen(true) callback fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        wnd.getProperties((err, data) => {
                            if (err.code != 0) {
                                console.log(msgStr + ' 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(msgStr + ' wnd.setLayoutFullScreen(false) callback fail' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    } else {
                                        wnd.getProperties((err, data) => {
                                            if (err.code != 0) {
                                                console.log(msgStr + ' wnd.getProperties callback fail' + JSON.stringify(err));
                                                expect().assertFail();
                                                done();
                                            } else {
                                                console.log(msgStr + ' wnd.getProperties callback end');
                                                expect(!data.isLayoutFullScreen).assertTrue();
                                                done();
                                            }
                                        })
                                    }
                                })
                            }
                        })
                    }
                })
            }, (err) => {
                console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err));
                expect().assertFail();
                done();
L
liziqiang 已提交
659 660 661
            })
        })

华华小仙女 已提交
662
        /**
L
liziqiang 已提交
663 664 665 666
	 * @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
	 */
华华小仙女 已提交
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687
        it('setLayoutFullScreen_Test_005', 0, async function (done) {
            let msgStr = 'setLayoutFullScreen_Test_005';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(false).then(() => {
                    wnd.getProperties().then((data) => {
                        console.log(msgStr + ' 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(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data));
                                expect(data.isLayoutFullScreen).assertTrue();
                                done();
                            }, (err) => {
                                console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
L
liziqiang 已提交
688
                        }, (err) => {
华华小仙女 已提交
689
                            console.log(msgStr + ' wnd.setLayoutFullScreen(true) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
690 691 692 693
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
694
                        console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
695 696 697 698
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
699
                    console.log(msgStr + ' wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
700 701 702 703
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
704
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
705 706 707 708 709
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
710
        /**
L
liziqiang 已提交
711 712 713 714
     * @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.
     */
华华小仙女 已提交
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
        it('setLayoutFullScreen_Test_006', 0, async function (done) {
            let msgStr = 'setLayoutFullScreen_Test_006';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(false, (err) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' wnd.setFullScreen fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        wnd.getProperties((err, data) => {
                            if (err.code != 0) {
                                console.log(msgStr + ' wnd.getProperties fail' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            } else {
                                expect(!data.isFullScreen).assertTrue();
                                wnd.setLayoutFullScreen(true, (err) => {
                                    if (err.code != 0) {
                                        console.log(msgStr + ' wnd.setLayoutFullScreen fail' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    } else {
                                        wnd.getProperties((err, data) => {
                                            if (err.code != 0) {
                                                console.log(msgStr + ' wnd.getProperties fail' + JSON.stringify(err));
                                                expect().assertFail();
                                                done();
                                            } else {
                                                expect(data.isLayoutFullScreen).assertTrue();
                                                done();
                                            }
                                        })
                                    }
                                })
                            }
                        })
                    }
                })
            }, (err) => {
                console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err));
                expect().assertFail();
                done();
L
liziqiang 已提交
760 761 762
            })
        })

华华小仙女 已提交
763
        /**
L
liziqiang 已提交
764 765 766 767
	 * @tc.number     SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_007
	 * @tc.name       Test setLayoutFullScreen_Test_007
	 * @tc.desc       Setting windows and layouts to be non-fullscreen
	 */
华华小仙女 已提交
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787
        it('setLayoutFullScreen_Test_007', 0, async function (done) {
            let msgStr = 'setLayoutFullScreen_Test_007';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(false).then(() => {
                    wnd.getProperties().then((data) => {
                        console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data));
                        expect(!data.isFullScreen).assertTrue();
                        wnd.setLayoutFullScreen(false).then(() => {
                            wnd.getProperties().then((data) => {
                                console.log(msgStr + ' wnd.getProperties success, data : ' + JSON.stringify(data));
                                expect(!data.isLayoutFullScreen).assertTrue();
                                done();
                            }, (err) => {
                                console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
L
liziqiang 已提交
788
                        }, (err) => {
华华小仙女 已提交
789
                            console.log(msgStr + ' wnd.setLayoutFullScreen(false) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
790 791 792 793
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
794
                        console.log(msgStr + ' wnd.getProperties failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
795 796 797
                        expect().assertFail();
                    })
                }, (err) => {
华华小仙女 已提交
798
                    console.log(msgStr + ' wnd.setFullScreen(false) failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
799
                    expect().assertFail();
华华小仙女 已提交
800
                    done();
L
liziqiang 已提交
801 802
                })
            }, (err) => {
华华小仙女 已提交
803
                console.log(msgStr + ' window.getTopWindow failed, err : ' + JSON.stringify(err));
L
liziqiang 已提交
804 805 806 807 808
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
809
        /**
L
liziqiang 已提交
810 811 812 813
     * @tc.number    SUB_WMS_SETLAYOUTFULLSCREEN_JSAPI_008
     * @tc.name      Test setLayoutFullScreen_Test_008
     * @tc.desc      Setting window and layouts to be non-fullscreen.
     */
华华小仙女 已提交
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 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
        it('setLayoutFullScreen_Test_008', 0, async function (done) {
            let msgStr = 'setLayoutFullScreen_Test_008';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFullScreen(false, (err) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' window.setFullScreen callback fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        wnd.getProperties((err, data) => {
                            if (err.code != 0) {
                                console.log(msgStr + ' 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(msgStr + ' window.setLayoutFullScreen callback fail' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    } else {
                                        wnd.getProperties((err, data) => {
                                            if (err.code != 0) {
                                                console.log(msgStr + ' window.getProperties callback fail' + JSON.stringify(err));
                                                expect().assertFail();
                                                done();
                                            } else {
                                                expect(!data.isLayoutFullScreen).assertTrue();
                                                done();
                                            }
                                        })
                                    }
                                })
                            }
                        })
                    }
                })
            }, (err) => {
                console.log(msgStr + ' window.getTopWindow fail : ' + JSON.stringify(err));
                expect().assertFail();
                done();
L
liziqiang 已提交
859 860 861 862
            })
        })


华华小仙女 已提交
863
        /**
L
liziqiang 已提交
864 865 866 867
	 * @tc.number     SUB_WMS_FIND_JSAPI_001
	 * @tc.name       Test find_Test_001
	 * @tc.desc       Query main window
	 */
华华小仙女 已提交
868 869 870 871 872 873 874 875 876 877 878 879
        it('find_Test_001', 0, async function (done) {
            let msgStr = 'find_Test_001';
            console.log(msgStr + ' begin');
            window.find('window0').then((data) => {
                console.log(msgStr + ' wnd.find success, data : ' + JSON.stringify(data));
                expect(data != null).assertTrue();
                done();
            }, (err) => {
                console.log(msgStr + ' wnd.find failed, err : ' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
L
liziqiang 已提交
880 881
        })

华华小仙女 已提交
882
        /**
L
liziqiang 已提交
883 884 885 886
	 * @tc.number     SUB_WMS_FIND_JSAPI_002
	 * @tc.name       Test find_Test_002
	 * @tc.desc       Query for non-existing windows
	 */
华华小仙女 已提交
887 888 889 890 891 892 893 894 895 896 897 898
        it('find_Test_002', 0, async function (done) {
            let msgStr = 'find_Test_002';
            console.log(msgStr + ' begin');
            window.find('window').then((window) => {
                console.log(msgStr + ' wnd.find success, window : ' + JSON.stringify(window));
                expect().assertFail();
                done();
            }, (err) => {
                console.log(msgStr + ' wnd.find failed, err : ' + JSON.stringify(err));
                expect(TRUE_WINDOW).assertTrue();
                done();
            })
L
liziqiang 已提交
899 900
        })

华华小仙女 已提交
901
        /**
L
liziqiang 已提交
902 903 904 905
     * @tc.number    SUB_WMS_FIND_JSAPI_004
     * @tc.name      Test find_Test_003
     * @tc.desc      Query main window.
     */
华华小仙女 已提交
906 907 908 909 910 911 912 913 914 915 916 917 918 919
        it('find_Test_003', 0, async function (done) {
            let msgStr = 'find_Test_003';
            console.log(msgStr + ' begin');
            window.find('window0', (err, data) => {
                if (err.code) {
                    console.log(msgStr + ' wnd.find fail, err : ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    console.log(msgStr + ' wnd.find fail');
                    expect(data != null).assertTrue();
                    done();
                }
            })
M
mamingshuai 已提交
920
        })
L
liziqiang 已提交
921

华华小仙女 已提交
922
        /**
L
liziqiang 已提交
923 924 925 926
     * @tc.number    SUB_WMS_FIND_JSAPI_004
     * @tc.name      Test find_Test_004
     * @tc.desc      Query for non-existing windows
     */
华华小仙女 已提交
927 928 929 930 931 932 933 934 935 936 937 938 939 940
        it('find_Test_004', 0, async function (done) {
            let msgStr = 'find_Test_004';
            console.log(msgStr + ' begin');
            window.find('window', (err, data) => {
                if (err.code) {
                    console.log(msgStr + ' wnd.find fail, err : ' + JSON.stringify(err));
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                } else {
                    console.log(msgStr + ' wnd.find success');
                    expect().assertFail();
                    done();
                }
            })
L
liziqiang 已提交
941 942 943
        })


华华小仙女 已提交
944
        /**
L
liziqiang 已提交
945
     * @tc.number    SUB_WMS_ONOFF_JSAPI_001
946
     * @tc.name      Test onOff_Test_001.
L
liziqiang 已提交
947 948
     * @tc.desc      To verify the function of enabling and disabling intercepting when the window size changes.
     */
华华小仙女 已提交
949 950 951 952 953
        it('onOff_Test_001', 0, async function (done) {
            let msgStr = 'onOff_Test_001';
            console.log(msgStr + ' begin');
            display.getDefaultDisplay().then(dsp => {
                window.getTopWindow((err, data) => {
L
liziqiang 已提交
954
                    if (err.code != 0) {
华华小仙女 已提交
955
                        console.log(msgStr + ' getTopWindow  fail ' + JSON.stringify(err.code));
L
liziqiang 已提交
956 957 958
                        expect().assertFail();
                        done();
                    } else {
华华小仙女 已提交
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982
                        expect(data != null).assertTrue();
                        data.on('windowSizeChange', windowSizeChangeCallback);
                        data.setLayoutFullScreen(true, (err) => {
                            if (err.code != 0) {
                                console.log(msgStr + ' 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(msgStr + ' setLayoutFullScreen callback fail ' + JSON.stringify(err));
                                            expect().assertFail();
                                            done();
                                        } else {
                                            expect(dsp.height == height).assertTrue();
                                            done();
                                        }
                                    })
                                }), 3000)
                            }
                        })
L
liziqiang 已提交
983 984
                    }
                })
华华小仙女 已提交
985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032
            }, (err) => {
                console.log(msgStr + ' getDefaultDisplay failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        })

        /**
     * @tc.number    SUB_WMS_ONOFF_JSAPI_002
     * @tc.name      Test onOff_Test_002
     * @tc.desc      To verify the function of enabling and disabling lawful interception in the system and window
     */
        it('onOff_Test_002', 0, async function (done) {
            let msgStr = 'onOff_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow((err, data) => {
                if (err.code != 0) {
                    console.log(msgStr + ' getTopWindow callback fail ' + JSON.stringify(err.code));
                    expect().assertFail();
                    done();
                } else {
                    expect(data != null).assertTrue();
                    data.on('systemAvoidAreaChange', systemAvoidAreaChangeCallback);
                    data.setFullScreen(true, (err) => {
                        if (err.code != 0) {
                            console.log(msgStr + ' setLayoutFullScreen callback fail ' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        } else {
                            setTimeout((async function () {
                                expect(height == 0).assertTrue();
                                data.off('systemAvoidAreaChange');
                                data.setFullScreen(false, (err) => {
                                    if (err.code != 0) {
                                        console.log(msgStr + ' setLayoutFullScreen callback fail ' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    } else {
                                        console.log(msgStr + ' off callback success');
                                        expect(height == 0).assertTrue();
                                        done();
                                    }
                                })
                            }), 3000)
                        }
                    })
                }
            })
L
liziqiang 已提交
1033 1034
        })

华华小仙女 已提交
1035
        /**
L
liziqiang 已提交
1036
     * @tc.number      SUB_WMS_ISSHOWING_JSAPI_001
1037
     * @tc.name        Test isShowing_Test_001.
L
liziqiang 已提交
1038 1039
     * @tc.desc        To verify the function of obtaining the display status when a window is hidden and then displayed.
     */
华华小仙女 已提交
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066
        it('isShowing_Test_001', 0, async function (done) {
            let msgStr = 'isShowing_Test_001';
            console.log(msgStr + ' begin');
            window.create('subWindow1', window.WindowType.TYPE_APP).then(wnd => {
                expect(wnd != null).assertTrue();
                console.log(msgStr + ' wnd.resetSize(400, 400) begin');
                wnd.resetSize(400, 400).then(() => {
                    console.log(msgStr + ' wnd.resetSize(400, 400) success');
                    wnd.isShowing().then(res => {
                        console.log(msgStr + ' wnd.isShowing data:' + res);
                        expect(!res).assertTrue();
                        wnd.show().then(() => {
                            wnd.isShowing().then(res => {
                                expect(res).assertTrue();
                                wnd.destroy((err) => {
                                    if (err.code) {
                                        console.error(msgStr + ' Failed to destroy the window. err:' + JSON.stringify(err));
                                        return;
                                    }
                                    console.info('Succeeded in destroying the window.');
                                });
                                done();
                            }, (err) => {
                                console.log(msgStr + ' wnd.isShowing failed, err :' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
1067
                        }, (err) => {
华华小仙女 已提交
1068
                            console.log(msgStr + ' wnd.show failed, err :' + JSON.stringify(err));
1069 1070 1071
                            expect().assertFail();
                            done();
                        })
L
liziqiang 已提交
1072
                    }, (err) => {
华华小仙女 已提交
1073
                        console.log(msgStr + ' wnd.isShowing failed, err :' + JSON.stringify(err));
L
liziqiang 已提交
1074 1075 1076
                        expect().assertFail();
                        done();
                    })
华华小仙女 已提交
1077 1078
                }, (err_resetSize) => {
                    console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize));
L
liziqiang 已提交
1079 1080 1081 1082
                })
            })
        })

华华小仙女 已提交
1083
        /**
L
liziqiang 已提交
1084
     * @tc.number    SUB_WMS_ISSHOWING_JSAPI_002
1085
     * @tc.name      Test isShowing_Test_002.
L
liziqiang 已提交
1086 1087
     * @tc.desc      To verify the function of obtaining the display status when a window is hidden and then displayed.
     */
华华小仙女 已提交
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133
        it('isShowing_Test_002', 0, async function (done) {
            let msgStr = 'isShowing_Test_002';
            console.log(msgStr + ' begin');
            window.create('subWindow2', window.WindowType.TYPE_APP, (err, data) => {
                if (err.code) {
                    console.log(msgStr + ' window.create fail err ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    expect(data != null).assertTrue();
                    data.resetSize(400, 400).then(() => {
                        console.log(msgStr + ' wnd.resetSize(400, 400) success');
                        data.isShowing((err, res1) => {
                            if (err.code) {
                                console.log(msgStr + ' data.isShowing fail err ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            } else {
                                expect(!res1).assertTrue();
                                data.show(() => {
                                    if (err.code) {
                                        console.log(msgStr + ' data.show fail err ' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    } else {
                                        data.isShowing((err, res2) => {
                                            if (err.code) {
                                                console.log(msgStr + ' data.show fail err ' + JSON.stringify(err));
                                                expect().assertFail();
                                                done();
                                            } else {
                                                expect(res2).assertTrue();
                                                data.destroy().then(() => {
                                                    console.info(msgStr + 'Succeeded in destroying the window.');
                                                    done();
                                                }).catch((err) => {
                                                    console.error(msgStr + 'Failed to destroy the window. err: ' + JSON.stringify(err));
                                                });
                                            }
                                        })
                                    }
                                })
                            }
                        })
                    }, (err_resetSize) => {
                        console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize));
1134
                    })
华华小仙女 已提交
1135 1136 1137

                }
            })
L
liziqiang 已提交
1138 1139
        })

华华小仙女 已提交
1140
        /**
L
liziqiang 已提交
1141
     * @tc.number      SUB_WMS_SETCOLORSPACE_JSAPI_001
1142
     * @tc.name        Test setColorSpace_Test_001
L
liziqiang 已提交
1143 1144
     * @tc.desc        To verify the setting of the wide color gamut color space
     */
华华小仙女 已提交
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163
        it('setColorSpace_Test_001', 0, async function (done) {
            let msgStr = 'setColorSpace_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setColorSpace(window.ColorSpace.WIDE_GAMUT).then(() => {
                    console.log(msgStr + ' setColorSpace WIDE_GAMUT');
                    wnd.getColorSpace().then(res => {
                        expect(res == window.ColorSpace.WIDE_GAMUT).assertTrue();
                        console.log(msgStr + ' setColorSpace WIDE_GAMUT success');
                        wnd.isSupportWideGamut().then(data => {
                            expect(data).assertTrue();
                            done();
                        }, (err) => {
                            console.log(msgStr + ' wnd.isSupportWideGamut failed, err :' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
L
liziqiang 已提交
1164
                    }, (err) => {
华华小仙女 已提交
1165
                        console.log(msgStr + ' wnd.getColorSpace failed, err :' + JSON.stringify(err));
L
liziqiang 已提交
1166 1167 1168 1169
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
1170
                    console.log(msgStr + ' wnd.setColorSpace failed, err :' + JSON.stringify(err));
L
liziqiang 已提交
1171 1172 1173 1174
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
1175
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
L
liziqiang 已提交
1176 1177 1178 1179 1180
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
1181
        /**
L
liziqiang 已提交
1182
     * @tc.number      SUB_WMS_SETCOLORSPACE_JSAPI_002
1183
     * @tc.name        Test setColorSpace_Test_002
L
liziqiang 已提交
1184 1185
     * @tc.desc        To verify that the color space of invaild values is set successfully
     */
华华小仙女 已提交
1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202
        it('setColorSpace_Test_002', 0, async function (done) {
            let msgStr = 'setColorSpace_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setColorSpace(-5).then(() => {
                    console.log(msgStr + ' setColorSpace -5');
                    expect().assertFail();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.setColorSpace failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(1003);
                    done();
                })
            }, (err) => {
                console.log(msgStr + ' wnd.getTopWindow failed, err :' + JSON.stringify(err));
L
liziqiang 已提交
1203 1204 1205 1206 1207
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
1208
        /**
L
liziqiang 已提交
1209
     * @tc.number    SUB_WMS_SETCOLORSPACE_JSAPI_003
1210
     * @tc.name      Test setColorSpace_Test_003
L
liziqiang 已提交
1211 1212
     * @tc.desc      To verify the setting of the wide color gamut color space
     */
华华小仙女 已提交
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249
        it('setColorSpace_Test_003', 0, async function (done) {
            let msgStr = 'setColorSpace_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' setColorSpace  fail' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        wnd.getColorSpace((err, data) => {
                            if (err.code != 0) {
                                console.log(msgStr + ' getColorSpace  fail ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            } else {
                                expect(data == window.ColorSpace.WIDE_GAMUT).assertTrue();
                                wnd.isSupportWideGamut((err, data) => {
                                    if (err.code != 0) {
                                        console.log(msgStr + ' getColorSpace callback fail' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    } else {
                                        expect(data).assertTrue();
                                        done();
                                    }
                                })
                            }
                        })
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed,err: ' + JSON.stringify(err));
                expect().assertFail();
                done();
L
liziqiang 已提交
1250 1251 1252
            })
        })

华华小仙女 已提交
1253
        /**
L
liziqiang 已提交
1254
     * @tc.number    SUB_WMS_SETCOLORSPACE_JSAPI_004
1255
     * @tc.name      Test setColorSpace_Test_004
L
liziqiang 已提交
1256 1257
     * @tc.desc      To verify that the color space of invalid values is set successfully
     */
华华小仙女 已提交
1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278
        it('setColorSpace_Test_004', 0, async function (done) {
            let msgStr = 'setColorSpace_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setColorSpace(-5, (err) => {
                    console.log(msgStr + ' setColorSpace callback begin' + JSON.stringify(err));
                    if (err.code != 0) {
                        console.log(msgStr + ' setColorSpace callback fail' + JSON.stringify(err.code));
                        expect(err.code).assertEqual(1003);
                        done();
                    } else {
                        expect().assertFail();
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed,err: ' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1279
            })
L
liziqiang 已提交
1280 1281
        })

华华小仙女 已提交
1282
        /**
L
liziqiang 已提交
1283
     * @tc.number		SUB_WMS_CREATE_JSAPI_001
1284
     * @tc.name			Test create_Test_001.
L
liziqiang 已提交
1285 1286
     * @tc.desc			To verify the function of creating an application subwindow.
     */
华华小仙女 已提交
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307
        it('create_Test_001', 0, async function (done) {
            let msgStr = 'create_Test_001';
            console.log(msgStr + ' begin');
            window.create('subWindow3', window.WindowType.TYPE_APP).then(wnd => {
                console.log(msgStr + ' create success wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.resetSize(400, 400).then(() => {
                    console.log(msgStr + ' wnd.resetSize(400, 400) success');
                    wnd.destroy().then(() => {
                        console.info(msgStr + 'Succeeded in destroying the window.');
                        done();
                    }).catch((err) => {
                        console.error(msgStr + 'Failed to destroy the window. err: ' + JSON.stringify(err));
                    });
                }, (err_resetSize) => {
                    console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize));
                })

            }, (err) => {
                console.log(msgStr + ' create failed, err :' + JSON.stringify(err));
                expect().assertFail();
1308 1309
                done();
            })
M
mamingshuai 已提交
1310
        })
L
liziqiang 已提交
1311

华华小仙女 已提交
1312
        /**
L
liziqiang 已提交
1313
     * @tc.number    SUB_WMS_CREATE_JSAPI_001
1314
     * @tc.name      Test create_Test_002
L
liziqiang 已提交
1315 1316
     * @tc.desc      To verify the function of creating an application subwindow
     */
华华小仙女 已提交
1317 1318 1319 1320 1321 1322 1323
        it('create_Test_002', 0, async function (done) {
            let msgStr = 'create_Test_002';
            console.log(msgStr + ' begin');
            window.create('subWindow4', window.WindowType.TYPE_APP, (err, data) => {
                if (err.code != 0) {
                    console.log(msgStr + ' create callback fail' + JSON.stringify(err.code));
                    expect().assertFail();
1324
                    done();
华华小仙女 已提交
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340
                } else {
                    expect(data != null).assertTrue();
                    console.log(msgStr + ' callback create success data' + data);
                    data.resetSize(400, 400).then(() => {
                        console.log(msgStr + ' wnd.resetSize(400, 400) success');
                        data.destroy().then(() => {
                            console.info(msgStr + 'Succeeded in destroying the window.');
                            done();
                        }).catch((err) => {
                            console.error(msgStr + 'Failed to destroy the window. err: ' + JSON.stringify(err));
                        });
                    }, (err_resetSize) => {
                        console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize));
                    })
                }
            })
L
liziqiang 已提交
1341 1342
        })

华华小仙女 已提交
1343
        /**
L
liziqiang 已提交
1344
     * @tc.number		SUB_WMS_DESTROY_JSAPI_001
1345
     * @tc.name			Test destroy_Test_001
L
liziqiang 已提交
1346 1347
     * @tc.desc			Verify that a window is destroyed after being created
     */
华华小仙女 已提交
1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365
        it('destroy_Test_001', 0, async function (done) {
            let msgStr = 'destroy_Test_001';
            console.log(msgStr + ' begin');
            window.create('subWindow5', window.WindowType.TYPE_APP).then(wnd => {
                console.log(msgStr + ' create success wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.resetSize(400, 400).then(() => {
                    console.log(msgStr + ' wnd.resetSize(400, 400) success');
                    wnd.destroy().then(() => {
                        window.find('subWindow5').then((data) => {
                            console.log(msgStr + ' window.find success, window :' + JSON.stringify(data));
                            expect().assertFail();
                            done();
                        }, (err) => {
                            console.log(msgStr + ' find failed, err :' + JSON.stringify(err));
                            expect(err.code).assertEqual(1001);
                            done();
                        })
1366
                    }, (err) => {
华华小仙女 已提交
1367 1368
                        console.log(msgStr + ' destroy failed, err :' + JSON.stringify(err));
                        expect().assertFail();
1369 1370
                        done();
                    })
华华小仙女 已提交
1371 1372
                }, (err_resetSize) => {
                    console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize));
L
liziqiang 已提交
1373
                })
华华小仙女 已提交
1374 1375 1376 1377 1378

            }, (err) => {
                console.log(msgStr + ' create failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
L
liziqiang 已提交
1379 1380
            })
        })
华华小仙女 已提交
1381
        /**
L
liziqiang 已提交
1382
     * @tc.number    SUB_WMS_DESTROY_JSAPI_002
1383
     * @tc.name      Test destroy_Test_002
L
liziqiang 已提交
1384 1385
     * @tc.desc      Verify that a window is destroyed after being created
     */
华华小仙女 已提交
1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419
        it('destroy_Test_002', 0, async function (done) {
            let msgStr = 'destroy_Test_002';
            console.log(msgStr + ' begin');
            window.create('subWindow6', window.WindowType.TYPE_APP, (err, data) => {
                if (err.code != 0) {
                    console.log(msgStr + ' create callback fail' + JSON.stringify(err.code));
                    expect().assertFail();
                    done();
                } else {
                    expect(data != null).assertTrue();
                    data.resetSize(400, 400).then(() => {
                        console.log(msgStr + ' wnd.resetSize(400, 400) success');
                        data.destroy((err) => {
                            if (err.code != 0) {
                                console.log(msgStr + ' create callback fail' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            } else {
                                window.find('subWindow6', (err, data) => {
                                    console.log(msgStr + ' find callback begin' + JSON.stringify(data));
                                    if (err.code != 0) {
                                        console.log(msgStr + ' find callback fail' + JSON.stringify(err.code));
                                        expect(err.code).assertEqual(1001);
                                        done();
                                    } else {
                                        console.log(msgStr + ' find suceess,err : ' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    }
                                })
                            }
                        })
                    }, (err_resetSize) => {
                        console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err_resetSize));
1420
                    })
华华小仙女 已提交
1421 1422 1423

                }
            })
L
liziqiang 已提交
1424 1425
        })

华华小仙女 已提交
1426
        /**
L
liziqiang 已提交
1427
     * @tc.number		SUB_WMS_SETSYSTEMBARENABLE_JSAPI_001
1428
     * @tc.name			Test setSystemBarEnable_Test_001
L
liziqiang 已提交
1429 1430
     * @tc.desc			To verify the function of setting a scenario that is visible to the system bar
     */
华华小仙女 已提交
1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446
        it('setSystemBarEnable_Test_001', 0, async function (done) {
            let msgStr = 'setSystemBarEnable_Test_001';
            console.log(msgStr + ' begin');
            var names = ["status", "navigation"];
            window.getTopWindow().then(wnd => {
                expect(wnd != null).assertTrue();
                wnd.setLayoutFullScreen(true).then(() => {
                    wnd.setSystemBarEnable(names).then(() => {
                        console.log(msgStr + ' setSystemBarEnable success');
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }, (err) => {
                        console.log(msgStr + ' setSystemBarEnable failed, err :' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
L
liziqiang 已提交
1447
                }, (err) => {
华华小仙女 已提交
1448
                    console.log(msgStr + ' setLayoutFullScreen failed, err :' + JSON.stringify(err));
L
liziqiang 已提交
1449 1450 1451 1452
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
1453
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
L
liziqiang 已提交
1454 1455 1456 1457 1458 1459
                expect().assertFail();
                done();
            })
        })


华华小仙女 已提交
1460
        /**
L
liziqiang 已提交
1461
     * @tc.number    SUB_WMS_SETSYSTEMBARENABLE_JSAPI_002
1462
     * @tc.name      Test setSystemBarEnable_Test_002
L
liziqiang 已提交
1463 1464
     * @tc.desc      To verify the function of setting a scenario that is visible to the system bar
     */
华华小仙女 已提交
1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488
        it('setSystemBarEnable_Test_002', 0, async function (done) {
            let msgStr = 'setSystemBarEnable_Test_002';
            console.log(msgStr + ' begin');
            var names = ["status", "navigation"];
            window.getTopWindow((err, data) => {
                if (err.code != 0) {
                    console.log(msgStr + ' getTopWindow fail: ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    expect(data != null).assertTrue();
                    data.setSystemBarEnable(names, (err) => {
                        if (err.code != 0) {
                            console.log(msgStr + ' getTopWindow fail' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        } else {
                            console.log(msgStr + ' setSystemBarEnable success');
                            expect(TRUE_WINDOW).assertTrue();
                            done();
                        }
                    })
                }
            })
L
liziqiang 已提交
1489 1490
        })

华华小仙女 已提交
1491
        /**
L
liziqiang 已提交
1492
     * @tc.number		SUB_WMS_SETSYSTEMBARPROPERTIES_JSAPI_001
1493
     * @tc.name			Test setSystemBarProperties_Test_001
L
liziqiang 已提交
1494 1495
     * @tc.desc			To verify the function of setting system bar attributes
     */
华华小仙女 已提交
1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519
        it('setSystemBarProperties_Test_001', 0, async function (done) {
            let msgStr = 'setSystemBarProperties_Test_001';
            console.log(msgStr + ' 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(msgStr + ' setSystemBarProperties success ');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' setSystemBarProperties failed, err :' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
L
liziqiang 已提交
1520 1521 1522 1523 1524 1525
                expect().assertFail();
                done();
            })
        })


华华小仙女 已提交
1526
        /**
L
liziqiang 已提交
1527
     * @tc.number    SUB_WMS_SETSYSTEMBARPROPERTIES_JSAPI_002
1528
     * @tc.name      Test setSystemBarProperties_Test_002
L
liziqiang 已提交
1529 1530
     * @tc.desc      To verify the function of setting system bar attributes
     */
华华小仙女 已提交
1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562
        it('setSystemBarProperties_Test_002', 0, async function (done) {
            let msgStr = 'setSystemBarProperties_Test_002';
            console.log(msgStr + ' 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(msgStr + ' getTopWindow fail: ' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                } else {
                    expect(data != null).assertTrue();
                    data.setSystemBarProperties(SystemBarProperties, (err) => {
                        if (err.code != 0) {
                            console.log(msgStr + ' setSystemBarProperties fail' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        } else {
                            expect(TRUE_WINDOW).assertTrue();
                            done();
                        }
                    })
                }
            })
        })

L
liziqiang 已提交
1563

华华小仙女 已提交
1564
        /**
L
liziqiang 已提交
1565
     * @tc.number    SUB_WMS_MOVETO_JSAPI_001
L
liziqiang 已提交
1566 1567 1568
     * @tc.name      Test move_Test_001
     * @tc.desc      Verify the scene where the window moves
     */
华华小仙女 已提交
1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585
        it('move_Test_001', 0, function (done) {
            let msgStr = 'move_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.moveTo(200, 200, (err) => {
                    if (err.code) {
                        console.log(msgStr + ' moveTo callback fail' + JSON.stringify(err.code));
                        expect(err.code).assertEqual(6);
                        done();
                    } else {
                        console.log(msgStr + ' moveTo callback success');
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }
                })
L
liziqiang 已提交
1586 1587
            })
        })
华华小仙女 已提交
1588
        /**
L
liziqiang 已提交
1589 1590 1591
    * @tc.number     SUB_WMS_MOVETO_JSAPI_002
    * @tc.name       Test move_Test_002
    * @tc.desc       Verify the scene where the window moves
M
mamingshuai 已提交
1592
    */
华华小仙女 已提交
1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607
        it('move_Test_002', 0, async function (done) {
            let msgStr = 'move_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.moveTo(100, 100).then(() => {
                    console.log(msgStr + ' wnd.moveTo success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(6);
                    done();
                })
L
liziqiang 已提交
1608
            }, (err) => {
华华小仙女 已提交
1609 1610
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
1611
                done();
M
mamingshuai 已提交
1612 1613
            })
        })
L
liziqiang 已提交
1614

华华小仙女 已提交
1615
        /**
L
liziqiang 已提交
1616 1617 1618
    * @tc.number     SUB_WMS_MOVETO_JSAPI_003
    * @tc.name       Test move_Test_003
    * @tc.desc       Verify the scene where the window moves
M
mamingshuai 已提交
1619
    */
华华小仙女 已提交
1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634
        it('move_Test_003', 0, async function (done) {
            let msgStr = 'move_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.moveTo(20000, 20000).then(() => {
                    console.log(msgStr + ' wnd.moveTo success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(6);
                    done();
                })
L
liziqiang 已提交
1635
            }, (err) => {
华华小仙女 已提交
1636 1637
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
1638
                done();
M
mamingshuai 已提交
1639 1640
            })
        })
L
liziqiang 已提交
1641

华华小仙女 已提交
1642
        /**
L
liziqiang 已提交
1643 1644 1645
    * @tc.number     SUB_WMS_MOVETO_JSAPI_004
    * @tc.name       Test move_Test_004
    * @tc.desc       Verify the scene where the window moves
M
mamingshuai 已提交
1646
    */
华华小仙女 已提交
1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661
        it('move_Test_004', 0, async function (done) {
            let msgStr = 'move_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.moveTo(-200, -200).then(() => {
                    console.log(msgStr + ' wnd.moveTo success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(6);
                    done();
                })
L
liziqiang 已提交
1662
            }, (err) => {
华华小仙女 已提交
1663 1664
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
1665
                done();
M
mamingshuai 已提交
1666 1667
            })
        })
L
liziqiang 已提交
1668

华华小仙女 已提交
1669
        /**
L
liziqiang 已提交
1670 1671 1672
    * @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 已提交
1673
    */
华华小仙女 已提交
1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694
        it('move_Test_005', 0, async function (done) {
            let msgStr = 'move_Test_005';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                for (var i = 1; i <= 5; i++) {
                    wnd.moveTo(100, 100).then(() => {
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }, (err) => {
                        console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err));
                        expect(err.code).assertEqual(6);
                        done();
                    })
                }
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
M
mamingshuai 已提交
1695
        })
L
liziqiang 已提交
1696

华华小仙女 已提交
1697
        /**
L
liziqiang 已提交
1698
    * @tc.number     SUB_WMS_MOVETO_JSAPI_006
L
liziqiang 已提交
1699
    * @tc.name       Test move_Test_006
L
liziqiang 已提交
1700
    * @tc.desc       Verify the scene where the window moves
M
mamingshuai 已提交
1701
    */
华华小仙女 已提交
1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722
        it('move_Test_006', 0, async function (done) {
            let msgStr = 'move_Test_006';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.moveTo(-200, -200, (err) => {
                    if (err.code) {
                        console.log(msgStr + ' wnd.moveTo failed, err :' + JSON.stringify(err));
                        expect(err.code).assertEqual(6);
                        done();
                    } else {
                        console.log(msgStr + ' wnd.moveTo success');
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
M
mamingshuai 已提交
1723 1724
            })
        })
L
liziqiang 已提交
1725

华华小仙女 已提交
1726
        /**
L
liziqiang 已提交
1727 1728 1729 1730
	* @tc.number    SUB_WMS_MOVETO_JSAPI_007
	* @tc.name      Test move_Test_007
	* @tc.desc      Verify the scene where the window moves
	*/
华华小仙女 已提交
1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745
        it('move_Test_007', 0, async function (done) {
            let msgStr = 'move_Test_007';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.moveTo(-200, -200).then(() => {
                    console.log(msgStr + 'moveTo(-200,-200) success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' moveTo failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(6);
                    done();
                })
L
liziqiang 已提交
1746
            }, (err) => {
华华小仙女 已提交
1747 1748
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
1749 1750 1751 1752
                done();
            })
        })

华华小仙女 已提交
1753
        /**
L
liziqiang 已提交
1754 1755 1756 1757
	* @tc.number    SUB_WMS_MOVETO_JSAPI_008
	* @tc.name      Test move_Test_008
	* @tc.desc      Verify the scene where the window moves
	*/
华华小仙女 已提交
1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772
        it('move_Test_008', 0, async function (done) {
            let msgStr = 'move_Test_008';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' 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(msgStr + ' create failed, err :' + JSON.stringify(err));
                        expect(err.code).assertEqual(6);
                        done();
                    })
L
liziqiang 已提交
1773
                }, (err) => {
华华小仙女 已提交
1774
                    console.log(msgStr + ' create failed, err :' + JSON.stringify(err));
H
hk_js 已提交
1775
                    expect(err.code).assertEqual(6);
L
liziqiang 已提交
1776 1777 1778
                    done();
                })
            }, (err) => {
华华小仙女 已提交
1779 1780
                console.log(msgStr + ' create failed, err :' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
1781 1782 1783 1784
                done();
            })
        })

华华小仙女 已提交
1785
        /**
L
liziqiang 已提交
1786 1787 1788
    * @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 已提交
1789
    */
华华小仙女 已提交
1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804
        it('resetSize_Test_001', 0, async function (done) {
            let msgStr = 'resetSize_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.resetSize(200, 600).then(() => {
                    console.log(msgStr + ' wnd.resetSize(200, 600) success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(6);
                    done();
                })
L
liziqiang 已提交
1805
            }, (err) => {
华华小仙女 已提交
1806 1807
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
1808
                done();
M
mamingshuai 已提交
1809
            })
L
liziqiang 已提交
1810 1811
        })

华华小仙女 已提交
1812
        /**
L
liziqiang 已提交
1813 1814 1815 1816
    * @tc.number     SUB_WMS_RESETSIZE_JSAPI_002
    * @tc.name       Test resetSize_Test_002
    * @tc.desc       Verify the scene where the window resets size
    */
华华小仙女 已提交
1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831
        it('resetSize_Test_002', 0, async function (done) {
            let msgStr = 'resetSize_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.resetSize(20000, 20000).then(() => {
                    console.log(msgStr + ' wnd.resetSize(20000, 20000) success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(6);
                    done();
                })
L
liziqiang 已提交
1832
            }, (err) => {
华华小仙女 已提交
1833 1834
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
1835
                done();
M
mamingshuai 已提交
1836 1837
            })
        })
L
liziqiang 已提交
1838

华华小仙女 已提交
1839
        /**
L
liziqiang 已提交
1840 1841 1842
    * @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 已提交
1843
    */
华华小仙女 已提交
1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858
        it('resetSize_Test_003', 0, async function (done) {
            let msgStr = 'resetSize_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.resetSize(0, 0).then(() => {
                    console.log(msgStr + ' wnd.resetSize(0, 0) success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(1003);
                    done();
                })
L
liziqiang 已提交
1859
            }, (err) => {
华华小仙女 已提交
1860 1861
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
1862
                done();
M
mamingshuai 已提交
1863
            })
L
liziqiang 已提交
1864 1865
        })

华华小仙女 已提交
1866
        /**
L
liziqiang 已提交
1867 1868 1869 1870
    * @tc.number     SUB_WMS_RESETSIZE_JSAPI_004
    * @tc.name       Test resetSize_Test_004
    * @tc.desc       Verify the scene where the window resets size
    */
华华小仙女 已提交
1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885
        it('resetSize_Test_004', 0, async function (done) {
            let msgStr = 'resetSize_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.resetSize(-1, -1).then(() => {
                    console.log(msgStr + ' wnd.resetSize(-1, -1) success');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err));
                    expect(err.code).assertEqual(1003);
                    done();
                })
L
liziqiang 已提交
1886
            }, (err) => {
华华小仙女 已提交
1887 1888
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
1889
                done();
M
mamingshuai 已提交
1890 1891
            })
        })
L
liziqiang 已提交
1892

华华小仙女 已提交
1893
        /**
L
liziqiang 已提交
1894 1895 1896
    * @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 已提交
1897
    */
华华小仙女 已提交
1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919
        it('resetSize_Test_005', 0, async function (done) {
            let msgStr = 'resetSize_Test_005';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                for (var i = 1; i <= 5; i++) {
                    wnd.resetSize(100, 100).then(() => {
                        console.log(msgStr + ' wnd.resetSize(100, 100) success, count:"%d\n"', i);
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }, (err) => {
                        console.log(msgStr + ' wnd.resetSize failed, err :' + JSON.stringify(err));
                        expect(err.code).assertEqual(6);
                        done();
                    })
                }
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
L
liziqiang 已提交
1920 1921
        })

华华小仙女 已提交
1922
        /**
L
liziqiang 已提交
1923 1924 1925 1926
     * @tc.number    SUB_WMS_RESETSIZETEST_JSAPI_006
     * @tc.name      Test resetSize_Test_006
     * @tc.desc      Verify the scene where the window resets size
     */
华华小仙女 已提交
1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943
        it('resetSize_Test_006', 0, function (done) {
            let msgStr = 'resetSize_Test_006';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.resetSize(200, 200, (err) => {
                    if (err.code) {
                        console.log(msgStr + ' resetSize callback fail' + JSON.stringify(err.code));
                        expect(err.code).assertEqual(6);
                        done();
                    } else {
                        console.log(msgStr + ' resetSize callback success');
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }
                })
M
mamingshuai 已提交
1944
            })
L
liziqiang 已提交
1945 1946
        })

华华小仙女 已提交
1947
        /**
L
liziqiang 已提交
1948 1949 1950 1951
	* @tc.number    SUB_WMS_RESETSIZE_JSAPI_007
	* @tc.name      Test resetSize_Test_007
	* @tc.desc      Verify the scene where the window resets size
	*/
华华小仙女 已提交
1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977
        it('resetSize_Test_007', 0, async function (done) {
            var width = 100;
            var height = 100;
            let msgStr = 'resetSize_Test_007';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' 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(msgStr + '  resetSizeTestLoop success');
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }, (err) => {
                        console.log(msgStr + ' resetSizeLoop resetSize failed, err :' + JSON.stringify(err));
                        expect(err.code).assertEqual(6);
                        done();
                    })
                }
            }, (err) => {
                console.log(msgStr + ' resetSizeLoop getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
L
liziqiang 已提交
1978 1979
        })

华华小仙女 已提交
1980
        /**
L
liziqiang 已提交
1981 1982 1983 1984
    * @tc.number     SUB_WMS_GETTOPWINDOW_JSAPI_001
    * @tc.name       Test getTopWindow_Test_001
    * @tc.desc       Verify the scene that gets the top window
    */
华华小仙女 已提交
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996
        it('getTopWindow_Test_001', 0, async function (done) {
            let msgStr = 'getTopWindow_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                done();
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed, err :' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
L
liziqiang 已提交
1997
        })
华华小仙女 已提交
1998 1999

        /**
H
hekun18@huawei.com 已提交
2000 2001 2002 2003
     * @tc.number		SUB_WMS_ENUM_WINDOWSTAGEEVENTTYPE_JSAPI_001
     * @tc.name			Test enumWindowStageEventType_Test_001.
     * @tc.desc			To test the enum value of WindowStageEventType.
     */
华华小仙女 已提交
2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
        it('enumWindowStageEventType_Test_001', 0, async function (done) {
            let msgStr = 'enumWindowStageEventType_Test_001';
            console.log(msgStr + ' begin');
            try {
                expect(1).assertEqual(window.WindowStageEventType.SHOWN);
                expect(2).assertEqual(window.WindowStageEventType.ACTIVE);
                expect(3).assertEqual(window.WindowStageEventType.INACTIVE);
                expect(4).assertEqual(window.WindowStageEventType.HIDDEN);
                done();
            } catch (err) {
                console.log(msgStr + ' error ' + JSON.stringify(err));
            }
        })
H
hekun18@huawei.com 已提交
2017

华华小仙女 已提交
2018
        /**
H
hk_js 已提交
2019 2020 2021 2022
    * @tc.number		SUB_WMS_ENUM_WINDOWCOLORSPACE_JSAPI_001
    * @tc.name			Test enumWindowCOLORSPACE_Test_001.
    * @tc.desc			To test the enum value of WindowCOLORSPACE.
    */
华华小仙女 已提交
2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033
        it('enumWindowCOLORSPACE_Test_001', 0, async function (done) {
            let msgStr = 'enumWindowCOLORSPACE_Test_001';
            console.log(msgStr + ' begin');
            try {
                expect(0).assertEqual(window.ColorSpace.DEFAULT);
                expect(1).assertEqual(window.ColorSpace.WIDE_GAMUT);
                done();
            } catch (err) {
                console.log(msgStr + ' colorspace error ' + JSON.stringify(err));
            }
        })
H
hk_js 已提交
2034

华华小仙女 已提交
2035
        /**
L
liziqiang 已提交
2036 2037 2038 2039
     * @tc.number		SUB_WMS_ENUM_WINDOWTYPE_JSAPI_001
     * @tc.name			Test enumWindowType_Test_001.
     * @tc.desc			To test the enum value of WindowType.
     */
华华小仙女 已提交
2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050
        it('enumWindowType_Test_001', 0, async function (done) {
            let msgStr = 'enumWindowType_Test_001';
            console.log(msgStr + ' begin');
            try {
                expect(0).assertEqual(window.WindowType.TYPE_APP);
                expect(1).assertEqual(window.WindowType.TYPE_SYSTEM_ALERT);
                done();
            } catch (err) {
                console.log(msgStr + ' WindowType error ' + JSON.stringify(err));
            }
        })
L
liziqiang 已提交
2051

华华小仙女 已提交
2052
        /**
H
hk_js 已提交
2053 2054 2055 2056
     * @tc.number	SUB_WMS_ENUM_WINDOWPROTERTIES_JSAPI_001
     * @tc.name	    Test enumWindowProperties_Test_001.
     * @tc.desc		To test the enum value of WindowProperties.
    */
华华小仙女 已提交
2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099
        it('enumWindowProperties_Test_001', 0, async function (done) {
            let msgStr = 'enumWindowProperties_Test_001';
            console.log(msgStr + ' begin');
            try {
                var windowP = {
                    windowRect: {
                        left: 20,
                        top: 20,
                        width: 20,
                        height: 20
                    },
                    type: 0,
                    isFullScreen: false,
                    isLayoutFullScreen: false,
                    focusable: false,
                    touchable: false,
                    brightness: 0.5,
                    dimBehindValue: 3,
                    isKeepScreenOn: false,
                    isPrivacyMode: false,
                    isRoundCorner: false,
                    isTransparent: false
                }
                expect(20).assertEqual(windowP.windowRect.left);
                expect(20).assertEqual(windowP.windowRect.top);
                expect(20).assertEqual(windowP.windowRect.width);
                expect(20).assertEqual(windowP.windowRect.height);
                expect(0).assertEqual(windowP.type);
                expect(!windowP.isFullScreen).assertTrue();
                expect(!windowP.isLayoutFullScreen).assertTrue();
                expect(!windowP.focusable).assertTrue();
                expect(!windowP.touchable).assertTrue();
                expect(0.5).assertEqual(windowP.brightness);
                expect(3).assertEqual(windowP.dimBehindValue);
                expect(!windowP.isKeepScreenOn).assertTrue();
                expect(!windowP.isPrivacyMode).assertTrue();
                expect(!windowP.isRoundCorner).assertTrue();
                expect(!windowP.isTransparent).assertTrue();
                done();
            } catch (err) {
                console.error(msgStr + ' windowproperties error ' + JSON.stringify(err));
                expect.assertFail();
                done();
H
hk_js 已提交
2100
            }
华华小仙女 已提交
2101
        })
H
hk_js 已提交
2102

华华小仙女 已提交
2103
        /**
L
liziqiang 已提交
2104 2105 2106 2107
     * @tc.number		SUB_WMS_SETFOCUSABLE_JSAPI_001
     * @tc.name			Test setFocusable_Test_001
     * @tc.desc			Setting window focus acquisition and defocus
     */
华华小仙女 已提交
2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127
        it('setFocusable_Test_001', 0, async function (done) {
            let msgStr = 'setFocusable_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getProperties().then(data => {
                    expect(data.focusable).assertTrue();
                    wnd.setFocusable(false).then(() => {
                        console.log(msgStr + ' setFocusable(false) success ');
                        wnd.getProperties().then(data => {
                            expect(!data.focusable).assertTrue();
                            wnd.setFocusable(true).then(() => {
                                console.log(msgStr + ' setFocusable(true) success ');
                                expect(TRUE_WINDOW).assertTrue();
                                done();
                            })
                        }, (err) => {
                            console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                            expect().assertFail();
L
liziqiang 已提交
2128 2129 2130
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
2131
                        console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2132 2133 2134 2135
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
2136
                    console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2137 2138 2139 2140
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2141
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2142 2143 2144 2145 2146
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2147
        /**
L
liziqiang 已提交
2148 2149 2150 2151
     * @tc.number		SUB_WMS_SETFOCUSABLE_JSAPI_002
     * @tc.name			Test setFocusable_Test_002
     * @tc.desc			The setting window loses focus and cannot be touched
     */
华华小仙女 已提交
2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179
        it('setFocusable_Test_002', 0, async function (done) {
            let msgStr = 'setFocusable_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFocusable(false).then(() => {
                    console.log(msgStr + ' setFocusable(false) success ');
                    wnd.getProperties().then(data => {
                        expect(!data.focusable).assertTrue();
                        wnd.setTouchable(false).then(() => {
                            console.log(msgStr + ' setTouchable(false) success ');
                            wnd.getProperties().then(data => {
                                expect(!data.touchable).assertTrue();
                                done();
                            }, (err) => {
                                console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
                        }, (err) => {
                            console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                        expect().assertFail();
L
liziqiang 已提交
2180 2181 2182
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
2183
                    console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2184 2185 2186 2187
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2188
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2189 2190 2191 2192 2193
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2194
        /**
L
liziqiang 已提交
2195 2196 2197 2198
     * @tc.number		SUB_WMS_SETFOCUSABLE_JSAPI_003
     * @tc.name			Test setFocusable_Test_003
     * @tc.desc			Set the window to lose focus and be touchable
     */
华华小仙女 已提交
2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218
        it('setFocusable_Test_003', 0, async function (done) {
            let msgStr = 'setFocusable_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFocusable(false).then(() => {
                    console.log(msgStr + ' setFocusable(false) success ');
                    wnd.getProperties().then(data => {
                        expect(!data.focusable).assertTrue();
                        wnd.setTouchable(true).then(() => {
                            console.log(msgStr + ' setTouchable(true) success ');
                            wnd.getProperties().then(data => {
                                expect(data.touchable).assertTrue();
                                done();
                            }, (err) => {
                                console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
L
liziqiang 已提交
2219
                        }, (err) => {
华华小仙女 已提交
2220
                            console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2221 2222 2223 2224
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
2225
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2226 2227 2228 2229
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
2230
                    console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2231 2232 2233 2234
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2235
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2236 2237 2238 2239 2240
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2241
        /**
L
liziqiang 已提交
2242 2243 2244 2245
     * @tc.number		SUB_WMS_SETFOCUSABLE_JSAPI_004
     * @tc.name			Test setFocusable_Test_004
     * @tc.desc			Setting the window to get focus is not touchable
     */
华华小仙女 已提交
2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265
        it('setFocusable_Test_004', 0, async function (done) {
            let msgStr = 'setFocusable_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFocusable(true).then(() => {
                    console.log(msgStr + ' setFocusable(true) success ');
                    wnd.getProperties().then(data => {
                        expect(data.focusable).assertTrue();
                        wnd.setTouchable(false).then(() => {
                            console.log(msgStr + ' setTouchable(false) success ');
                            wnd.getProperties().then(data => {
                                expect(!data.touchable).assertTrue();
                                done();
                            }, (err) => {
                                console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
L
liziqiang 已提交
2266
                        }, (err) => {
华华小仙女 已提交
2267
                            console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2268 2269 2270 2271
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
2272
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2273 2274 2275 2276
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
2277
                    console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2278 2279 2280 2281
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2282
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2283 2284 2285 2286 2287
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2288
        /**
L
liziqiang 已提交
2289 2290 2291 2292
     * @tc.number		SUB_WMS_SETFOCUSABLE_JSAPI_005
     * @tc.name			Test setFocusable_Test_005
     * @tc.desc			Set the window to get focus and touch
     */
华华小仙女 已提交
2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312
        it('setFocusable_Test_005', 0, async function (done) {
            let msgStr = 'setFocusable_Test_005';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFocusable(true).then(() => {
                    console.log(msgStr + ' setFocusable(true) success ');
                    wnd.getProperties().then(data => {
                        expect(data.focusable).assertTrue();
                        wnd.setTouchable(true).then(() => {
                            console.log(msgStr + ' setTouchable(true) success ');
                            wnd.getProperties().then(data => {
                                expect(data.touchable).assertTrue();
                                done();
                            }, (err) => {
                                console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            })
L
liziqiang 已提交
2313
                        }, (err) => {
华华小仙女 已提交
2314
                            console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2315 2316 2317 2318
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
2319
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2320 2321 2322 2323
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
2324
                    console.log(msgStr + ' setFocusable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2325 2326 2327 2328
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2329
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2330 2331 2332 2333 2334
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2335
        /**
L
liziqiang 已提交
2336 2337 2338 2339
     * @tc.number		SUB_WMS_SETTOUCHABLE_JSAPI_001
     * @tc.name			Test setTouchable_Test_001
     * @tc.desc			Set whether the window can be touched or not
     */
华华小仙女 已提交
2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361
        it('setTouchable_Test_001', 0, async function (done) {
            let msgStr = 'setTouchable_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getProperties().then(data => {
                    expect(data.touchable).assertTrue();
                    wnd.setTouchable(false).then(() => {
                        console.log(msgStr + ' setTouchable(false) success ');
                        wnd.getProperties().then(data => {
                            expect(!data.touchable).assertTrue();
                            wnd.setTouchable(true).then(() => {
                                console.log(msgStr + ' setTouchable(true) success ');
                                wnd.getProperties().then(data => {
                                    expect(data.touchable).assertTrue();
                                    done();
                                }, (err) => {
                                    console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                })
L
liziqiang 已提交
2362
                            }, (err) => {
华华小仙女 已提交
2363
                                console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2364 2365 2366 2367
                                expect().assertFail();
                                done();
                            })
                        }, (err) => {
华华小仙女 已提交
2368
                            console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2369 2370 2371 2372
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
2373
                        console.log(msgStr + ' setTouchable failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2374 2375 2376 2377
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
2378
                    console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2379 2380 2381 2382
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2383
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2384 2385 2386 2387 2388
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2389
        /**
L
liziqiang 已提交
2390 2391 2392 2393
     * @tc.number		SUB_WMS_SETKEEPSCREENON_JSAPI_001
     * @tc.name			Test setKeepScreenOn_Test_001
     * @tc.desc			Set whether the window can be touched or not
     */
华华小仙女 已提交
2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415
        it('setKeepScreenOn_Test_001', 0, async function (done) {
            let msgStr = 'setKeepScreenOn_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getProperties().then(data => {
                    expect(!data.isKeepScreenOn).assertTrue();
                    wnd.setKeepScreenOn(true).then(() => {
                        console.log(msgStr + ' setKeepScreenOn(true) success ');
                        wnd.getProperties().then(data => {
                            expect(data.isKeepScreenOn).assertTrue();
                            wnd.setKeepScreenOn(false).then(() => {
                                console.log(msgStr + ' setKeepScreenOn(false) success ');
                                wnd.getProperties().then(data => {
                                    expect(!data.isKeepScreenOn).assertTrue();
                                    done();
                                }, (err) => {
                                    console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                })
L
liziqiang 已提交
2416
                            }, (err) => {
华华小仙女 已提交
2417
                                console.log(msgStr + ' setKeepScreenOn failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2418 2419 2420 2421
                                expect().assertFail();
                                done();
                            })
                        }, (err) => {
华华小仙女 已提交
2422
                            console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2423 2424 2425 2426
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
2427
                        console.log(msgStr + ' setKeepScreenOn failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2428 2429 2430 2431
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
2432
                    console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2433 2434 2435 2436
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2437
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2438 2439 2440 2441 2442
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2443
        /**
L
liziqiang 已提交
2444 2445 2446 2447
     * @tc.number		SUB_WMS_SETKEEPSCREENON_JSAPI_002
     * @tc.name			Test setKeepScreenOn_Test_002
     * @tc.desc			Set whether the window can be touched or not
     */
华华小仙女 已提交
2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469
        it('setKeepScreenOn_Test_002', 0, async function (done) {
            let msgStr = 'setKeepScreenOn_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                for (let i = 0; i < 5; i++) {
                    wnd.getProperties().then(data => {
                        expect(!data.isKeepScreenOn).assertTrue();
                        wnd.setKeepScreenOn(true).then(() => {
                            console.log(msgStr + ' setKeepScreenOn(true) success ');
                            wnd.getProperties().then(data => {
                                expect(data.touchable).assertTrue();
                                wnd.setKeepScreenOn(false).then(() => {
                                    console.log(msgStr + ' setKeepScreenOn(false) success ');
                                    wnd.getProperties().then(data => {
                                        expect(!data.touchable).assertTrue();
                                    }, (err) => {
                                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    })
L
liziqiang 已提交
2470
                                }, (err) => {
华华小仙女 已提交
2471
                                    console.log(msgStr + ' setKeepScreenOn failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2472 2473 2474 2475
                                    expect().assertFail();
                                    done();
                                })
                            }, (err) => {
华华小仙女 已提交
2476
                                console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2477 2478 2479 2480
                                expect().assertFail();
                                done();
                            })
                        }, (err) => {
华华小仙女 已提交
2481
                            console.log(msgStr + ' setKeepScreenOn failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2482 2483 2484 2485
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
2486
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2487 2488 2489
                        expect().assertFail();
                        done();
                    })
华华小仙女 已提交
2490 2491 2492 2493 2494 2495 2496
                }
                done();
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
L
liziqiang 已提交
2497 2498
        })

华华小仙女 已提交
2499
        /**
L
liziqiang 已提交
2500 2501 2502 2503
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_001
     * @tc.name			Test setBackgroundColor_Test_001
     * @tc.desc			Set the window background color to red and Default opacity
     */
华华小仙女 已提交
2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519
        it('setBackgroundColor_Test_001', 0, async function (done) {
            let msgStr = 'setBackgroundColor_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#ffff00").then(() => {
                    console.log(msgStr + ' setBrightness(#ffff00) success ');
                    wnd.getProperties().then(data => {
                        expect(!data.isTransparent).assertTrue();
                        done();
                    }, (err) => {
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
L
liziqiang 已提交
2520
                }, (err) => {
华华小仙女 已提交
2521
                    console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2522 2523 2524 2525
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2526
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2527 2528 2529 2530 2531
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2532
        /**
L
liziqiang 已提交
2533 2534 2535 2536
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_002
     * @tc.name			Test setBackgroundColor_Test_002
     * @tc.desc			Set the window background color to red opaque
     */
华华小仙女 已提交
2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552
        it('setBackgroundColor_Test_002', 0, async function (done) {
            let msgStr = 'setBackgroundColor_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#ffffff00").then(() => {
                    console.log(msgStr + ' setBrightness(#ffffff00) success ');
                    wnd.getProperties().then(data => {
                        expect(!data.isTransparent).assertTrue();
                        done();
                    }, (err) => {
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
L
liziqiang 已提交
2553
                }, (err) => {
华华小仙女 已提交
2554
                    console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2555 2556 2557 2558
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2559
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2560 2561 2562 2563 2564
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2565
        /**
L
liziqiang 已提交
2566 2567 2568 2569
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_003
     * @tc.name			Test setBackgroundColor_Test_003
     * @tc.desc			Set the window background color to red transparent
     */
华华小仙女 已提交
2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585
        it('setBackgroundColor_Test_003', 0, async function (done) {
            let msgStr = 'setBackgroundColor_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#00ffff00").then(() => {
                    console.log(msgStr + ' setBrightness(#00ffff00) success ');
                    wnd.getProperties().then(data => {
                        expect(data.isTransparent).assertTrue();
                        done();
                    }, (err) => {
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
L
liziqiang 已提交
2586
                }, (err) => {
华华小仙女 已提交
2587
                    console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2588 2589 2590 2591
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2592
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2593 2594 2595 2596 2597
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2598
        /**
L
liziqiang 已提交
2599 2600 2601 2602
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_004
     * @tc.name			Test setBackgroundColor_Test_004
     * @tc.desc			Set the background color input parameter as an outlier
     */
华华小仙女 已提交
2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617
        it('setBackgroundColor_Test_004', 0, async function (done) {
            let msgStr = 'setBackgroundColor_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("ff00").then(() => {
                    console.log(msgStr + ' setBrightness(#ff00) success ');
                    expect().assertFail();
                    done();
                }, (err) => {
                    console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err));
                    expect(err.code).assertEqual(1003);
                    done();
                })
L
liziqiang 已提交
2618
            }, (err) => {
华华小仙女 已提交
2619 2620
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
2621 2622 2623 2624
                done();
            })
        })

华华小仙女 已提交
2625
        /**
L
liziqiang 已提交
2626 2627 2628 2629
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_005
     * @tc.name			Test setBackgroundColor_Test_005
     * @tc.desc			Setting window background color input exception ARGB
     */
华华小仙女 已提交
2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644
        it('setBackgroundColor_Test_005', 0, async function (done) {
            let msgStr = 'setBackgroundColor_Test_005';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#hhgghhgg").then(() => {
                    console.log(msgStr + ' setBrightness(#hhgghhgg) success ');
                    expect().assertFail();
                    done();
                }, (err) => {
                    console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err));
                    expect(err.code).assertEqual(1003);
                    done();
                })
L
liziqiang 已提交
2645
            }, (err) => {
华华小仙女 已提交
2646 2647
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
2648 2649 2650 2651
                done();
            })
        })

华华小仙女 已提交
2652
        /**
L
liziqiang 已提交
2653 2654 2655 2656
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_006
     * @tc.name			Test setBackgroundColor_Test_006
     * @tc.desc			Setting window background color input exception RGB
     */
华华小仙女 已提交
2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671
        it('setBackgroundColor_Test_006', 0, async function (done) {
            let msgStr = 'setBackgroundColor_Test_006';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#gghhkk").then(() => {
                    console.log(msgStr + ' setBrightness(#gghhkk) success ');
                    expect().assertFail();
                    done();
                }, (err) => {
                    console.log(msgStr + ' setBackgroundColor failed: err' + JSON.stringify(err));
                    expect(err.code).assertEqual(1003);
                    done();
                })
L
liziqiang 已提交
2672
            }, (err) => {
华华小仙女 已提交
2673 2674
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
2675 2676 2677 2678
                done();
            })
        })

华华小仙女 已提交
2679
        /**
L
liziqiang 已提交
2680 2681 2682 2683
     * @tc.number		SUB_WMS_SETBRIGHTNESS_JSAPI_001
     * @tc.name			Test setBrightness_Test_001
     * @tc.desc			Setting the brightness bar input parameter is normal
     */
华华小仙女 已提交
2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710
        it('setBrightness_Test_001', 0, async function (done) {
            let msgStr = 'setBrightness_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBrightness(0).then(() => {
                    console.log(msgStr + ' setBrightness(0) success ');
                    wnd.getProperties().then(data => {
                        console.log(msgStr + ' getProperties data ' + data);
                        expect(data.brightness).assertEqual(0);
                        wnd.setBrightness(0.5).then(() => {
                            console.log(msgStr + ' setBrightness(0.5) success ');
                            wnd.getProperties().then(data => {
                                console.log(msgStr + ' getProperties data ' + data);
                                expect(data.brightness).assertEqual(0.5);
                                wnd.setBrightness(1).then(() => {
                                    console.log(msgStr + ' setBrightness(1) success ');
                                    wnd.getProperties().then(data => {
                                        console.log(msgStr + ' getProperties data ' + data);
                                        expect(data.brightness).assertEqual(1);
                                        done();
                                    }, (err) => {
                                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    })
L
liziqiang 已提交
2711
                                }, (err) => {
华华小仙女 已提交
2712
                                    console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2713 2714 2715 2716
                                    expect().assertFail();
                                    done();
                                })
                            }, (err) => {
华华小仙女 已提交
2717
                                console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2718 2719 2720
                                expect().assertFail();
                                done();
                            })
华华小仙女 已提交
2721

L
liziqiang 已提交
2722
                        }, (err) => {
华华小仙女 已提交
2723
                            console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2724 2725 2726 2727
                            expect().assertFail();
                            done();
                        })
                    }, (err) => {
华华小仙女 已提交
2728
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2729 2730 2731 2732
                        expect().assertFail();
                        done();
                    })
                }, (err) => {
华华小仙女 已提交
2733
                    console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2734 2735 2736 2737
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2738
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2739 2740 2741 2742 2743
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2744
        /**
L
liziqiang 已提交
2745 2746 2747 2748
     * @tc.number		SUB_WMS_SETBRIGHTNESS_JSAPI_002
     * @tc.name			Test setBrightness_Test_002
     * @tc.desc			Set the brightness bar input parameter to decimal
     */
华华小仙女 已提交
2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765
        it('setBrightness_Test_002', 0, async function (done) {
            let msgStr = 'setBrightness_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBrightness(0.564789).then(() => {
                    console.log(msgStr + ' setBrightness(0.564789) success ');
                    wnd.getProperties().then(data => {
                        console.log(msgStr + ' getProperties data ' + data);
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }, (err) => {
                        console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    })
L
liziqiang 已提交
2766
                }, (err) => {
华华小仙女 已提交
2767
                    console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2768 2769 2770 2771
                    expect().assertFail();
                    done();
                })
            }, (err) => {
华华小仙女 已提交
2772
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2773 2774 2775 2776 2777
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2778
        /**
L
liziqiang 已提交
2779 2780 2781 2782
     * @tc.number		SUB_WMS_SETBRIGHTNESS_JSAPI_003
     * @tc.name			Test setBrightness_Test_003
     * @tc.desc			Set the brightness bar input parameter to number max
     */
华华小仙女 已提交
2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797
        it('setBrightness_Test_003', 0, async function (done) {
            let msgStr = 'setBrightness_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBrightness(Number.MAX_VALUE).then(() => {
                    console.log(msgStr + ' setBrightness(Number.MAX_VALUE) success ');
                    expect().assertFail();
                    done();
                }, (err) => {
                    console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
                    expect(err.code).assertEqual(1003);
                    done();
                })
L
liziqiang 已提交
2798
            }, (err) => {
华华小仙女 已提交
2799 2800
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
L
liziqiang 已提交
2801 2802 2803 2804
                done();
            })
        })

华华小仙女 已提交
2805
        /**
L
liziqiang 已提交
2806 2807 2808 2809
     * @tc.number		SUB_WMS_SETBRIGHTNESS_JSAPI_004
     * @tc.name			Test setBrightness_Test_004
     * @tc.desc			Set the brightness bar input parameter to number min
     */
华华小仙女 已提交
2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824
        it('setBrightness_Test_004', 0, async function (done) {
            let msgStr = 'setBrightness_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBrightness(Number.MIN_VALUE).then(() => {
                    console.log(msgStr + ' setBrightness(Number.MIN_VALUE) success ');
                    expect(TRUE_WINDOW).assertTrue();
                    done();
                }, (err) => {
                    console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
                    expect().assertFail();
                    done();
                })
L
liziqiang 已提交
2825
            }, (err) => {
华华小仙女 已提交
2826
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
L
liziqiang 已提交
2827 2828 2829 2830 2831
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2832
        /**
L
liziqiang 已提交
2833 2834 2835 2836
     * @tc.number		SUB_WMS_SETBRIGHTNESS_JSAPI_005
     * @tc.name			Test setBrightness_Test_005
     * @tc.desc			Setting brightness bar input parameter exception
     */
华华小仙女 已提交
2837 2838 2839 2840 2841 2842 2843 2844
        it('setBrightness_Test_005', 0, async function (done) {
            let msgStr = 'setBrightness_Test_005';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBrightness(1.1).then(() => {
                    console.log(msgStr + ' setBrightness(1.1) success ');
L
liziqiang 已提交
2845 2846 2847
                    expect().assertFail();
                    done();
                }, (err) => {
华华小仙女 已提交
2848
                    console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
H
hk_js 已提交
2849
                    expect(err.code).assertEqual(1003);
华华小仙女 已提交
2850 2851 2852 2853 2854 2855 2856 2857 2858
                    wnd.setBrightness(-0.1).then(() => {
                        console.log(msgStr + ' setBrightness(-0.1) success ');
                        expect().assertFail();
                        done();
                    }, (err) => {
                        console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
                        expect(err.code).assertEqual(1003);
                        done();
                    })
L
liziqiang 已提交
2859
                })
华华小仙女 已提交
2860 2861 2862 2863
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
L
liziqiang 已提交
2864 2865 2866
            })
        })

华华小仙女 已提交
2867
        /**
2868 2869 2870 2871
     * @tc.number		SUB_WMS_setDimBehind_JSAPI_001
     * @tc.name			Test setDimBehindDeviceNotSupport_Test_001
     * @tc.desc			Set the setDimBehind interface invalid
     */
华华小仙女 已提交
2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888
        it('setDimBehindDeviceNotSupport_Test_001', 0, async function (done) {
            let msgStr = 'setDimBehindDeviceNotSupport_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setDimBehind(0.5).then(() => {
                    console.info(msgStr + ' not support success ');
                    expect().assertFail();
                    done();
                }, err => {
                    console.info(msgStr + ' failed: err' + JSON.stringify(err));
                    expect(err.code).assertEqual(801);
                    done();
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
2889 2890 2891 2892 2893
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2894
        /**
2895 2896 2897 2898
     * @tc.number		SUB_WMS_setDimBehind_JSAPI_002
     * @tc.name			Test setDimBehindDeviceNotSupport_Test_002
     * @tc.desc			Set the setDimBehind interface invalid
     */
华华小仙女 已提交
2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919
        it('setDimBehindDeviceNotSupport_Test_002', 0, async function (done) {
            let msgStr = 'setDimBehindDeviceNotSupport_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setDimBehind(0.5, (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the dimness2. Cause: ' + JSON.stringify(err));
                        expect(err.code).assertEqual(801);
                        done();
                    } else {
                        console.info(msgStr + ' not support success ');
                        expect().assertFail();
                        done();
                    }
                })
            }, (err) => {
                console.log('windowTest setDimBehind2 getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
2920 2921 2922
            })
        })

华华小仙女 已提交
2923
        /**
2924 2925 2926 2927
     * @tc.number		SUB_WMS_setOutsideTouchable_JSAPI_001
     * @tc.name			Test setOutsideTouchableDeviceNotSupport_Test_001
     * @tc.desc			Set the setOutsideTouchable interface invalid
     */
华华小仙女 已提交
2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944
        it('setOutsideTouchable_Test_001', 0, async function (done) {
            let msgStr = 'setOutsideTouchable_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setOutsideTouchable(true).then(() => {
                    console.info(msgStr + ' not support success ');
                    expect().assertFail();
                    done();
                }, err => {
                    console.info(msgStr + ' failed: err' + JSON.stringify(err));
                    expect(err.code).assertEqual(801);
                    done();
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
2945 2946 2947 2948 2949
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2950
        /**
2951 2952 2953 2954
     * @tc.number		SUB_WMS_setOutsideTouchable__JSAPI_002
     * @tc.name			Test setOutsideTouchableDeviceNotSupport_Test_002
     * @tc.desc			Set the setOutsideTouchable interface invalid
     */
华华小仙女 已提交
2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971
        it('setOutsideTouchable_Test_002', 0, async function (done) {
            let msgStr = 'setOutsideTouchable_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setOutsideTouchable(false).then(() => {
                    console.info(msgStr + ' not support success ');
                    expect().assertFail();
                    done();
                }, err => {
                    console.info(msgStr + ' failed: err' + JSON.stringify(err));
                    expect(err.code).assertEqual(801);
                    done();
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
2972 2973 2974 2975 2976
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
2977
        /**
2978 2979 2980 2981
     * @tc.number		SUB_WMS_setOutsideTouchable_JSAPI_003
     * @tc.name			Test setOutsideTouchable_Test_003
     * @tc.desc			Set the setOutsideTouchable interface invalid
     */
华华小仙女 已提交
2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002
        it('setOutsideTouchable_Test_003', 0, async function (done) {
            let msgStr = 'setOutsideTouchable_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setOutsideTouchable(true, (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the area to be touchable1. err: ' + JSON.stringify(err));
                        expect(err.code).assertEqual(801);
                        done();
                    } else {
                        console.info(msgStr + ' not support success ');
                        expect().assertFail();
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
3003 3004 3005
            })
        })

华华小仙女 已提交
3006
        /**
3007 3008 3009 3010
    * @tc.number		SUB_WMS_setOutsideTouchable_JSAPI_004
    * @tc.name			Test setOutsideTouchable_Test_004
    * @tc.desc			Set the setOutsideTouchable interface invalid
    */
华华小仙女 已提交
3011 3012 3013 3014 3015 3016 3017
        it('setOutsideTouchable_Test_004', 0, async function (done) {
            let msgStr = 'setOutsideTouchable_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setOutsideTouchable(false, (err, data) => {
3018
                    if (err.code) {
华华小仙女 已提交
3019 3020
                        console.error(msgStr + 'Failed to set the area to be touchable4. err: ' + JSON.stringify(err));
                        expect(err.code).assertEqual(801);
3021 3022
                        done();
                    } else {
华华小仙女 已提交
3023 3024 3025
                        console.info(msgStr + ' not support success ');
                        expect().assertFail();
                        done();
3026 3027 3028
                    }
                })
            }, (err) => {
华华小仙女 已提交
3029
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
3030 3031 3032 3033 3034
                expect().assertFail();
                done();
            })
        })

华华小仙女 已提交
3035 3036 3037 3038
        /**
     * @tc.number		SUB_WMS_ENUM_ORIENTATION_JSAPI_001
     * @tc.name			Test enumOrientation_Test_001.
     * @tc.desc			To test the enum value of Orientation.
3039
     */
华华小仙女 已提交
3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074
        it('enumOrientation_Test_001', 0, async function (done) {
            let msgStr = 'setOutsideTouchable_Test_004';
            console.log(msgStr + ' begin');
            try {
                expect(0).assertEqual(window.Orientation.UNSPECIFIED);
                expect(1).assertEqual(window.Orientation.PORTRAIT);
                expect(2).assertEqual(window.Orientation.LANDSCAPE);
                expect(3).assertEqual(window.Orientation.PORTRAIT_INVERTED);
                expect(4).assertEqual(window.Orientation.LANDSCAPE_INVERTED);
                expect(5).assertEqual(window.Orientation.AUTO_ROTATION);
                expect(6).assertEqual(window.Orientation.AUTO_ROTATION_PORTRAIT);
                expect(7).assertEqual(window.Orientation.AUTO_ROTATION_LANDSCAPE);
                expect(8).assertEqual(window.Orientation.AUTO_ROTATION_RESTRICTED);
                expect(9).assertEqual(window.Orientation.AUTO_ROTATION_PORTRAIT_RESTRICTED);
                expect(10).assertEqual(window.Orientation.AUTO_ROTATION_LANDSCAPE_RESTRICTED);
                expect(11).assertEqual(window.Orientation.LOCKED);
                done();
            } catch (err) {
                console.info(msgStr + 'test enum value of windowStageEventType error ' + JSON.stringify(err));
                expect().assertFail();
                done();
            }
        })

        /**
     * @tc.number		SUB_WMS_SETKEEPSCREENONCALLBACK_JSAPI_001
     * @tc.name			Test setKeepScreenOnCallBack_Test_001
    * @tc.desc			Set whether setKeepScreenOn or not
    */
        it('setKeepScreenOnCallBack_Test_001', 0, async function (done) {
            let msgStr = 'setKeepScreenOnCallBack_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
3075 3076
                wnd.getProperties().then(data => {
                    expect(!data.isKeepScreenOn).assertTrue();
华华小仙女 已提交
3077
                    wnd.setKeepScreenOn(true, (err, data) => {
3078
                        if (err.code) {
华华小仙女 已提交
3079
                            console.error(msgStr + 'Failed to set the screen to be always on. err: ' + JSON.stringify(err));
3080 3081 3082
                            expect().assertFail();
                            done();
                        } else {
华华小仙女 已提交
3083
                            console.info(msgStr + 'success set the screen to be always on. data: ' + JSON.stringify(data));
3084
                            wnd.getProperties().then(data => {
华华小仙女 已提交
3085
                                expect(data.isKeepScreenOn).assertTrue();
3086 3087
                                done();
                            }, (err) => {
华华小仙女 已提交
3088
                                console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err));
3089 3090 3091 3092 3093 3094
                                expect().assertFail();
                                done();
                            })
                        }
                    })
                }, (err) => {
华华小仙女 已提交
3095
                    console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err));
3096 3097 3098
                    expect().assertFail();
                    done();
                })
华华小仙女 已提交
3099 3100 3101 3102 3103
            }, (err) => {
                console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
3104
        })
3105

华华小仙女 已提交
3106 3107 3108 3109
        /**
     * @tc.number		SUB_WMS_SETKEEPSCREENON_JSAPI_002
     * @tc.name			Test setKeepScreenOnCallBack_Test_002
     * @tc.desc			Set whether the window can be touched or not
H
hk_js 已提交
3110
     */
华华小仙女 已提交
3111 3112 3113 3114 3115 3116 3117
        it('setKeepScreenOnCallBack_Test_002', 0, async function (done) {
            let msgStr = 'setKeepScreenOnCallBack_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                for (let i = 0; i < 5; i++) {
H
hk_js 已提交
3118
                    wnd.getProperties().then(data => {
华华小仙女 已提交
3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136
                        expect(!data.isKeepScreenOn).assertTrue();
                        wnd.setKeepScreenOn(false, (err, data) => {
                            if (err.code) {
                                console.error(msgStr + 'Failed to set the screen to be always on. err: ' + JSON.stringify(err));
                                expect().assertFail();
                                done();
                            } else {
                                console.info(msgStr + 'success set the screen to be always on. data: ' + JSON.stringify(data));
                                wnd.getProperties().then(data => {
                                    expect(!data.isKeepScreenOn).assertTrue();
                                    done();
                                }, (err) => {
                                    console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                    expect().assertFail();
                                    done();
                                })
                            }
                        })
H
hk_js 已提交
3137
                    }, (err) => {
华华小仙女 已提交
3138
                        console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err));
H
hk_js 已提交
3139 3140 3141 3142
                        expect().assertFail();
                        done();
                    })
                }
华华小仙女 已提交
3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182
                done();
            }, (err) => {
                console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
            })
        })

        /**
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLORCALLBACK_JSAPI_001
     * @tc.name			Test setBackgroundColorCALLBack_Test_001
     * @tc.desc			Set the window background color to red and Default opacity
     */
        it('setBackgroundColorCallBack_Test_001', 0, async function (done) {
            let msgStr = 'setBackgroundColorCallBack_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#ffff00", (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the background color. err: ' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        console.info(msgStr + 'Succeeded in setting the background color. Data: ' + JSON.stringify(data));
                        wnd.getProperties().then(data => {
                            expect(!data.isTransparent).assertTrue();
                            done();
                        }, (err) => {
                            console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }
                })
            }, (err) => {
                console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3183 3184 3185
            })
        })

华华小仙女 已提交
3186
        /**
H
hk_js 已提交
3187 3188 3189 3190
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLORCALLBACK_JSAPI_002
     * @tc.name			Test setBackgroundColorCallBack_Test_002
    * @tc.desc			Set the window background color to red opaque
    */
华华小仙女 已提交
3191 3192 3193 3194 3195 3196 3197 3198 3199
        it('setBackgroundColorCallBack_Test_002', 0, async function (done) {
            let msgStr = 'setBackgroundColorCallBack_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#ffffff00", (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the background color2. err: ' + JSON.stringify(err));
H
hk_js 已提交
3200 3201
                        expect().assertFail();
                        done();
华华小仙女 已提交
3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217
                    } else {
                        console.info(msgStr + 'Succeeded in setting the background color2. Data: ' + JSON.stringify(data));
                        wnd.getProperties().then(data => {
                            expect(!data.isTransparent).assertTrue();
                            done();
                        }, (err) => {
                            console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3218 3219 3220
            })
        })

华华小仙女 已提交
3221
        /**
H
hk_js 已提交
3222 3223 3224 3225
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLORCallBack_JSAPI_003
     * @tc.name			Test setBackgroundColorBack_Test_003
     * @tc.desc			Set the window background color to red transparent
     */
华华小仙女 已提交
3226 3227 3228 3229 3230 3231 3232 3233 3234
        it('setBackgroundColorCallBack_Test_003', 0, async function (done) {
            let msgStr = 'setBackgroundColorCallBack_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#00ffff00", (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the background color2. err: ' + JSON.stringify(err));
H
hk_js 已提交
3235 3236
                        expect().assertFail();
                        done();
华华小仙女 已提交
3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252
                    } else {
                        console.info(msgStr + 'Succeeded in setting the background color2. Data: ' + JSON.stringify(data));
                        wnd.getProperties().then(data => {
                            expect(data.isTransparent).assertTrue();
                            done();
                        }, (err) => {
                            console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3253 3254 3255
            })
        })

华华小仙女 已提交
3256
        /**
H
hk_js 已提交
3257 3258
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLORCallBACK_JSAPI_004
     * @tc.name			Test setBackgroundColorCallBack_Test_004
H
hk_js 已提交
3259 3260
     * @tc.desc			Set the background color input parameter as an outlier
     */
华华小仙女 已提交
3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281
        it('setBackgroundColorCallBack_Test_004', 0, async function (done) {
            let msgStr = 'setBackgroundColorCallBack_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("ff00", (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the background color2. err: ' + JSON.stringify(err));
                        expect(err.code).assertEqual(1003);
                        done();
                    } else {
                        console.info(msgStr + 'Succeeded in setting the background color2. Data: ' + JSON.stringify(data));
                        expect().assertFail();
                        done();
                    }
                })
            }, (err) => {
                console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3282 3283 3284
            })
        })

华华小仙女 已提交
3285
        /**
H
hk_js 已提交
3286 3287 3288 3289
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLORCallBack_JSAPI_005
     * @tc.name			Test setBackgroundColorCallBack_Test_005
     * @tc.desc			Setting window background color input exception ARGB
     */
华华小仙女 已提交
3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310
        it('setBackgroundColorCallBack_Test_005', 0, async function (done) {
            let msgStr = 'setBackgroundColorCallBack_Test_005';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#hhgghhgg", (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the background color5. err: ' + JSON.stringify(err));
                        expect(err.code).assertEqual(1003);
                        done();
                    } else {
                        console.info(msgStr + 'Succeeded in setting the background color5. Data: ' + JSON.stringify(data));
                        expect().assertFail();
                        done();
                    }
                })
            }, (err) => {
                console.info(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3311 3312 3313
            })
        })

华华小仙女 已提交
3314
        /**
H
hk_js 已提交
3315 3316 3317 3318
     * @tc.number		SUB_WMS_SETBACKGROUNDCOLORCallBack_JSAPI_006
     * @tc.name			Test setBackgroundColorBack_Test_006
     * @tc.desc			Setting window background color input exception RGB
     */
华华小仙女 已提交
3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339
        it('setBackgroundColorCallBack_Test_006', 0, async function (done) {
            let msgStr = 'setBackgroundColorCallBack_Test_006';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBackgroundColor("#gghhkk", (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the background color6. err: ' + JSON.stringify(err));
                        expect(err.code).assertEqual(1003);
                        done();
                    } else {
                        console.info(msgStr + 'Succeeded in setting the background color6. Data: ' + JSON.stringify(data));
                        expect().assertFail();
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3340 3341 3342
            })
        })

华华小仙女 已提交
3343
        /**
H
hk_js 已提交
3344 3345 3346 3347
     * @tc.number		SUB_WMS_SETBRIGHTNESSCALLBACK_JSAPI_002
     * @tc.name			Test setBrightnessCallBack_Test_002
     * @tc.desc			Set the brightness bar input parameter to decimal
     */
华华小仙女 已提交
3348 3349 3350 3351 3352 3353 3354 3355 3356
        it('setBrightnessCallBack_Test_002', 0, async function (done) {
            let msgStr = 'setBrightnessCallBack_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBrightness(1, (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the brightness2. err: ' + JSON.stringify(err));
H
hk_js 已提交
3357 3358
                        expect().assertFail();
                        done();
华华小仙女 已提交
3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370
                    } else {
                        console.info(msgStr + 'Succeeded in setting the brightness2. Data: ' + JSON.stringify(data));
                        wnd.getProperties().then(data => {
                            console.info(msgStr + ' getProperties data ' + data);
                            expect(data.brightness).assertEqual(1);
                            done();
                        }, (err) => {
                            console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                            expect().assertFail();
                            done();
                        })
                    }
H
hk_js 已提交
3371

华华小仙女 已提交
3372 3373 3374 3375 3376
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3377 3378 3379
            })
        })

华华小仙女 已提交
3380
        /**
H
hk_js 已提交
3381 3382 3383 3384
     * @tc.number		SUB_WMS_SETBRIGHTNESSCALLBACK_JSAPI_003
     * @tc.name			Test setBrightnessCallBack_Test_003
     * @tc.desc			Set the brightness bar input parameter to number max
     */
华华小仙女 已提交
3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405
        it('setBrightnessCallBack_Test_003', 0, async function (done) {
            let msgStr = 'setBrightnessCallBack_Test_003';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBrightness(Number.MAX_VALUE, (err, data) => {
                    if (err.code) {
                        console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
                        expect(err.code).assertEqual(1003);
                        done();
                    } else {
                        console.log(msgStr + ' setBrightness(Number.MAX_VALUE) success ');
                        expect().assertFail();
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3406 3407 3408
            })
        })

华华小仙女 已提交
3409
        /**
H
hk_js 已提交
3410 3411 3412 3413
     * @tc.number		SUB_WMS_SETBRIGHTNESSCALLBACK_JSAPI_004
     * @tc.name			Test setBrightnessCallBack_Test_004
     * @tc.desc			Set the brightness bar input parameter to number min
     */
华华小仙女 已提交
3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434
        it('setBrightnessCallBack_Test_004', 0, async function (done) {
            let msgStr = 'setBrightnessCallBack_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBrightness(Number.MIN_VALUE, (err, data) => {
                    if (err.code) {
                        console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
                        expect(err.code).assertEqual(1003);
                        done();
                    } else {
                        console.log(msgStr + ' setBrightness(Number.MIN_VALUE) success ');
                        expect(TRUE_WINDOW).assertTrue();
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3435 3436 3437
            })
        })

华华小仙女 已提交
3438
        /**
H
hk_js 已提交
3439 3440 3441 3442
     * @tc.number		SUB_WMS_SETBRIGHTNESSCALLBACK_JSAPI_005
     * @tc.name			Test setBrightnessCALLBACK_Test_005
     * @tc.desc			Setting brightness bar input parameter exception
     */
华华小仙女 已提交
3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463
        it('setBrightnessCallBack_Test_005', 0, async function (done) {
            let msgStr = 'setBrightnessCallBack_Test_004';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setBrightness(1.1, (err, data) => {
                    if (err.code) {
                        console.log(msgStr + ' setBrightness failed: err' + JSON.stringify(err));
                        expect(err.code).assertEqual(1003);
                        done();
                    } else {
                        console.log(msgStr + ' setBrightness(1.1) success ');
                        expect().assertFail();
                        done();
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3464 3465 3466
            })
        })

华华小仙女 已提交
3467
        /**
H
hk_js 已提交
3468 3469 3470 3471
     * @tc.number		SUB_WMS_SETTOUCHABLECALLBACK_JSAPI_001
     * @tc.name			Test setTouchableCallBack_Test_001
     * @tc.desc			Set whether the window can be touched or not
    */
华华小仙女 已提交
3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488
        it('setTouchableCallBack_Test_001', 0, async function (done) {
            let msgStr = 'setTouchableCallBack_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setTouchable(false, (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the window to be touchable. err:' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        wnd.getProperties().then(data => {
                            expect(!data.touchable).assertTrue();
                            wnd.setTouchable(true, (err, data) => {
                                if (err.code) {
                                    console.error(msgStr + 'Failed to set the window to be touchable. err:' + JSON.stringify(err));
H
hk_js 已提交
3489 3490
                                    expect().assertFail();
                                    done();
华华小仙女 已提交
3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505
                                } else {
                                    wnd.getProperties().then(data => {
                                        expect(data.touchable).assertTrue();
                                        done();
                                    }, (err) => {
                                        console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    })
                                }
                            })
                        }, (err) => {
                            console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                            expect().assertFail();
                            done();
H
hk_js 已提交
3506
                        })
华华小仙女 已提交
3507 3508 3509 3510 3511 3512
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3513 3514 3515
            })
        })

华华小仙女 已提交
3516
        /**
H
hk_js 已提交
3517 3518 3519 3520
     * @tc.number		SUB_WMS_SETFOCUSABLECALLBACK_JSAPI_001
     * @tc.name			Test setFocusable_Test_001
     * @tc.desc			Setting window focus acquisition and defocus
     */
华华小仙女 已提交
3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537
        it('setFocusableCallBack_Test_001', 0, async function (done) {
            let msgStr = 'setFocusableCallBack_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.log(msgStr + ' getTopWindow wnd' + wnd);
                expect(wnd != null).assertTrue();
                wnd.setFocusable(false, (err, data) => {
                    if (err.code) {
                        console.error(msgStr + 'Failed to set the window to be setFocusable. err:' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        wnd.getProperties().then(data => {
                            expect(!data.focusable).assertTrue();
                            wnd.setFocusable(true, (err, data) => {
                                if (err.code) {
                                    console.error(msgStr + 'Failed to set the window to be setFocusable. err:' + JSON.stringify(err));
H
hk_js 已提交
3538 3539
                                    expect().assertFail();
                                    done();
华华小仙女 已提交
3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554
                                } else {
                                    wnd.getProperties().then(data => {
                                        expect(data.focusable).assertTrue();
                                        done();
                                    }, (err) => {
                                        console.info(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                                        expect().assertFail();
                                        done();
                                    })
                                }
                            })
                        }, (err) => {
                            console.log(msgStr + ' getProperties failed: err' + JSON.stringify(err));
                            expect().assertFail();
                            done();
H
hk_js 已提交
3555
                        })
华华小仙女 已提交
3556 3557 3558 3559 3560 3561
                    }
                })
            }, (err) => {
                console.log(msgStr + ' getTopWindow failed: err' + JSON.stringify(err));
                expect().assertFail();
                done();
H
hk_js 已提交
3562 3563
            })

华华小仙女 已提交
3564
        })
H
hk_js 已提交
3565

华华小仙女 已提交
3566
        /**
H
hk_js 已提交
3567 3568 3569 3570
     * @tc.number		SUB_WMS_ENUM_AVOIDAREATYPE_JSAPI_001
     * @tc.name			Test avoidareatype_Test_001.
     * @tc.desc			To test the enum value of avoidareatype.
    */
华华小仙女 已提交
3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585
        it('enumAvoidAreaType_Test_001', 0, async function (done) {
            let msgStr = 'enumAvoidAreaType_Test_001';
            console.log(msgStr + ' begin');
            try {
                expect(0).assertEqual(window.AvoidAreaType.TYPE_SYSTEM);
                expect(1).assertEqual(window.AvoidAreaType.TYPE_CUTOUT);
                expect(2).assertEqual(window.AvoidAreaType.TYPE_SYSTEM_GESTURE);
                expect(3).assertEqual(window.AvoidAreaType.TYPE_KEYBOARD);
                done();
            } catch (err) {
                console.info(msgStr + 'test enum value of AvoidArea error :' + JSON.stringify(err));
                expect().assertFail();
                done();
            }
        })
H
hk_js 已提交
3586

华华小仙女 已提交
3587
        /**
H
hk_js 已提交
3588 3589 3590 3591
     * @tc.number    SUB_WMS_GETAVOIDAREAADD_JSAPI_001
     * @tc.name      Test getAvoidAreaAdd_Test_001
     * @tc.desc      Get System type avoidance area
    */
华华小仙女 已提交
3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611
        it('getAvoidAreaAdd_Test_001', 0, async function (done) {
            let msgStr = 'enumAvoidAreaType_Test_001';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getAvoidArea(window.AvoidAreaType.TYPE_KEYBOARD, (err, data) => {
                    if (err.code != 0) {
                        console.log(msgStr + ' wnd.getAvoidArea callback fail err:' + JSON.stringify(err));
                        expect().assertFail();
                        done();
                    } else {
                        expect(data.visible).assertTrue();
                        expect(data.topRect != null).assertTrue();
                        expect(data.rightRect != null).assertTrue();
                        expect(data.bottomRect != null).assertTrue();
                        expect(data.leftRect != null).assertTrue();
                        done();
                    }
                })
H
hk_js 已提交
3612 3613 3614
            })
        })

华华小仙女 已提交
3615
        /**
H
hk_js 已提交
3616 3617 3618 3619
     * @tc.number    SUB_WMS_GETAVOIDAREAADD_JSAPI_002
     * @tc.name      Test getAvoidAreaAdd_Test_002
     * @tc.desc      Get invalid parameter avoidarea
     */
华华小仙女 已提交
3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636
        it('getAvoidAreaAdd_Test_002', 0, async function (done) {
            let msgStr = 'getAvoidAreaAdd_Test_002';
            console.log(msgStr + ' begin');
            window.getTopWindow().then(wnd => {
                console.info(msgStr + ' window.getTopWindow wnd: ' + wnd);
                expect(wnd != null).assertTrue();
                wnd.getAvoidArea(-1, (err, data) => {
                    console.info(msgStr + ' data:' + JSON.stringify(data));
                    if (err.code != 0) {
                        console.log(msgStr + ' wnd.getAvoidArea callback fail' + JSON.stringify(err));
                        expect(err.code).assertEqual(1003);
                        done();
                    } else {
                        expect().assertFail();
                        done();
                    }
                })
H
hk_js 已提交
3637 3638 3639
            })
        })

华华小仙女 已提交
3640
    })
J
jiyong_sd 已提交
3641
}