AccessibleCaptionConfiguration.test.js 3.6 KB
Newer Older
Y
yichengzhao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * 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.
 */
J
jiyong_sd 已提交
15
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
Y
yichengzhao 已提交
16
import accessibility from '@ohos.accessibility'
Y
yichengzhao 已提交
17

J
jiyong_sd 已提交
18
export default function AccessibleCaptionConfiguration() {
Y
yichengzhao 已提交
19 20
describe('AccessibleCaptionConfiguration', function () {

Y
yichengzhao 已提交
21 22 23 24 25 26 27 28 29 30
  beforeEach(async function (done) {
    console.info(`AccessibleCaptionConfiguration: beforeEach starts`);
    done();
  })

  afterEach(async function (done) {
    console.info(`AccessibleCaptionConfiguration: afterEach starts`);
    setTimeout(done, 1000);
  })

Y
yichengzhao 已提交
31 32 33 34 35

  /*
   * @tc.number  CaptionConfiguration_0010
   * @tc.name    CaptionConfiguration_0010
   * @tc.desc    The parameter input is 'enableChange', test the captionManager.on() function,
Y
yichengzhao 已提交
36
   *             and return undefined 
Y
yichengzhao 已提交
37 38 39 40 41 42 43
   * @tc.size    SmallTest
   * @tc.type    User
   */
  it('CaptionConfiguration_0010', 0, async function (done) {
    console.info('CaptionConfiguration_0010');
    let captionManager = accessibility.getCaptionsManager();
    let stateEventType = 'enableChange';
Y
yichengzhao 已提交
44 45 46
    let ret = captionManager.on(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
    done();
Y
yichengzhao 已提交
47 48 49 50 51 52
  })

  /*
   * @tc.number  CaptionConfiguration_0020
   * @tc.name    CaptionConfiguration_0020
   * @tc.desc    The parameter input is 'styleChange', test the captionManager.on() function,
Y
yichengzhao 已提交
53
   *             and return undefined 
Y
yichengzhao 已提交
54 55 56
   * @tc.size    SmallTest
   * @tc.type    User
   */
Y
yichengzhao 已提交
57 58 59
  it('CaptionConfiguration_0020', 0, async function (done) {
    console.info('CaptionConfiguration_0020');
    let captionManager = accessibility.getCaptionsManager();
Y
yichengzhao 已提交
60
    let stateEventType = 'styleChange';
Y
yichengzhao 已提交
61 62 63
    let ret = captionManager.on(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
    done();
Y
yichengzhao 已提交
64 65
  })

Y
yichengzhao 已提交
66 67 68
   /*
   * @tc.number  CaptionConfiguration_0050
   * @tc.name    CaptionConfiguration_0050
Y
yichengzhao 已提交
69
   * @tc.desc    The parameter input is 'enableChange', test the captionManager.off() function,
Y
yichengzhao 已提交
70
   *             and return undefined 
Y
yichengzhao 已提交
71 72 73
   * @tc.size    SmallTest
   * @tc.type    User
   */
Y
yichengzhao 已提交
74 75
   it('CaptionConfiguration_0050', 0, async function (done) {
    console.info('CaptionConfiguration_0050');
Y
yichengzhao 已提交
76
    let captionManager = accessibility.getCaptionsManager();
Y
yichengzhao 已提交
77 78 79 80
    let stateEventType = 'enableChange';
    let ret = captionManager.off(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
    done();
Y
yichengzhao 已提交
81 82
  })

Y
yichengzhao 已提交
83
  /*
Y
yichengzhao 已提交
84 85
   * @tc.number  CaptionConfiguration_0060
   * @tc.name    CaptionConfiguration_0060
Y
yichengzhao 已提交
86
   * @tc.desc    The parameter input is 'styleChange', test the captionManager.off() function,
Y
yichengzhao 已提交
87
   *             and return undefined 
Y
yichengzhao 已提交
88 89 90
   * @tc.size    SmallTest
   * @tc.type    User
   */
Y
yichengzhao 已提交
91 92
  it('CaptionConfiguration_0060', 0, async function (done) {
    console.info('CaptionConfiguration_0060');
Y
yichengzhao 已提交
93
    let captionManager = accessibility.getCaptionsManager();
Y
yichengzhao 已提交
94 95 96
    let stateEventType = 'styleChange';
    let ret = captionManager.off(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
Y
yichengzhao 已提交
97 98
    done();
  })
Y
yichengzhao 已提交
99
})
J
jiyong_sd 已提交
100
}