AccessibleCaptionConfiguration.test.js 6.0 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
  })

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
  /*
   * @tc.number  CaptionConfiguration_0030
   * @tc.name    CaptionConfiguration_0030
   * @tc.desc    The parameter input is '', test the captionManager.on() function,
   *             and return undefined 
   * @tc.size    SmallTest
   * @tc.type    User
   */
  it('CaptionConfiguration_0030', 0, async function (done) {
    console.info('CaptionConfiguration_0030');
    let captionManager = accessibility.getCaptionsManager();
    let stateEventType = '';
    let ret = captionManager.on(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
    done();
  })

  /*
   * @tc.number  CaptionConfiguration_0040
   * @tc.name    CaptionConfiguration_0040
   * @tc.desc    The parameter input is null, test the captionManager.on() function,
   *             and return undefined 
   * @tc.size    SmallTest
   * @tc.type    User
   */
  it('CaptionConfiguration_0040', 0, async function (done) {
    console.info('CaptionConfiguration_0040');
    let captionManager = accessibility.getCaptionsManager();
    let stateEventType = null;
    let ret = captionManager.on(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
    done();
  })

Y
yichengzhao 已提交
100 101 102
   /*
   * @tc.number  CaptionConfiguration_0050
   * @tc.name    CaptionConfiguration_0050
Y
yichengzhao 已提交
103
   * @tc.desc    The parameter input is 'enableChange', test the captionManager.off() function,
Y
yichengzhao 已提交
104
   *             and return undefined 
Y
yichengzhao 已提交
105 106 107
   * @tc.size    SmallTest
   * @tc.type    User
   */
Y
yichengzhao 已提交
108 109
   it('CaptionConfiguration_0050', 0, async function (done) {
    console.info('CaptionConfiguration_0050');
Y
yichengzhao 已提交
110
    let captionManager = accessibility.getCaptionsManager();
Y
yichengzhao 已提交
111 112 113 114
    let stateEventType = 'enableChange';
    let ret = captionManager.off(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
    done();
Y
yichengzhao 已提交
115 116
  })

Y
yichengzhao 已提交
117
  /*
Y
yichengzhao 已提交
118 119
   * @tc.number  CaptionConfiguration_0060
   * @tc.name    CaptionConfiguration_0060
Y
yichengzhao 已提交
120
   * @tc.desc    The parameter input is 'styleChange', test the captionManager.off() function,
Y
yichengzhao 已提交
121
   *             and return undefined 
Y
yichengzhao 已提交
122 123 124
   * @tc.size    SmallTest
   * @tc.type    User
   */
Y
yichengzhao 已提交
125 126
  it('CaptionConfiguration_0060', 0, async function (done) {
    console.info('CaptionConfiguration_0060');
Y
yichengzhao 已提交
127
    let captionManager = accessibility.getCaptionsManager();
Y
yichengzhao 已提交
128 129 130
    let stateEventType = 'styleChange';
    let ret = captionManager.off(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
Y
yichengzhao 已提交
131 132
    done();
  })
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 166

  /*
   * @tc.number  CaptionConfiguration_0070
   * @tc.name    CaptionConfiguration_0070
   * @tc.desc    The parameter input is '', test the captionManager.off() function,
   *             and return undefined 
   * @tc.size    SmallTest
   * @tc.type    User
   */
  it('CaptionConfiguration_0070', 0, async function (done) {
    console.info('CaptionConfiguration_0070');
    let captionManager = accessibility.getCaptionsManager();
    let stateEventType = '';
    let ret = captionManager.off(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
    done();
  })

  /*
   * @tc.number  CaptionConfiguration_0080
   * @tc.name    CaptionConfiguration_0080
   * @tc.desc    The parameter input is null, test the captionManager.off() function,
   *             and return undefined 
   * @tc.size    SmallTest
   * @tc.type    User
   */
  it('CaptionConfiguration_0080', 0, async function (done) {
    console.info('CaptionConfiguration_0080');
    let captionManager = accessibility.getCaptionsManager();
    let stateEventType = null;
    let ret = captionManager.off(stateEventType, (data) => {});
    expect(ret).assertEqual(undefined);
    done();
  })
Y
yichengzhao 已提交
167
})
J
jiyong_sd 已提交
168
}