未验证 提交 22c96b0a 编写于 作者: O openharmony_ci 提交者: Gitee

!5950 回退 'Pull Request !5923 : 无障碍 ErrCode测试'

Merge pull request !5950 from openharmony_ci/revert-merge-5923-master
......@@ -19,13 +19,12 @@ group("barrierfree") {
deps = [
"accessibilityconfig:ActsAccessibilityConfigTest",
"accessibilityconfigreqreadpermission:ActsAccessibilityConfigReqReadPermissionTest",
"accessibilityconfigreqwritepermission:ActsAccessibilityConfigReqWritePermissionTest",
"accessibilityelement:ActsAccessibilityElementTest",
"accessibilityerrcode:ActsAccessibilityErrCodeTest",
"accessibilityevent:ActsAccessibilityEventTest",
"accessibilityextension:ActsAccessibilityExtensionTest",
"accessibilityextensioncontext:ActsAccessibilityExtensionContextTest",
"accessibilitygestureevent:ActsAccessibilityGestureEventTest",
"accessibilitysendaccessibilityevent:ActsAccessibilitySendAccessibilityEventTest",
"accessibleabilitylist:ActsAccessibleAbilityListTest",
"accessiblecaptionconfiguration:ActsAccessibleCaptionConfigurationTest",
"accessiblecheckability:ActsAccessibleCheckAbilityTest",
......
/*
* Copyright (c) 2022 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.
*/
import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility';
class AccessibilityExtAbility extends AccessibilityExtensionAbility {
onConnect() {
console.info("[Demo] AccessibilityExtAbility onConnect");
}
onDisconnect() {
console.info("[Demo] AccessibilityExtAbility onDisconnect");
}
onAccessibilityEvent(accessibilityEvent) {
console.info("[Demo] AccessibilityExtAbility onAccessibilityEvent: " + JSON.stringify(accessibilityEvent));
}
}
export default AccessibilityExtAbility;
\ No newline at end of file
......@@ -13,21 +13,12 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
......@@ -37,7 +28,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage)
console.log("[Demo] MainAbility onWindowStageCreate windowStage=" + windowStage)
//globalThis.windowStage = windowStage
//globalThis.abilityStorage = this.storage
globalThis.abilityContext = this.context
......
......@@ -13,10 +13,19 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
......@@ -25,13 +34,7 @@ export default class TestAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.loadContent("TestAbility/pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
windowStage.setUIContent(this.context, 'TestAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
......
......@@ -21,8 +21,7 @@ var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
......@@ -53,19 +52,14 @@ export default class OpenHarmonyTestRunner implements TestRunner {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a com.example.accessibilityxts.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
......
......@@ -38,7 +38,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_0100', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_0100');
config.highContrastText.set(true, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_0100 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -78,7 +78,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_0300', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_0300');
config.highContrastText.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_0300 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -146,7 +146,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_0700', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_0700');
config.invertColor.set(true, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_0700 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -186,7 +186,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_0900', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_0900');
config.invertColor.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_0900 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -254,7 +254,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_1300', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_1300');
config.contentTimeout.set(0, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_1300 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -294,7 +294,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_1500', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_1500');
config.contentTimeout.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_1500 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -362,7 +362,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_1900', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_1900');
config.animationOff.set(true, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_1900 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -402,7 +402,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_2100', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_2100');
config.animationOff.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_2100 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -470,7 +470,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_2500', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_2500');
config.brightnessDiscount.set(0.1, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_2500 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -510,7 +510,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_2700', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_2700');
config.brightnessDiscount.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_2700 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -578,7 +578,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_4900', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_4900');
config.mouseKey.set(true, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_4900 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -618,7 +618,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_5100', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_5100');
config.mouseKey.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_5100 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -685,8 +685,8 @@ export default function abilityTest() {
*/
it('AccessibilityConfigTest_set_asyncCallback_5500', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_5500');
config.mouseAutoClick.set(1, (err, result) => {
if (err && err.code != 0) {
config.mouseAutoClick.set(-1, (err, result) => {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_5500 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -726,7 +726,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_5700', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_5700');
config.mouseAutoClick.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_5700 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -794,7 +794,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_6100', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_6100');
config.shortkey.set(true, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_6100 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -834,7 +834,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_6300', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_6300');
config.shortkey.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_6300 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -903,7 +903,7 @@ export default function abilityTest() {
console.info('AccessibilityConfigTest_set_asyncCallback_6700');
let value = 'teststr'
config.shortkeyTarget.set(value, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_6700 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -944,7 +944,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_6900', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_6900');
config.shortkeyTarget.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_6900 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1012,7 +1012,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_7300', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_7300');
config.captions.set(true, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_7300 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1052,7 +1052,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_7500', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_7500');
config.captions.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_7500 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1120,7 +1120,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_7900', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_7900');
config.daltonizationColorFilter.set('Normal', (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_7900 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1140,7 +1140,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_set_asyncCallback_8000', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_8000');
config.daltonizationColorFilter.set('Deuteranomaly', (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_8000 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1200,7 +1200,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_8300', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_8300');
config.daltonizationColorFilter.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_8300 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1275,7 +1275,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_8700 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1322,7 +1322,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_get_asyncCallback_8900', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_8900');
config.captionsStyle.get((err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_8900 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1452,13 +1452,13 @@ export default function abilityTest() {
*/
it('AccessibilityConfigTest_enableAbility_asyncCallback_9600', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9600');
let name = 'com.example.accessibilityconfig/AccessibilityExtAbility';
let name = 'com.test';
config.enableAbility(name, ['retrieve', 'touchGuide', 'keyEventObserver'], (err) => {
console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9600 error: ${JSON.stringify(err)}`);
if (err && err.code != 0) {
expect(null).assertFail();
} else {
if (err.code != 0) {
expect(true).assertTrue();
} else {
expect(null).assertFail();
}
done();
});
......@@ -1473,11 +1473,11 @@ export default function abilityTest() {
*/
it('AccessibilityConfigTest_enableAbility_asyncCallback_9700', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9700');
let name = 'xxx';
config.enableAbility(name, ['retrieve'], (err) => {
let name = 'com.';
config.enableAbility(name, ['retrieve', 'touchGuide', 'keyEventObserver', 'zoom', 'gesture'], (err) => {
console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9700 error: ${JSON.stringify(err)}`);
if (err && err.code != 0) {
expect(9300001).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
expect(null).assertFail();
}
......@@ -1485,6 +1485,48 @@ export default function abilityTest() {
});
})
/*
* @tc.number AccessibilityConfigTest_enableAbility_asyncPromise_9800
* @tc.name AccessibilityConfigTest_enableAbility_asyncPromise_9800
* @tc.desc Test enableAbility() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_enableAbility_asyncPromise_9800', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9800');
let name = '';
config.enableAbility(name, []).then(() => {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9800 result back');
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_9800 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_enableAbility_asyncPromise_9900
* @tc.name AccessibilityConfigTest_enableAbility_asyncPromise_9900
* @tc.desc Test enableAbility() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_enableAbility_asyncPromise_9900', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9900');
let name = 'test';
config.enableAbility(name, ['retrieve']).then(() => {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9900 result back');
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_9900 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_enableAbility_asyncPromise_10000
* @tc.name AccessibilityConfigTest_enableAbility_asyncPromise_10000
......@@ -1494,17 +1536,15 @@ export default function abilityTest() {
*/
it('AccessibilityConfigTest_enableAbility_asyncPromise_10000', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10000');
let name = 'com.example.accessibilityconfig/AccessibilityExtAbility';
let name = 'test.com';
config.enableAbility(name, ['retrieve', 'touchGuide']).then(() => {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10000 result back');
expect(null).assertFail();
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_10000 has error: ${JSON.stringify(err)}`);
expect(9300002 ).assertEqual(err.code);
done();
}
console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_10000 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
......@@ -1523,10 +1563,49 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_10100 has error: ${JSON.stringify(err)}`);
expect(9300001 ).assertEqual(err.code);
done();
console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_10100 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_enableAbility_asyncPromise_10200
* @tc.name AccessibilityConfigTest_enableAbility_asyncPromise_10200
* @tc.desc Test enableAbility() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_enableAbility_asyncPromise_10200', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10200');
let name = 'com.';
config.enableAbility(name, ['retrieve', 'touchGuide', 'keyEventObserver', 'zoom', 'gesture']).then(() => {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10200 result back');
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_10200 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_disableAbility_asyncCallback_10300
* @tc.name AccessibilityConfigTest_disableAbility_asyncCallback_10300
* @tc.desc Test disableAbility() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_disableAbility_asyncCallback_10300', 0, async function(done) {
console.info('AccessibilityConfigTest_disableAbility_asyncCallback_10300');
let name = '';
config.disableAbility(name, (err) => {
console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10300 err: ${JSON.stringify(err)}`);
if (err.code != 0) {
expect(true).assertTrue();
} else {
expect(null).assertFail();
}
done();
});
......@@ -1544,8 +1623,8 @@ export default function abilityTest() {
let name = 'test';
config.disableAbility(name, (err) => {
console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10400 err: ${JSON.stringify(err)}`);
if (err && err.code != 0) {
expect(9300001).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
expect(null).assertFail();
}
......@@ -1562,18 +1641,81 @@ export default function abilityTest() {
*/
it('AccessibilityConfigTest_disableAbility_asyncCallback_10500', 0, async function(done) {
console.info('AccessibilityConfigTest_disableAbility_asyncCallback_10500');
let name = 'com.example.accessibilityconfig/AccessibilityExtAbility';
let name = 'test.com';
config.disableAbility(name, (err) => {
console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10500 err: ${JSON.stringify(err)}`);
if (err && err.code != 0) {
if (err.code != 0) {
expect(true).assertTrue();
} else {
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigTest_disableAbility_asyncCallback_10600
* @tc.name AccessibilityConfigTest_disableAbility_asyncCallback_10600
* @tc.desc Test disableAbility() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_disableAbility_asyncCallback_10600', 0, async function(done) {
console.info('AccessibilityConfigTest_disableAbility_asyncCallback_10600');
let name = 'com.test';
config.disableAbility(name, (err) => {
console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10600 err: ${JSON.stringify(err)}`);
if (err.code != 0) {
expect(true).assertTrue();
} else {
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigTest_disableAbility_asyncCallback_10700
* @tc.name AccessibilityConfigTest_disableAbility_asyncCallback_10700
* @tc.desc Test disableAbility() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_disableAbility_asyncCallback_10700', 0, async function(done) {
console.info('AccessibilityConfigTest_disableAbility_asyncCallback_10700');
let name = 'com.';
config.disableAbility(name, (err) => {
console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10700 err: ${JSON.stringify(err)}`);
if (err.code != 0) {
expect(true).assertTrue();
} else {
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigTest_disableAbility_asyncPromise_10800
* @tc.name AccessibilityConfigTest_disableAbility_asyncPromise_10800
* @tc.desc Test disableAbility() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_disableAbility_asyncPromise_10800', 0, async function(done) {
console.info('AccessibilityConfigTest_disableAbility_asyncPromise_10800');
let name = '';
config.disableAbility(name).then(() => {
console.info('AccessibilityConfigTest_disableAbility_asyncPromise_10800 result back');
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_10800 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_disableAbility_asyncPromise_10900
* @tc.name AccessibilityConfigTest_disableAbility_asyncPromise_10900
......@@ -1589,11 +1731,9 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_10900 has error: ${JSON.stringify(err)}`);
expect(9300001).assertEqual(err.code);
done();
}
console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_10900 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
......@@ -1612,11 +1752,9 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_11000 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
}
console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_11000 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
......@@ -1635,11 +1773,30 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_11100 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
}
console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_11100 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_disableAbility_asyncPromise_11200
* @tc.name AccessibilityConfigTest_disableAbility_asyncPromise_11200
* @tc.desc Test disableAbility() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_disableAbility_asyncPromise_11200', 0, async function(done) {
console.info('AccessibilityConfigTest_disableAbility_asyncPromise_11200');
let name = 'com.';
config.disableAbility(name).then(() => {
console.info('AccessibilityConfigTest_disableAbility_asyncPromise_11200 result back');
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_11200 has error: ${JSON.stringify(err)}`);
expect(true).assertTrue();
done();
});
})
......@@ -1652,7 +1809,7 @@ export default function abilityTest() {
*/
it('AccessibilityConfigTest_on_asyncCallback_11300', 0, async function(done) {
console.info('AccessibilityConfigTest_on_asyncCallback_11300');
let ret = config.on('enabledAccessibilityExtensionListChange', (data) => {});
let ret = config.on('enableAbilityListsStateChanged', (data) => {});
expect(ret).assertEqual(undefined);
done();
})
......@@ -1666,7 +1823,7 @@ export default function abilityTest() {
*/
it('AccessibilityConfigTest_off_asyncCallback_11400', 0, async function(done) {
console.info('AccessibilityConfigTest_off_asyncCallback_11400');
let ret = config.off('enabledAccessibilityExtensionListChange', (data) => {});
let ret = config.off('enableAbilityListsStateChanged', (data) => {});
expect(ret).assertEqual(undefined);
done();
})
......@@ -1688,7 +1845,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0100 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1715,7 +1872,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0200 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1742,7 +1899,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0300 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1769,7 +1926,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0400 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1796,7 +1953,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0500 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1823,7 +1980,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0600 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1850,7 +2007,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0700 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1877,7 +2034,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0800 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1904,7 +2061,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0900 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1931,7 +2088,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_1000 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1958,7 +2115,7 @@ export default function abilityTest() {
backgroundColor: 'blue',
windowColor: 'blue'
}, (err, result) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_1100 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -1989,11 +2146,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0100 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0100 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2018,11 +2173,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0200 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0200 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2047,11 +2200,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0300 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0300 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2076,11 +2227,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0400 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0400 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2105,11 +2254,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0500 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0500 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2134,11 +2281,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0600 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0600 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2163,11 +2308,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0700 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0700 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2192,11 +2335,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0800 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0800 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2221,11 +2362,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0900 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0900 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2250,11 +2389,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_1000 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_1000 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
......@@ -2279,11 +2416,9 @@ export default function abilityTest() {
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_1100 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_1100 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
})
......
......@@ -14,8 +14,8 @@
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [{
"name": "com.example.accessibilityxts.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"name": "TestAbility",
"srcEntrance": "./ets/TestAbility/TestAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
......@@ -30,21 +30,7 @@
]
}]
}],
"extensionAbilities": [
{
"name": "AccessibilityExtAbility",
"srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts",
"label": "$string:Accessibility_label",
"description": "$string:Accessibility_desc",
"type": "accessibility",
"metadata": [
{
"name": "ohos.accessibleability",
"resource": "$profile:accessibility_config"
}
],
"permissions": ["ohos.permission.GET_BUNDLE_INFO"]
}],
"requestPermissions": [{
"name": "ohos.permission.READ_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.READ_ACCESSIBILITY_CONFIG"
......
{
"accessibilityCapabilities": [
"retrieve"
],
"accessibilityCapabilityRationale": "a11y_rationale",
"settingsAbility": "com.accessibility.voiceaid.voiceAidSetting"
}
\ No newline at end of file
{
"src": [
"MainAbility/pages/index/index"
"TestAbility/pages/index"
]
}
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility';
class AccessibilityExtAbility extends AccessibilityExtensionAbility {
onConnect() {
console.info("[Demo] AccessibilityExtAbility onConnect");
}
onDisconnect() {
console.info("[Demo] AccessibilityExtAbility onDisconnect");
}
onAccessibilityEvent(accessibilityEvent) {
console.info("[Demo] AccessibilityExtAbility onAccessibilityEvent: " + JSON.stringify(accessibilityEvent));
}
}
export default AccessibilityExtAbility;
\ No newline at end of file
......@@ -13,21 +13,12 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
......
......@@ -13,10 +13,19 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
......@@ -25,13 +34,7 @@ export default class TestAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.loadContent("TestAbility/pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
windowStage.setUIContent(this.context, 'TestAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
......
......@@ -21,8 +21,7 @@ var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
......@@ -53,19 +52,14 @@ export default class OpenHarmonyTestRunner implements TestRunner {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a com.example.accessibilityxts.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
......
......@@ -38,9 +38,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_0100', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_0100');
config.highContrastText.set(true, (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_0100 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_0100 has no write permission`);
expect(null).assertFail();
......@@ -63,8 +62,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_0200 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -79,9 +76,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_0700', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_0700');
config.invertColor.set(true, (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_0700 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_0700 has no write permission`);
expect(null).assertFail();
......@@ -104,8 +100,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_0800 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -120,9 +114,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_1300', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_1300');
config.contentTimeout.set(0, (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_1300 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_1300 has no write permission`);
expect(null).assertFail();
......@@ -145,8 +138,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_1400 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -161,9 +152,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_1900', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_1900');
config.animationOff.set(true, (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_1900 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_1900 has no write permission`);
expect(null).assertFail();
......@@ -186,8 +176,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_2000 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -202,9 +190,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_2500', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_2500');
config.brightnessDiscount.set(0.1, (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_2500 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_2500 has no write permission`);
expect(null).assertFail();
......@@ -227,8 +214,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_2600 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -243,9 +228,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_4900', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_4900');
config.mouseKey.set(true, (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_4900 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_4900 has no write permission`);
expect(null).assertFail();
......@@ -268,8 +252,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_5000 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -283,10 +265,9 @@ export default function abilityTest() {
*/
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_5500', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_5500');
config.mouseAutoClick.set(1, (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_5500 has error: ${err.code}`);
expect(201).assertEqual(err.code);
config.mouseAutoClick.set(-1, (err, result) => {
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_5500 has no write permission`);
expect(null).assertFail();
......@@ -309,8 +290,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_5600 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -325,9 +304,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_6100', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_6100');
config.shortkey.set(true, (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_6100 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_6100 has no write permission`);
expect(null).assertFail();
......@@ -350,8 +328,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_6200 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -367,9 +343,8 @@ export default function abilityTest() {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_6700');
let value = 'teststr'
config.shortkeyTarget.set(value, (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_6700 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_6700 has no write permission`);
expect(null).assertFail();
......@@ -393,8 +368,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_6800 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -409,9 +382,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_7900', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_7900');
config.daltonizationColorFilter.set('Normal', (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_7900 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_7900 has no write permission`);
expect(null).assertFail();
......@@ -430,9 +402,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8000', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8000');
config.daltonizationColorFilter.set('Deuteranomaly', (err, result) => {
if (err && err.code != 0) {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8000 has error: ${err.code}`);
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8000 has no write permission`);
expect(null).assertFail();
......@@ -455,8 +426,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_8100 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
......@@ -475,50 +444,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncPromise_8200 has error: ${err.code}`);
expect(201).assertEqual(err.code);
done();
});
})
/*
* @tc.number AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8300
* @tc.name AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8300
* @tc.desc Test enableAbility() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8300', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8300');
let name = 'com.example.accessibilityconfigreqreadpermission/AccessibilityExtAbility';
config.enableAbility(name, ['retrieve', 'touchGuide', 'keyEventObserver'], (err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8300 error: ${JSON.stringify(err)}`);
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8400
* @tc.name AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8400
* @tc.desc Test disableAbility() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8400', 0, async function(done) {
console.info('AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8400');
let name = 'com.example.accessibilityconfigreqreadpermission/AccessibilityExtAbility';
config.disableAbility(name, (err) => {
console.error(`AccessibilityConfigReqReadPermissionTest_set_asyncCallback_8400 err: ${JSON.stringify(err)}`);
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
expect(null).assertFail();
}
done();
});
})
......
......@@ -13,8 +13,8 @@
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [{
"name": "com.example.accessibilityxts.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"name": "TestAbility",
"srcEntrance": "./ets/TestAbility/TestAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
......@@ -29,21 +29,7 @@
]
}]
}],
"extensionAbilities": [
{
"name": "AccessibilityExtAbility",
"srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts",
"label": "$string:Accessibility_label",
"description": "$string:Accessibility_desc",
"type": "accessibility",
"metadata": [
{
"name": "ohos.accessibleability",
"resource": "$profile:accessibility_config"
}
],
"permissions": ["ohos.permission.GET_BUNDLE_INFO"]
}],
"requestPermissions": [{
"name": "ohos.permission.READ_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.READ_ACCESSIBILITY_CONFIG"
......
{
"accessibilityCapabilities": [
"retrieve"
],
"accessibilityCapabilityRationale": "a11y_rationale",
"settingsAbility": "com.accessibility.voiceaid.voiceAidSetting"
}
\ No newline at end of file
{
"src": [
"MainAbility/pages/index/index"
"TestAbility/pages/index"
]
}
\ No newline at end of file
......@@ -38,8 +38,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_0300', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_0300');
config.highContrastText.get((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_0300 has no read permission`);
expect(null).assertFail();
......@@ -62,7 +62,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
......@@ -77,8 +76,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_0900', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_0900');
config.invertColor.get((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_0900 has no read permission`);
expect(null).assertFail();
......@@ -101,7 +100,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
......@@ -116,8 +114,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_1500', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_1500');
config.contentTimeout.get((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_1500 has no read permission`);
expect(null).assertFail();
......@@ -140,7 +138,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
......@@ -155,8 +152,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_2100', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_2100');
config.animationOff.get((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_2100 has no read permission`);
expect(null).assertFail();
......@@ -179,7 +176,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
......@@ -194,8 +190,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_2700', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_2700');
config.brightnessDiscount.get((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_2700 has no read permission`);
expect(null).assertFail();
......@@ -218,7 +214,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
......@@ -233,8 +228,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_5100', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_5100');
config.mouseKey.get((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_5100 has no read permission`);
expect(null).assertFail();}
......@@ -256,7 +251,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
......@@ -271,8 +265,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_5700', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_5700');
config.mouseAutoClick.get((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_5700 has no read permission`);
expect(null).assertFail();
......@@ -295,7 +289,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
......@@ -310,8 +303,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_6300', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_6300');
config.shortkey.get((err, result) => {
if (err && err.code != 0) {
eexpect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_6300 has no read permission`);
expect(null).assertFail();
......@@ -334,7 +327,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
......@@ -349,8 +341,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_6900', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_6900');
config.shortkeyTarget.get((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_6900 has no read permission`);
expect(null).assertFail();
......@@ -373,7 +365,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
......@@ -388,8 +379,8 @@ export default function abilityTest() {
it('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_8300', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_get_asyncCallback_8300');
config.daltonizationColorFilter.get((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
if (err.code != 0) {
expect(true).assertTrue();
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_get_asyncCallback_8300 has no read permission`);
expect(null).assertFail();
......@@ -412,307 +403,6 @@ export default function abilityTest() {
expect(null).assertFail();
done();
}).catch((err) => {
expect(201).assertEqual(err.code);
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0100
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0100
* @tc.desc Test highContrastText.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0100', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0100');
config.highContrastText.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0100 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0200
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0200
* @tc.desc Test invertColor.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0200', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0200');
config.invertColor.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0200 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0300
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0300
* @tc.desc Test daltonizationColorFilter.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0300', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0300');
config.daltonizationColorFilter.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0300 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0400
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0400
* @tc.desc Test contentTimeout.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0400', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0400');
config.contentTimeout.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0400 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0500
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0500
* @tc.desc Test animationOff.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0500', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0500');
config.animationOff.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0500 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0600
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0600
* @tc.desc Test brightnessDiscount.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0600', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0600');
config.brightnessDiscount.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0600 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0700
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0700
* @tc.desc Test screenMagnifier.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0700', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0700');
config.screenMagnifier.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0700 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0800
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0800
* @tc.desc Test audioMono.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0800', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0800');
config.audioMono.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0800 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0900
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0900
* @tc.desc Test audioBalance.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0900', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0900');
config.audioBalance.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_0900 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1000
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1000
* @tc.desc Test mouseKey.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1000', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1000');
config.mouseKey.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1000 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1100
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1100
* @tc.desc Test mouseAutoClick.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1100', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1100');
config.mouseAutoClick.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1100 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1200
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1200
* @tc.desc Test shortkey.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1200', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1200');
config.shortkey.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1200 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1300
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1300
* @tc.desc Test shortkeyTarget.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1300', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1300');
config.shortkeyTarget.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1300 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1400
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1400
* @tc.desc Test captions.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1400', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1400');
config.captions.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1400 has no read permission`);
expect(null).assertFail();
}
done();
});
})
/*
* @tc.number AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1500
* @tc.name AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1500
* @tc.desc Test captionsStyle.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1500', 0, async function(done) {
console.info('AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1500');
config.captionsStyle.on((err, result) => {
if (err && err.code != 0) {
expect(201).assertEqual(err.code);
} else {
console.error(`AccessibilityConfigReqWritePermissionTest_on_asyncCallback_1500 has no read permission`);
expect(null).assertFail();
}
done();
});
})
......
......@@ -16,7 +16,6 @@ import commonEvent from '@ohos.commonEvent';
import accessibility from '@ohos.accessibility';
const invalidString = 'xxx';
const invalidValue = 1;
export class ElementTest {
private context = undefined;
......@@ -605,7 +604,7 @@ export class ElementTest {
}
} catch (e) {
console.info('ElementTest executeAttributeValuePromise ' + caseName + ' catch(e): ' + JSON.stringify(e));
if (input == invalidString && e && e.code != 0) {
if (input == invalidString) {
result = true;
}
}
......@@ -738,15 +737,12 @@ export class ElementTest {
console.info('ElementTest executePerformActionPromise ' + caseName + ' action: ' + action + ', args: ' + JSON.stringify(args));
let ret = await element.performAction(action, args);
console.info('ElementTest executePerformActionPromise ' + caseName + ' ret: ' + JSON.stringify(ret));
if (typeof(ret) == 'undefined') {
if (typeof(ret) == 'boolean') {
result = true;
}
} catch (e) {
console.info('ElementTest executePerformActionPromise ' + caseName + ' catch(e): ' + JSON.stringify(e));
if (e && e.code != 0) {
if (e.code == 9300005 || e.code == 9300000) {
result = true;
}
if (action == invalidString) {
result = true;
}
}
......@@ -799,7 +795,7 @@ export class ElementTest {
}
} catch (e) {
console.info('ElementTest executeFindElementPromiseByFocusType ' + caseName + ' catch(e): ' + JSON.stringify(e));
if (condition == invalidString && e && e.code != 0) {
if (condition == invalidString) {
result = true;
}
}
......@@ -854,9 +850,7 @@ export class ElementTest {
element.attributeNames((err, names) => {
console.info('ElementTest executeAttributeNamesCallback ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeAttributeNamesCallback ' + caseName + ' names: ' + JSON.stringify(names));
if (err && err.code != 0) {
result = false;
} else if (Array.isArray(names)) {
if (err.code == 0 && Array.isArray(names)) {
result = true;
}
this.publishCaseResult(caseName, result);
......@@ -879,9 +873,9 @@ export class ElementTest {
element.attributeValue(input, (err, value) => {
console.info('ElementTest executeAttributeValueCallback ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeAttributeValueCallback ' + caseName + ' value: ' + JSON.stringify(value));
if (err && err.code != 0) {
if (input == invalidString && err.code != 0) {
result = true;
} else if (typeof(value) == outputType) {
} else if (err.code == 0 && typeof(value) == outputType) {
result = true;
} else {
console.warn('ElementTest executeAttributeValueCallback ' + caseName + ' valueType: ' + typeof(value));
......@@ -905,10 +899,10 @@ export class ElementTest {
element.attributeValue(input, (err, value) => {
console.info('ElementTest executeAttributeValueCallback ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeAttributeValueCallback ' + caseName + ' value: ' + JSON.stringify(value));
if (typeof(value) == 'object' && typeof(value.left) == 'number'
if (err.code == 0 && typeof(value) == 'object' && typeof(value.left) == 'number'
&& typeof(value.top) == 'number' && typeof(value.width) == 'number' && typeof(value.height) == 'number') {
result = true;
} else if (err) {
} else {
console.warn('ElementTest executeAttributeValueCallbackRect ' + caseName + ' valueType: ' + typeof(value));
}
this.publishCaseResult(caseName, result);
......@@ -934,9 +928,7 @@ export class ElementTest {
target.attributeValue('triggerAction', (err, value) => {
console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' valueType: ' + typeof(value));
if (err) {
this.publishCaseResult(caseName, false);
} else if (eventType == 'click' && typeof(value) == 'string') {
if (err.code == 0 && eventType == 'click' && typeof(value) == 'string') {
this.publishCaseResult(caseName, true);
}
});
......@@ -968,9 +960,7 @@ export class ElementTest {
element.attributeValue('rootElement', (err, value) => {
console.info('ElementTest executeAttributeValueCallback ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeAttributeValueCallback ' + caseName + ' value: ' + JSON.stringify(value));
if (err) {
let result = false;
} else if (typeof(value) == 'object') {
if (err.code == 0 && typeof(value) == 'object') {
result = true;
} else {
console.warn('ElementTest executeAttributeValueCallback ' + caseName + ' valueType: ' + typeof(value));
......@@ -988,9 +978,7 @@ export class ElementTest {
element.attributeValue(input, (err, value) => {
console.info('ElementTest executeAttributeValueCallbackArray ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeAttributeValueCallbackArray ' + caseName + ' value: ' + JSON.stringify(value));
if (err) {
let result = false;
} else if (Array.isArray(value)) {
if (err.code == 0 && Array.isArray(value)) {
if ((value.length == 0)||
(value.length > 0 && typeof(value[0]) == outputType)) {
result = true;
......@@ -1008,7 +996,7 @@ export class ElementTest {
element.actionNames((err, actions) => {
console.info('ElementTest executeActionNamesCallback ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeActionNamesCallback ' + caseName + ' actions: ' + JSON.stringify(actions));
if (Array.isArray(actions)) {
if (err.code == 0 && Array.isArray(actions)) {
if ((actions.length == 0) ||
(actions.length > 0 && typeof(actions[0]) == 'string')) {
result = true;
......@@ -1028,12 +1016,9 @@ export class ElementTest {
element.performAction(action, args, (err, ret) => {
console.info('ElementTest executePerformActionCallback ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executePerformActionCallback ' + caseName + ' ret: ' + JSON.stringify(ret));
if (err && err.code != 0) {
if (err.code == 9300005 || err.code == 9300000) {
result = true;
}
if (action == invalidString && err.code != 0) {
result = true;
} else if (typeof(ret) == 'undefined') {
} else if (err.code == 0 && typeof(ret) == 'boolean') {
result = true;
}
this.publishCaseResult(caseName, result);
......@@ -1049,9 +1034,9 @@ export class ElementTest {
element.findElement('content', condition, (err, found) => {
console.info('ElementTest executeFindElementCallbackByContent ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeFindElementCallbackByContent ' + caseName + ' element: ' + JSON.stringify(found));
if (condition == invalidString && err && err.code != 0) {
if (condition == invalidString && err.code != 0) {
result = true;
} else if (Array.isArray(found)) {
} else if (err.code == 0 && Array.isArray(found)) {
if (found.length == 0 || typeof(found[0]) == 'object') {
result = true;
}
......@@ -1073,9 +1058,9 @@ export class ElementTest {
element.findElement('focusType', condition, (err, found) => {
console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' element: ' + JSON.stringify(found));
if (condition == invalidString && err && err.code != 0) {
if (condition == invalidString && err.code != 0) {
result = true;
} else if (typeof(found) == 'object') {
} else if (err.code == 0 && typeof(found) == 'object') {
result = true;
}
this.publishCaseResult(caseName, result);
......@@ -1100,7 +1085,7 @@ export class ElementTest {
console.info('ElementTest executeFindElementCallbackByFocusDirection ' + caseName + ' element: ' + JSON.stringify(found));
if (condition == invalidString && err.code != 0) {
result = true;
} else if (typeof(found) == 'object') {
} else if (err.code == 0 && typeof(found) == 'object') {
result = true;
}
this.publishCaseResult(caseName, result);
......@@ -1121,9 +1106,7 @@ export class ElementTest {
element.findElement('focusDirection', 'down', (err, found) => {
console.info('ElementTest executeFindElementCallback5900 ' + caseName + ' err: ' + JSON.stringify(err));
console.info('ElementTest executeFindElementCallback5900 ' + caseName + ' element: ' + JSON.stringify(found));
if (err && err.code != 0) {
}if (typeof(found) == 'object') {
if (err.code == 0 && typeof(found) == 'object') {
result = true;
}
this.publishCaseResult(caseName, result);
......
......@@ -52,10 +52,6 @@
{
"name": "ohos.permission.CAPTURE_SCREEN",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
},
{
"name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG"
}
]
}
......
{
"app": {
"bundleName": "com.example.accessibilityerrcode",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon": "$media:icon",
"label": "$string:app_name",
"description": "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ohosProject"
},
{
"name": "mainability_description",
"value": "ETS_Phone_Empty Stage Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 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.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAccessibilityErrCodeTest") {
hap_profile = "entry/src/main/module.json"
deps = [
":accessibilityerrcode_js_assets",
":accessibilityerrcode_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAccessibilityErrCodeTest"
part_name = "accessibility"
subsystem_name = "barrierfree"
}
ohos_app_scope("accessibilityerrcode_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("accessibilityerrcode_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("accessibilityerrcode_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":accessibilityerrcode_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "240000",
"bundle-name": "com.example.accessibilityerrcode",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
},
"kits": [
{
"test-file-name": [
"ActsAccessibilityErrCodeTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell setmode 602"
],
"teardown-command":[
"bm uninstall -n com.example.accessibilityerrcode"
]
}
]
}
\ No newline at end of file
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
/*
* Copyright (c) 2022 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.
*/
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate windowStage=" + windowStage)
//globalThis.windowStage = windowStage
//globalThis.abilityStorage = this.storage
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
aboutToAppear(){
console.info("start run testcase!!!!");
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
console.log('TestAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'TestAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.log('TestAbility onWindowStageDestroy')
}
onForeground() {
console.log('TestAbility onForeground')
}
onBackground() {
console.log('TestAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import accessibility from '@ohos.accessibility'
const bundleName = 'com.sample.testfora11y';
const triggerAction = 'accessibilityFocus';
const eventType = 'accessibilityFocus';
export default function abilityTest() {
describe('AccessibilityErrCode', function () {
beforeEach(async function (done) {
console.info(`AccessibilityErrCode: beforeEach starts`);
done();
})
afterEach(async function (done) {
console.info(`AccessibilityErrCode: afterEach starts`);
setTimeout(done, 1000);
})
/* Cases for namespace accessibility */
/*
* @tc.number AbilityExtensionList_0100
* @tc.name AbilityExtensionList_0100
* @tc.desc The parameters input are 'audible' and 'install', test the getAccessibilityExtensionList()
* function, and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_0100', 0, async function (done) {
console.info('AbilityExtensionList_0100');
accessibility.getAccessibilityExtensionList('audible', 'install', (err, data) => {
if (err && err.code != 0) {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_0100 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_0100 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityExtensionList_0200
* @tc.name AbilityExtensionList_0200
* @tc.desc The parameters input are 'audible' and 'install', test the getAccessibilityExtensionList() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_0200', 0, async function (done) {
console.info('AbilityExtensionList_0200');
accessibility.getAccessibilityExtensionList('audible', 'install').then((result) => {
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_0200 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_0200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityExtensionList_0300
* @tc.name AbilityExtensionList_0300
* @tc.desc The parameters input are 'generic' and 'install', test the getAccessibilityExtensionList()
* function, and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_0300', 0, async function (done) {
console.info('AbilityExtensionList_0300');
accessibility.getAccessibilityExtensionList('generic', 'install', (err, data) => {
if (err && err.code != 0) {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_0300 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_0300 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityExtensionList_0400
* @tc.name AbilityExtensionList_0400
* @tc.desc The parameters input are 'generic' and 'install', test the getAccessibilityExtensionList() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_0400', 0, async function (done) {
console.info('AbilityExtensionList_0400');
accessibility.getAccessibilityExtensionList('generic', 'install').then((result) => {
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_0400 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_0400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityExtensionList_0500
* @tc.name AbilityExtensionList_0500
* @tc.desc The parameters input are 'generic' and 'install', test the getAccessibilityExtensionList()
* function, and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_0500', 0, async function (done) {
console.info('AbilityExtensionList_0500');
accessibility.getAccessibilityExtensionList('generic', 'install', (err, data) => {
if (err && err.code != 0) {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_0500 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_0500 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityExtensionList_0600
* @tc.name AbilityExtensionList_0600
* @tc.desc The parameters input are 'generic' and 'install', test the getAccessibilityExtensionList() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_0600', 0, async function (done) {
console.info('AbilityExtensionList_0600');
accessibility.getAccessibilityExtensionList('generic', 'install').then((result) => {
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_0600 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_0600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityExtensionList_0700
* @tc.name AbilityExtensionList_0700
* @tc.desc The parameters input are 'haptic' and 'install', test the getAccessibilityExtensionList()
* function, and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_0700', 0, async function (done) {
console.info('AbilityExtensionList_0700');
accessibility.getAccessibilityExtensionList('haptic', 'install', (err, data) => {
if (err && err.code != 0) {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_0700 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_0700 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityExtensionList_0800
* @tc.name AbilityExtensionList_0800
* @tc.desc The parameters input are 'haptic' and 'install', test the getAccessibilityExtensionList() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_0800', 0, async function (done) {
console.info('AbilityExtensionList_0800');
accessibility.getAccessibilityExtensionList('haptic', 'install').then((result) => {
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_0800 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_0800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityExtensionList_0900
* @tc.name AbilityExtensionList_0900
* @tc.desc The parameters input are 'spoken' and 'install', test the getAccessibilityExtensionList()
* function, and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_0900', 0, async function (done) {
console.info('AbilityExtensionList_0900');
accessibility.getAccessibilityExtensionList('spoken', 'install', (err, data) => {
if (err && err.code != 0) {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_0900 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_0900 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityExtensionList_1000
* @tc.name AbilityExtensionList_1000
* @tc.desc The parameters input are 'spoken' and 'install', test the getAccessibilityExtensionList() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_1000', 0, async function (done) {
console.info('AbilityExtensionList_1000');
accessibility.getAccessibilityExtensionList('spoken', 'install').then((result) => {
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_1000 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_1000 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityExtensionList_1100
* @tc.name AbilityExtensionList_1100
* @tc.desc The parameters input are 'visual' and 'install', test the getAccessibilityExtensionList()
* function, and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_1100', 0, async function (done) {
console.info('AbilityExtensionList_1100');
accessibility.getAccessibilityExtensionList('visual', 'install', (err, data) => {
if (err && err.code != 0) {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_1100 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_1100 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityExtensionList_1200
* @tc.name AbilityExtensionList_1200
* @tc.desc The parameters input are 'visual' and 'install', test the getAccessibilityExtensionList() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_1200', 0, async function (done) {
console.info('AbilityExtensionList_1200');
accessibility.getAccessibilityExtensionList('visual', 'install').then((result) => {
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_1200 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_1200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityExtensionList_1300
* @tc.name AbilityExtensionList_1300
* @tc.desc The parameters input are 'all' and 'enable', test the getAccessibilityExtensionList()
* function, and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_1300', 0, async function (done) {
console.info('AbilityExtensionList_1300');
accessibility.getAccessibilityExtensionList('all', 'enable', (err, data) => {
if (err && err.code != 0) {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_1300 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_1300 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityExtensionList_1400
* @tc.name AbilityExtensionList_1400
* @tc.desc The parameters input are 'all' and 'enable', test the getAccessibilityExtensionList() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_1400', 0, async function (done) {
console.info('AbilityExtensionList_1400');
accessibility.getAccessibilityExtensionList('all', 'enable').then((result) => {
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_1400 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_1400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityExtensionList_1500
* @tc.name AbilityExtensionList_1500
* @tc.desc The parameters input are 'all' and 'disable', test the getAccessibilityExtensionList()
* function, and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_1500', 0, async function (done) {
console.info('AbilityExtensionList_1500');
accessibility.getAccessibilityExtensionList('all', 'disable', (err, data) => {
if (err && err.code != 0) {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_1500 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_1500 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityExtensionList_1600
* @tc.name AbilityExtensionList_1600
* @tc.desc The parameters input are 'all' and 'disable', test the getAccessibilityExtensionList() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_1600', 0, async function (done) {
console.info('AbilityExtensionList_1600');
accessibility.getAccessibilityExtensionList('all', 'disable').then((result) => {
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_1600 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_1600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityExtensionList_1700
* @tc.name AbilityExtensionList_1700
* @tc.desc The parameters input are 'all' and 'install', test the getAccessibilityExtensionList()
* function, and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_1700', 0, async function (done) {
console.info('AbilityExtensionList_1700');
accessibility.getAccessibilityExtensionList('all', 'install', (err, data) => {
if (err && err.code != 0) {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_1700 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_1700 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityExtensionList_1800
* @tc.name AbilityExtensionList_1800
* @tc.desc The parameters input are 'all' and 'install', test the getAccessibilityExtensionList() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityExtensionList_1800', 0, async function (done) {
console.info('AbilityExtensionList_1800');
accessibility.getAccessibilityExtensionList('all', 'install').then((result) => {
console.info(`AccessibilityErrCodeTest: AbilityExtensionList_1800 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibilityErrCodeTest: AbilityExtensionList_1800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
})
}
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import abilityTest from './AccessibilityErrCode.test.ets'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [{
"name": "TestAbility",
"srcEntrance": "./ets/TestAbility/TestAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait",
"skills": [{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}]
}],
"requestPermissions": [{
"name": "ohos.permission.READ_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.READ_ACCESSIBILITY_CONFIG"
},
{
"name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsAccessibilityErrCodeTest"
},
{
"name": "form_description",
"value": "my form"
},
{
"name": "serviceability_description",
"value": "my whether"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "app_name",
"value": "Demo"
},
{
"name": "Accessibility_desc",
"value": "accessibility_description"
},
{
"name": "Accessibility_label",
"value": "accessibility_label"
}
]
}
{
"src": [
"TestAbility/pages/index"
]
}
\ No newline at end of file
......@@ -52,10 +52,6 @@
{
"name": "ohos.permission.CAPTURE_SCREEN",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
},
{
"name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG"
}
]
}
......
......@@ -52,10 +52,6 @@
{
"name": "ohos.permission.CAPTURE_SCREEN",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
},
{
"name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG"
}
]
}
......
......@@ -60,7 +60,7 @@ export class ExtensionContextTest {
switch (caseName) {
case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500':
bundleName = ['com.example.accessibilityxts'];
bundleName = ['com.example.accessibleformextension'];
this.setTargetBundleNameCallback(caseName, bundleName);
break;
case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1600':
......@@ -71,7 +71,7 @@ export class ExtensionContextTest {
this.setTargetBundleNameCallback(caseName, bundleName);
break;
case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1800':
bundleName = ['com.example.accessibilityxts'];
bundleName = ['com.example.accessibleformextension'];
this.setTargetBundleNamePromise(caseName, bundleName);
break;
case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1900':
......@@ -240,7 +240,7 @@ export class ExtensionContextTest {
private async getDisPlayId() {
let displayId = -1;
display.getDefaultDisplay((err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error("getDisPlayId getDefaultDisplay error");
} else {
console.info("getDisPlayId getDefaultDisplay data.id: " + JSON.stringify(data.id));
......@@ -268,7 +268,8 @@ export class ExtensionContextTest {
let tartgetNode = await rootNode.findElement('content', 'button1');
console.info("setAccessibilityFocus tartgetNode: " + JSON.stringify(tartgetNode));
if (tartgetNode) {
await tartgetNode[0].performAction("accessibilityFocus");
isFocus = await tartgetNode[0].performAction("accessibilityFocus");
console.info("setAccessibilityFocus isFocus: " + JSON.stringify(isFocus));
}
}
}
......@@ -283,7 +284,8 @@ export class ExtensionContextTest {
let tartgetNode = await rootNode.findElement('content', 'button1');
console.info("setAccessibilityFocus tartgetNode: " + JSON.stringify(tartgetNode));
if (tartgetNode) {
await tartgetNode[0].performAction("clearAccessibilityFocus");
isFocus = await tartgetNode[0].performAction("clearAccessibilityFocus");
console.info("setAccessibilityFocus isFocus: " + JSON.stringify(isFocus));
}
}
}
......@@ -293,13 +295,9 @@ export class ExtensionContextTest {
let result = true;
this.context.setTargetBundleName(bundleName, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
if ((bundleName.length == 0 || bundleName[0] == 'aaa') && err && err.code != 0) {
result = true;
} else {
result = false;
}
result = false;
}
this.publishCaseResult(caseName, result);
});
......@@ -312,11 +310,7 @@ export class ExtensionContextTest {
this.publishCaseResult(caseName, result);
}).catch((error) => {
console.error(caseName + " error: " + JSON.stringify(error));
if ((bundleName.length == 0 || bundleName[0] == 'aaa') && error && error.code != 0) {
result = true;
} else {
result = false;
}
result = false;
this.publishCaseResult(caseName, result);
});
}
......@@ -325,7 +319,7 @@ export class ExtensionContextTest {
let result = false;
this.context.getWindowRootElement(async (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
}
if (res == undefined) {
......@@ -345,16 +339,21 @@ export class ExtensionContextTest {
let result = false;
if ((windowId == -1) || (windowId == 1000)){
this.context.getWindowRootElement(-1, async (err, res) => {
if (err && err.code != 0) {
console.info(caseName + " res: " + JSON.stringify(res));
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
result = true;
result = true
}
if (res == undefined) {
console.error(caseName + " res is undefined");
result = true
}
this.publishCaseResult(caseName, result);
});
} else {
this.context.getWindowRootElement(windowId, async (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
}
if (res == undefined) {
......@@ -375,6 +374,12 @@ export class ExtensionContextTest {
let result = false;
if ((windowId == -1) || (windowId == 1000)){
this.context.getWindowRootElement(-1).then(async (res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (res == undefined) {
console.error(caseName + " res is undefined");
result = true;
}
this.publishCaseResult(caseName, result);
}).catch((error) => {
console.error(caseName + " error: " + JSON.stringify(error));
......@@ -406,7 +411,7 @@ export class ExtensionContextTest {
let result = false;
this.context.getWindows((err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
}
if (res == undefined) {
......@@ -424,11 +429,11 @@ export class ExtensionContextTest {
private async getWindowsByIdCallback(caseName: string, displayId: number) {
let result = false;
console.info(caseName + " displayId: " + JSON.stringify(displayId));
if (displayId == -1 || displayId == 100) {
this.context.getWindows(-1, (err, res) => {
if (displayId == -1) {
this.context.getWindows(displayId, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
console.error(caseName + " err: " + JSON.stringify(err.code));
result = true;
}
this.publishCaseResult(caseName, result);
......@@ -436,7 +441,7 @@ export class ExtensionContextTest {
} else {
this.context.getWindows(displayId, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
}
if (res) {
......@@ -453,21 +458,18 @@ export class ExtensionContextTest {
let result = false;
console.info(caseName + " displayId: " + JSON.stringify(displayId));
if (displayId == -1) {
this.context.getWindows(displayId).then(async (res) => {
result = false;
this.publishCaseResult(caseName, result);
}).catch((err) => {
console.error(caseName + 'err:' + JSON.stringify(err));
if (err && err.code != 0) {
this.context.getWindows(-1, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
result = true;
}
this.publishCaseResult(caseName, result);
});
} else {
this.context.getWindows(displayId, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
}
if (res) {
......@@ -484,7 +486,7 @@ export class ExtensionContextTest {
let result = false;
this.context.getFocusElement((err, res) => {
console.info(caseName + "res: " + JSON.stringify(res));
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + "err: " + JSON.stringify(err.code));
result = true;
}
......@@ -508,7 +510,7 @@ export class ExtensionContextTest {
}
this.publishCaseResult(caseName, result);
} else {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + "err: " + JSON.stringify(err.code));
result = true;
}
......@@ -521,7 +523,7 @@ export class ExtensionContextTest {
} else {
this.context.getFocusElement(false, (err, res) => {
console.info(caseName + "res: " + JSON.stringify(res));
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + "err: " + JSON.stringify(err.code));
result = true;
}
......@@ -577,17 +579,21 @@ export class ExtensionContextTest {
let result = false;
if (gesturePath == undefined) {
this.context.injectGesture(gesturePath, (err, res) => {
if (err && err.code != 0) {
console.info(caseName + " res: " + JSON.stringify(res));
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
result = true;
}
if (res == undefined) {
result = true;
}
this.publishCaseResult(caseName, result);
});
} else {
this.context.injectGesture(gesturePath, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
result = true;
if (err && err.code != 0) {
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
result = false;
}
......@@ -601,13 +607,15 @@ export class ExtensionContextTest {
let result = false;
if (gesturePath == undefined) {
this.context.injectGesture(gesturePath).then((res) => {
this.publishCaseResult(caseName, result);
}).catch ((err) => {
if (err && err.code != 0) {
console.error(caseName + 'error:' + JSON.stringify(err));
console.info(caseName + " res: " + JSON.stringify(res));
if (res == undefined) {
result = true;
}
this.publishCaseResult(caseName, result);
}).catch ((err) => {
console.error(caseName + 'error:' + JSON.stringify(err));
result = true;
this.publishCaseResult(caseName, result);
});
} else {
this.context.injectGesture(gesturePath).then((res) => {
......@@ -615,10 +623,8 @@ export class ExtensionContextTest {
result = true;
this.publishCaseResult(caseName, result);
}).catch ((err) => {
if (err && err.code != 0) {
console.error(caseName + 'error:' + JSON.stringify(err));
result = true;
}
console.error(caseName + 'error:' + JSON.stringify(err));
result = false;
this.publishCaseResult(caseName, result);
});
}
......
......@@ -86,7 +86,7 @@ export default function abilityTest() {
/*
* @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500
* @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500
* @tc.desc The parameter input is 'com.example.accessibilityxts',
* @tc.desc The parameter input is 'com.example.accessibleformextension',
* test the setTargetBundleName() function,
* The result of setTargetBundleName() should be boolean type.
* @tc.size SmallTest
......@@ -120,7 +120,7 @@ export default function abilityTest() {
/*
* @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1600
* @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1600
* @tc.desc The parameter input is 'com.example.accessibilityxts',
* @tc.desc The parameter input is 'com.example.accessibleformextension',
* test the setTargetBundleName() function,
* The result of setTargetBundleName() should be boolean type.
* @tc.size SmallTest
......@@ -154,7 +154,7 @@ export default function abilityTest() {
/*
* @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1700
* @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1700
* @tc.desc The parameter input is 'com.example.accessibilityxts',
* @tc.desc The parameter input is 'com.example.accessibleformextension',
* test the setTargetBundleName() function,
* The result of setTargetBundleName() should be boolean type.
* @tc.size SmallTest
......@@ -188,7 +188,7 @@ export default function abilityTest() {
/*
* @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1800
* @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1800
* @tc.desc The parameter input is 'com.example.accessibilityxts',
* @tc.desc The parameter input is 'com.example.accessibleformextension',
* test the setTargetBundleName() function,
* The result of setTargetBundleName() should be boolean type.
* @tc.size SmallTest
......@@ -222,7 +222,7 @@ export default function abilityTest() {
/*
* @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1900
* @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1900
* @tc.desc The parameter input is 'com.example.accessibilityxts',
* @tc.desc The parameter input is 'com.example.accessibleformextension',
* test the setTargetBundleName() function,
* The result of setTargetBundleName() should be boolean type.
* @tc.size SmallTest
......@@ -256,7 +256,7 @@ export default function abilityTest() {
/*
* @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_2000
* @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_2000
* @tc.desc The parameter input is 'com.example.accessibilityxts',
* @tc.desc The parameter input is 'com.example.accessibleformextension',
* test the setTargetBundleName() function,
* The result of setTargetBundleName() should be boolean type.
* @tc.size SmallTest
......
......@@ -52,10 +52,6 @@
{
"name": "ohos.permission.CAPTURE_SCREEN",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
},
{
"name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG"
}
]
}
......
......@@ -52,10 +52,6 @@
{
"name": "ohos.permission.CAPTURE_SCREEN",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
},
{
"name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG"
}
]
}
......
{
"app": {
"bundleName": "com.example.accessibilitysendaccessibilityevent",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon": "$media:icon",
"label": "$string:app_name",
"description": "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ohosProject"
},
{
"name": "mainability_description",
"value": "ETS_Phone_Empty Stage Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 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.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAccessibilitySendAccessibilityEventTest") {
hap_profile = "entry/src/main/module.json"
deps = [
":accessibilitysendaccessibilityevent_js_assets",
":accessibilitysendaccessibilityevent_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAccessibilitySendAccessibilityEventTest"
part_name = "accessibility"
subsystem_name = "barrierfree"
}
ohos_app_scope("accessibilitysendaccessibilityevent_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("accessibilitysendaccessibilityevent_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("accessibilitysendaccessibilityevent_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":accessibilitysendaccessibilityevent_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "240000",
"bundle-name": "com.example.accessibilitysendaccessibilityevent",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
},
"kits": [
{
"test-file-name": [
"ActsAccessibilitySendAccessibilityEventTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell setmode 602"
],
"teardown-command":[
"bm uninstall -n com.example.accessibilitysendaccessibilityevent"
]
}
]
}
\ No newline at end of file
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
/*
* Copyright (c) 2022 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.
*/
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate windowStage=" + windowStage)
//globalThis.windowStage = windowStage
//globalThis.abilityStorage = this.storage
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
aboutToAppear(){
console.info("start run testcase!!!!");
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
console.log('TestAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'TestAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.log('TestAbility onWindowStageDestroy')
}
onForeground() {
console.log('TestAbility onForeground')
}
onBackground() {
console.log('TestAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import accessibility from '@ohos.accessibility'
const abilityType = 'all';
const abilityState = 'install';
const bundleName = 'com.sample.testfora11y';
const triggerAction = 'accessibilityFocus';
const eventType = 'accessibilityFocus';
export default function abilityTest() {
describe('AccessibilitySendAccessibilityEvent', function () {
beforeEach(async function (done) {
console.info(`AccessibilitySendAccessibilityEvent: beforeEach starts`);
done();
})
afterEach(async function (done) {
console.info(`AccessibilitySendAccessibilityEvent: afterEach starts`);
setTimeout(done, 1000);
})
/*
* @tc.number SendAccessibilityEvent_null_0200
* @tc.name SendAccessibilityEvent_null_0200
* @tc.desc The parameter input is null, test the sendAccessibilityEvent() function
* The result of sendAccessibilityEvent() should be equal to a rejected promise of 401 err.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_null_0200', 0, async function (done) {
console.info('SendAccessibilityEvent_null_0200');
let event = null;
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_null_0200 result ${result}`);
expect(null).assertFail();
done();
}).catch((err) => {
if (err && err.code != 0) {
console.info(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_null_0200 has error: ${err}`);
expect(true).assertTrue();
done();
}
});
})
/*
* @tc.number SendAccessibilityEvent_0300
* @tc.name SendAccessibilityEvent_0300
* @tc.desc The parameter eventType input is accessibilityFocus, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_0300', 0, async function (done) {
console.info('SendAccessibilityEvent_0300');
let eventType = 'accessibilityFocus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0300 SendAccessibilityEvent_null_0010 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0300 has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_0400
* @tc.name SendAccessibilityEvent_0400
* @tc.desc The parameter input eventType is accessibilityFocus, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_0400', 0, async function (done) {
console.info('SendAccessibilityEvent_0400');
let eventType = 'accessibilityFocus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0400 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_0500
* @tc.name SendAccessibilityEvent_0500
* @tc.desc The parameter eventType input is accessibilityFocusClear, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_0500', 0, async function (done) {
console.info('SendAccessibilityEvent_0500');
let eventType = 'accessibilityFocusClear';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0500 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0500: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_0600
* @tc.name SendAccessibilityEvent_0600
* @tc.desc The parameter input eventType is accessibilityFocusClear, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_0600', 0, async function (done) {
console.info('SendAccessibilityEvent_0600');
let eventType = 'accessibilityFocusClear';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0600 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_0700
* @tc.name SendAccessibilityEvent_0700
* @tc.desc The parameter eventType input is click, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_0700', 0, async function (done) {
console.info('SendAccessibilityEvent_0700');
let eventType = 'click';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0700 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0700: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_0800
* @tc.name SendAccessibilityEvent_0800
* @tc.desc The parameter input eventType is click, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_0800', 0, async function (done) {
console.info('SendAccessibilityEvent_0800');
let eventType = 'click';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0800 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_0900
* @tc.name SendAccessibilityEvent_0900
* @tc.desc The parameter eventType input is longClick, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_0900', 0, async function (done) {
console.info('SendAccessibilityEvent_0900');
let eventType = 'longClick';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0900 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_0900: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_1000
* @tc.name SendAccessibilityEvent_1000
* @tc.desc The parameter input eventType is longClick, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1000', 0, async function (done) {
console.info('SendAccessibilityEvent_1000');
let eventType = 'longClick';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1000 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1000 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_1100
* @tc.name SendAccessibilityEvent_1100
* @tc.desc The parameter eventType input is focus, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1100', 0, async function (done) {
console.info('SendAccessibilityEvent_1100');
let eventType = 'focus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1100 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1100: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_1200
* @tc.name SendAccessibilityEvent_1200
* @tc.desc The parameter input eventType is focus, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1200', 0, async function (done) {
console.info('SendAccessibilityEvent_1200');
let eventType = 'focus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1200 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_1300
* @tc.name SendAccessibilityEvent_1300
* @tc.desc The parameter eventType input is select, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1100', 0, async function (done) {
console.info('SendAccessibilityEvent_1300');
let eventType = 'select';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1300 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1300: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_1400
* @tc.name SendAccessibilityEvent_1400
* @tc.desc The parameter input eventType is select, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1400', 0, async function (done) {
console.info('SendAccessibilityEvent_1400');
let eventType = 'select';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1400 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_1500
* @tc.name SendAccessibilityEvent_1500
* @tc.desc The parameter eventType input is hoverEnter, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1500', 0, async function (done) {
console.info('SendAccessibilityEvent_1500');
let eventType = 'hoverEnter';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1500 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1500: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_1600
* @tc.name SendAccessibilityEvent_1600
* @tc.desc The parameter input eventType is hoverEnter, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1600', 0, async function (done) {
console.info('SendAccessibilityEvent_1600');
let eventType = 'hoverEnter';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1600 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_1700
* @tc.name SendAccessibilityEvent_1700
* @tc.desc The parameter eventType input is hoverExit, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1700', 0, async function (done) {
console.info('SendAccessibilityEvent_1700');
let eventType = 'hoverExit';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1700 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1700: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_1800
* @tc.name SendAccessibilityEvent_1800
* @tc.desc The parameter input eventType is hoverExit, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1800', 0, async function (done) {
console.info('SendAccessibilityEvent_1800');
let eventType = 'hoverExit';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1800 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_1900
* @tc.name SendAccessibilityEvent_1900
* @tc.desc The parameter eventType input is textUpdate, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_1900', 0, async function (done) {
console.info('SendAccessibilityEvent_1900');
let eventType = 'textUpdate';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1900 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_1900: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_2000
* @tc.name SendAccessibilityEvent_2000
* @tc.desc The parameter input eventType is textUpdate, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2000', 0, async function (done) {
console.info('SendAccessibilityEvent_2000');
let eventType = 'textUpdate';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2000 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2000 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_2100
* @tc.name SendAccessibilityEvent_2100
* @tc.desc The parameter eventType input is textSelectionUpdate, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2100', 0, async function (done) {
console.info('SendAccessibilityEvent_2100');
let eventType = 'textSelectionUpdate';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2100 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2100: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_2200
* @tc.name SendAccessibilityEvent_2200
* @tc.desc The parameter input eventType is textSelectionUpdate, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2200', 0, async function (done) {
console.info('SendAccessibilityEvent_2200');
let eventType = 'textSelectionUpdate';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2200 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_2300
* @tc.name SendAccessibilityEvent_2300
* @tc.desc The parameter eventType input is scroll, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2300', 0, async function (done) {
console.info('SendAccessibilityEvent_2300');
let eventType = 'scroll';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2300 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2300: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_2400
* @tc.name SendAccessibilityEvent_2400
* @tc.desc The parameter input eventType is scroll, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2400', 0, async function (done) {
console.info('SendAccessibilityEvent_2400');
let eventType = 'scroll';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2400 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_2500
* @tc.name SendAccessibilityEvent_2500
* @tc.desc The parameter windowUpdateType input is add, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2500', 0, async function (done) {
console.info('SendAccessibilityEvent_2500');
let windowUpdateType = 'add';
let jsonObj = {
type : eventType,
windowUpdateType : windowUpdateType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: endAccessibilityEvent_2500 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2500: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_2600
* @tc.name SendAccessibilityEvent_2600
* @tc.desc The parameter windowUpdateType input is add, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2600', 0, async function (done) {
console.info('SendAccessibilityEvent_2600');
let windowUpdateType = 'add';
let jsonObj = {
type : eventType,
windowUpdateType : windowUpdateType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2600 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_2700
* @tc.name SendAccessibilityEvent_2700
* @tc.desc The parameter input is bundleName, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2700', 0, async function (done) {
console.info('SendAccessibilityEvent_2700');
let localBundleName = 'com.ixaa.testfora11y';
let jsonObj = {
type : eventType,
bundleName : localBundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2700 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2700: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_2800
* @tc.name SendAccessibilityEvent_2800
* @tc.desc The parameter input is bundleName, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2800', 0, async function (done) {
console.info('SendAccessibilityEvent_2800');
let localBundleName = 'com.ixaa.testfora11y';
let jsonObj = {
type : eventType,
bundleName : localBundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2800 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_2900
* @tc.name SendAccessibilityEvent_2900
* @tc.desc The parameter componentType input is button, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_2900', 0, async function (done) {
console.info('SendAccessibilityEvent_2900');
let componentType = 'button';
let jsonObj = {
type : eventType,
bundleName : bundleName,
componentType : componentType,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2900 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_2900: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_3000
* @tc.name SendAccessibilityEvent_3000
* @tc.desc The parameter componentType input is button, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3000', 0, async function (done) {
console.info('SendAccessibilityEvent_3000');
let componentType = 'button';
let jsonObj = {
type : eventType,
bundleName : bundleName,
componentType : componentType,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3000 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3000 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_3100
* @tc.name SendAccessibilityEvent_3100
* @tc.desc The parameter pageId input is 1, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3100', 0, async function (done) {
console.info('SendAccessibilityEvent_3100');
let pageId = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
pageId : pageId,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3100 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3100: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_3200
* @tc.name SendAccessibilityEvent_3200
* @tc.desc The parameter pageId input is 1, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3200', 0, async function (done) {
console.info('SendAccessibilityEvent_3200');
let pageId = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
pageId : pageId,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3200 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_3300
* @tc.name SendAccessibilityEvent_3300
* @tc.desc The parameter description input is 'test', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3300', 0, async function (done) {
console.info('SendAccessibilityEvent_3300');
let description = 'test';
let jsonObj = {
type : eventType,
bundleName : bundleName,
description : description,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3300 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3300: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_3400
* @tc.name SendAccessibilityEvent_3400
* @tc.desc The parameter description input is 'test', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3400', 0, async function (done) {
console.info('SendAccessibilityEvent_3400');
let description = 'test';
let jsonObj = {
type : eventType,
bundleName : bundleName,
description : description,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3400 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_3500
* @tc.name SendAccessibilityEvent_3500
* @tc.desc The parameter triggerAction input is 'accessibilityFocus', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3500', 0, async function (done) {
console.info('SendAccessibilityEvent_3500');
let triggerAction = 'accessibilityFocus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3500 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3500: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_3600
* @tc.name SendAccessibilityEvent_3600
* @tc.desc The parameter triggerAction input is 'accessibilityFocus', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3600', 0, async function (done) {
console.info('SendAccessibilityEvent_3600');
let triggerAction = 'accessibilityFocus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3600 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_3700
* @tc.name SendAccessibilityEvent_3700
* @tc.desc The parameter triggerAction input is 'clearAccessibilityFocus', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3700', 0, async function (done) {
console.info('SendAccessibilityEvent_3700');
let triggerAction = 'clearAccessibilityFocus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3700 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3700: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_3800
* @tc.name SendAccessibilityEvent_3800
* @tc.desc The parameter triggerAction input is 'clearAccessibilityFocus', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3800', 0, async function (done) {
console.info('SendAccessibilityEvent_3800');
let triggerAction = 'clearAccessibilityFocus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3800 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_3900
* @tc.name SendAccessibilityEvent_3900
* @tc.desc The parameter triggerAction input is 'focus', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_3900', 0, async function (done) {
console.info('SendAccessibilityEvent_3900');
let triggerAction = 'focus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3900 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_3900: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_4000
* @tc.name SendAccessibilityEvent_4000
* @tc.desc The parameter triggerAction input is 'focus', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4000', 0, async function (done) {
console.info('SendAccessibilityEvent_4000');
let triggerAction = 'focus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4000 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4000 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_4100
* @tc.name SendAccessibilityEvent_4100
* @tc.desc The parameter triggerAction input is 'clearFocus', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4100', 0, async function (done) {
console.info('SendAccessibilityEvent_4100');
let triggerAction = 'clearFocus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4100 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4100: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_4200
* @tc.name SendAccessibilityEvent_4200
* @tc.desc The parameter triggerAction input is 'clearFocus', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4200', 0, async function (done) {
console.info('SendAccessibilityEvent_4200');
let triggerAction = 'clearFocus';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4200 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_4300
* @tc.name SendAccessibilityEvent_4300
* @tc.desc The parameter triggerAction input is 'clearSelection', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4300', 0, async function (done) {
console.info('SendAccessibilityEvent_4300');
let triggerAction = 'clearSelection';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4300 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4300: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_4400
* @tc.name SendAccessibilityEvent_4400
* @tc.desc The parameter triggerAction input is 'clearSelection', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4400', 0, async function (done) {
console.info('SendAccessibilityEvent_4200');
let triggerAction = 'clearSelection';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4400 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_4500
* @tc.name SendAccessibilityEvent_4500
* @tc.desc The parameter triggerAction input is 'click', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4500', 0, async function (done) {
console.info('SendAccessibilityEvent_4500');
let triggerAction = 'click';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4500 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4500: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_4600
* @tc.name SendAccessibilityEvent_4600
* @tc.desc The parameter triggerAction input is 'click', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4600', 0, async function (done) {
console.info('SendAccessibilityEvent_4200');
let triggerAction = 'click';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4600 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_4700
* @tc.name SendAccessibilityEvent_4700
* @tc.desc The parameter triggerAction input is 'longClick', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4700', 0, async function (done) {
console.info('SendAccessibilityEvent_4700');
let triggerAction = 'longClick';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4700 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4700: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_4800
* @tc.name SendAccessibilityEvent_4800
* @tc.desc The parameter triggerAction input is 'longClick', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4800', 0, async function (done) {
console.info('SendAccessibilityEvent_4800');
let triggerAction = 'longClick';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4800 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_4900
* @tc.name SendAccessibilityEvent_4900
* @tc.desc The parameter triggerAction input is 'cut', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_4900', 0, async function (done) {
console.info('SendAccessibilityEvent_4900');
let triggerAction = 'cut';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4900 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_4900: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_5000
* @tc.name SendAccessibilityEvent_5000
* @tc.desc The parameter triggerAction input is 'cut', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5000', 0, async function (done) {
console.info('SendAccessibilityEvent_5000');
let triggerAction = 'cut';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5000 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5000 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_5100
* @tc.name SendAccessibilityEvent_5100
* @tc.desc The parameter triggerAction input is 'copy', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5100', 0, async function (done) {
console.info('SendAccessibilityEvent_5100');
let triggerAction = 'copy';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5100 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5100: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_5200
* @tc.name SendAccessibilityEvent_5200
* @tc.desc The parameter triggerAction input is 'copy', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5200', 0, async function (done) {
console.info('SendAccessibilityEvent_5200');
let triggerAction = 'copy';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5200 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_5300
* @tc.name SendAccessibilityEvent_5300
* @tc.desc The parameter triggerAction input is 'paste', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5300', 0, async function (done) {
console.info('SendAccessibilityEvent_5300');
let triggerAction = 'paste';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5300 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5300: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_5400
* @tc.name SendAccessibilityEvent_5400
* @tc.desc The parameter triggerAction input is 'paste', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5400', 0, async function (done) {
console.info('SendAccessibilityEvent_5400');
let triggerAction = 'paste';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5400 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_5500
* @tc.name SendAccessibilityEvent_5500
* @tc.desc The parameter triggerAction input is 'select', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5500', 0, async function (done) {
console.info('SendAccessibilityEvent_5500');
let triggerAction = 'select';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5500 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5500: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_5600
* @tc.name SendAccessibilityEvent_5600
* @tc.desc The parameter triggerAction input is 'select', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5600', 0, async function (done) {
console.info('SendAccessibilityEvent_5600');
let triggerAction = 'select';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5600 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_5700
* @tc.name SendAccessibilityEvent_5700
* @tc.desc The parameter triggerAction input is 'setText', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5700', 0, async function (done) {
console.info('SendAccessibilityEvent_5700');
let triggerAction = 'setText';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5700 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5700: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_5800
* @tc.name SendAccessibilityEvent_5800
* @tc.desc The parameter triggerAction input is 'setText', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5800', 0, async function (done) {
console.info('SendAccessibilityEvent_5800');
let triggerAction = 'setText';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5800 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_5900
* @tc.name SendAccessibilityEvent_5900
* @tc.desc The parameter triggerAction input is 'delete', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_5900', 0, async function (done) {
console.info('SendAccessibilityEvent_5900');
let triggerAction = 'delete';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5900 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_5900: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_6000
* @tc.name SendAccessibilityEvent_6000
* @tc.desc The parameter triggerAction input is 'delete', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6000', 0, async function (done) {
console.info('SendAccessibilityEvent_6000');
let triggerAction = 'delete';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6000 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6000 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_6100
* @tc.name SendAccessibilityEvent_6100
* @tc.desc The parameter triggerAction input is 'scrollForward', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6100', 0, async function (done) {
console.info('SendAccessibilityEvent_6100');
let triggerAction = 'scrollForward';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6100 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6100: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_6200
* @tc.name SendAccessibilityEvent_6200
* @tc.desc The parameter triggerAction input is 'scrollForward', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6200', 0, async function (done) {
console.info('SendAccessibilityEvent_6200');
let triggerAction = 'scrollForward';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6200 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_6300
* @tc.name SendAccessibilityEvent_6300
* @tc.desc The parameter triggerAction input is 'scrollBackward', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6300', 0, async function (done) {
console.info('SendAccessibilityEvent_6300');
let triggerAction = 'scrollBackward';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6300 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6300: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_6400
* @tc.name SendAccessibilityEvent_6400
* @tc.desc The parameter triggerAction input is 'scrollBackward', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6400', 0, async function (done) {
console.info('SendAccessibilityEvent_6400');
let triggerAction = 'scrollBackward';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6400 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_6500
* @tc.name SendAccessibilityEvent_6500
* @tc.desc The parameter triggerAction input is 'setSelection', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6500', 0, async function (done) {
console.info('SendAccessibilityEvent_6500');
let triggerAction = 'setSelection';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6500 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6500: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_6600
* @tc.name SendAccessibilityEvent_6600
* @tc.desc The parameter triggerAction input is 'setSelection', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6600', 0, async function (done) {
console.info('SendAccessibilityEvent_6600');
let triggerAction = 'setSelection';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6600 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_6700
* @tc.name SendAccessibilityEvent_6700
* @tc.desc The parameter textMoveUnit input is 'char', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6700', 0, async function (done) {
console.info('SendAccessibilityEvent_6700');
let textMoveUnit = 'char';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6700 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6700: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_6800
* @tc.name SendAccessibilityEvent_6800
* @tc.desc The parameter textMoveUnit input is 'char', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6800', 0, async function (done) {
console.info('SendAccessibilityEvent_6800');
let textMoveUnit = 'char';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6800 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_6900
* @tc.name SendAccessibilityEvent_6900
* @tc.desc The parameter textMoveUnit input is 'word', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_6900', 0, async function (done) {
console.info('SendAccessibilityEvent_6900');
let textMoveUnit = 'word';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6900 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_6900: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_7000
* @tc.name SendAccessibilityEvent_7000
* @tc.desc The parameter textMoveUnit input is 'word', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7000', 0, async function (done) {
console.info('SendAccessibilityEvent_7000');
let textMoveUnit = 'word';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7000 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7000 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_7100
* @tc.name SendAccessibilityEvent_7100
* @tc.desc The parameter textMoveUnit input is 'line', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7100', 0, async function (done) {
console.info('SendAccessibilityEvent_7100');
let textMoveUnit = 'line';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7100 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7100: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_7200
* @tc.name SendAccessibilityEvent_7200
* @tc.desc The parameter textMoveUnit input is 'line', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7200', 0, async function (done) {
console.info('SendAccessibilityEvent_7200');
let textMoveUnit = 'line';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7200 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_7300
* @tc.name SendAccessibilityEvent_7300
* @tc.desc The parameter textMoveUnit input is 'page', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7300', 0, async function (done) {
console.info('SendAccessibilityEvent_7300');
let textMoveUnit = 'page';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7300 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7300: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_7400
* @tc.name SendAccessibilityEvent_7400
* @tc.desc The parameter textMoveUnit input is 'page', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7400', 0, async function (done) {
console.info('SendAccessibilityEvent_7400');
let textMoveUnit = 'page';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7400 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_7500
* @tc.name SendAccessibilityEvent_7500
* @tc.desc The parameter textMoveUnit input is 'paragraph', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7500', 0, async function (done) {
console.info('SendAccessibilityEvent_7500');
let textMoveUnit = 'paragraph';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7500 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7500: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_7600
* @tc.name SendAccessibilityEvent_7600
* @tc.desc The parameter textMoveUnit input is 'paragraph', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7600', 0, async function (done) {
console.info('SendAccessibilityEvent_7600');
let textMoveUnit = 'paragraph';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
textMoveUnit : textMoveUnit,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7600 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_7700
* @tc.name SendAccessibilityEvent_7700
* @tc.desc The parameter contents input is '1', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7700', 0, async function (done) {
console.info('SendAccessibilityEvent_7700');
let contents = ['1'];
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
contents : contents,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7700 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7700: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_7800
* @tc.name SendAccessibilityEvent_7800
* @tc.desc The parameter contents input is '1', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7800', 0, async function (done) {
console.info('SendAccessibilityEvent_7800');
let contents = ['1'];
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
contents : contents,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7800 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_7900
* @tc.name SendAccessibilityEvent_7900
* @tc.desc The parameter lastContent input is 'paragraph', test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_7900', 0, async function (done) {
console.info('SendAccessibilityEvent_7900');
let lastContent = '1';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
lastContent : lastContent,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7900 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_7900: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_8000
* @tc.name SendAccessibilityEvent_8000
* @tc.desc The parameter lastContent input is 'paragraph', test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_8000', 0, async function (done) {
console.info('SendAccessibilityEvent_8000');
let lastContent = '1';
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
lastContent : lastContent,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8000 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8000 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_8100
* @tc.name SendAccessibilityEvent_8100
* @tc.desc The parameter beginIndex input is 1, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_8100', 0, async function (done) {
console.info('SendAccessibilityEvent_8100');
let beginIndex = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
beginIndex : beginIndex,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8100 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8100: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_8200
* @tc.name SendAccessibilityEvent_8200
* @tc.desc The parameter beginIndex input is 1,, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_8200', 0, async function (done) {
console.info('SendAccessibilityEvent_8200');
let beginIndex = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
beginIndex : beginIndex,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8200 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8200 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_8300
* @tc.name SendAccessibilityEvent_8300
* @tc.desc The parameter currentIndex input is 1, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_8300', 0, async function (done) {
console.info('SendAccessibilityEvent_8300');
let currentIndex = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
currentIndex : currentIndex,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8300 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8300: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_8400
* @tc.name SendAccessibilityEvent_8400
* @tc.desc The parameter currentIndex input is 1,, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_8400', 0, async function (done) {
console.info('SendAccessibilityEvent_8400');
let currentIndex = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
currentIndex : currentIndex,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8400 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_8500
* @tc.name SendAccessibilityEvent_8500
* @tc.desc The parameter endIndex input is 1, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_8500', 0, async function (done) {
console.info('SendAccessibilityEvent_8500');
let endIndex = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
endIndex : endIndex,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8500 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8500: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_8600
* @tc.name SendAccessibilityEvent_8600
* @tc.desc The parameter endIndex input is 1,, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_8600', 0, async function (done) {
console.info('SendAccessibilityEvent_8600');
let endIndex = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
endIndex : endIndex,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8600 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8600 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendAccessibilityEvent_8700
* @tc.name SendAccessibilityEvent_8700
* @tc.desc The parameter itemCount input is 1, test the sendAccessibilityEvent()
* function. The result of sendAccessibilityEvent() should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_8700', 0, async function (done) {
console.info('SendAccessibilityEvent_8700');
let itemCount = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
itemCount : itemCount,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event, (err, data) => {
console.log("AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8700 err : " + JSON.stringify(err));
if (err && err.code != 0) {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8700: has error: ${err.code}`);
expect(null).assertFail();
} else {
expect(data).assertEqual(undefined);
}
done();
})
})
/*
* @tc.number SendAccessibilityEvent_8800
* @tc.name SendAccessibilityEvent_8800
* @tc.desc The parameter itemCount input is 1,, test the sendAccessibilityEvent() function
* The function sendAccessibilityEvent in promise mode and result should be undefined.
* @tc.size SmallTest
* @tc.type User
*/
it('SendAccessibilityEvent_8800', 0, async function (done) {
console.info('SendAccessibilityEvent_8800');
let itemCount = 1;
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
itemCount : itemCount,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendAccessibilityEvent(event).then((result) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8800 result ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilitySendAccessibilityEvent: SendAccessibilityEvent_8800 has error: ${err}`);
expect(null).assertFail();
done();
});
})
})
}
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
import abilityTest from './AccessibilitySendAccessibilityEvent.test.ets'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [{
"name": "TestAbility",
"srcEntrance": "./ets/TestAbility/TestAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait",
"skills": [{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}]
}],
"requestPermissions": [{
"name": "ohos.permission.READ_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.READ_ACCESSIBILITY_CONFIG"
},
{
"name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsAccessibilitySendAccessibilityEventTest"
},
{
"name": "form_description",
"value": "my form"
},
{
"name": "serviceability_description",
"value": "my whether"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "app_name",
"value": "Demo"
},
{
"name": "Accessibility_desc",
"value": "accessibility_description"
},
{
"name": "Accessibility_label",
"value": "accessibility_label"
}
]
}
......@@ -51,7 +51,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0210');
let abilityType = 'audible';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0210 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -74,7 +74,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0220');
let abilityType = 'generic';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0220 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -97,7 +97,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0230');
let abilityType = 'haptic';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0230 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -120,7 +120,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0240');
let abilityType = 'spoken';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0240 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -143,7 +143,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0250');
let abilityType = 'visual';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0250 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -166,7 +166,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0260');
let abilityType = 'all';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0260 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -189,7 +189,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0270');
let abilityType = '';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0270 has error: ${err.code}`);
expect(Array.isArray(data)).assertEqual(true);
done();
......@@ -212,7 +212,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0280');
let abilityType = null;
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0280 has error: ${err.code}`);
expect(Array.isArray(data)).assertEqual(true);
done();
......@@ -235,7 +235,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0290');
let abilityState = 'enable';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0290 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -258,7 +258,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0300');
let abilityState = 'disable';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0300 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -281,7 +281,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0310');
let abilityState = 'install';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0310 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -304,7 +304,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0320');
let abilityState = '';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0320 has error: ${err.code}`);
expect(Array.isArray(data)).assertEqual(true);
done();
......@@ -327,7 +327,7 @@ describe('AccessibleAbilityList', function () {
console.info('AbilityList_0330');
let abilityState = null;
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0330 has error: ${err.code}`);
expect(Array.isArray(data)).assertEqual(true);
done();
......@@ -470,6 +470,49 @@ describe('AccessibleAbilityList', function () {
});
})
/*
* @tc.number AbilityList_0400
* @tc.name AbilityList_0400
* @tc.desc The parameters input are '' and 'install', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0400', 0, async function (done) {
console.info('AbilityList_0400');
let abilityType = '';
accessibility.getAbilityLists(abilityType, abilityState).then((result) => {
console.info(`AccessibleAbilityList: AbilityList_0400 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleAbilityList: AbilityList_0400 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityList_0410
* @tc.name AbilityList_0410
* @tc.desc The parameters input are null and 'install', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0410', 0, async function (done) {
console.info('AbilityList_0410');
let abilityType = null;
accessibility.getAbilityLists(abilityType, abilityState).then((result) => {
console.info(`AccessibleAbilityList: AbilityList_0410 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleAbilityList: AbilityList_0410 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityList_0420
......@@ -536,5 +579,49 @@ describe('AccessibleAbilityList', function () {
done();
});
})
/*
* @tc.number AbilityList_0450
* @tc.name AbilityList_0450
* @tc.desc The parameters input are 'all' and '', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0450', 0, async function (done) {
console.info('AbilityList_0450');
let abilityState = '';
accessibility.getAbilityLists(abilityType, abilityState).then((result) => {
console.info(`AccessibleAbilityList: AbilityList_0450 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleAbilityList: AbilityList_0450 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityList_0460
* @tc.name AbilityList_0460
* @tc.desc The parameters input are 'all' and null, test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0460', 0, async function (done) {
console.info('AbilityList_0460');
let abilityState = null;
accessibility.getAbilityLists(abilityType, abilityState).then((result) => {
console.info(`AccessibleAbilityList: AbilityList_0460 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleAbilityList: AbilityList_0460 has error: ${err}`);
expect(null).assertFail();
done();
});
})
})
}
......@@ -63,6 +63,40 @@ describe('AccessibleCaptionConfiguration', function () {
done();
})
/*
* @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();
})
/*
* @tc.number CaptionConfiguration_0050
* @tc.name CaptionConfiguration_0050
......@@ -96,5 +130,39 @@ describe('AccessibleCaptionConfiguration', function () {
expect(ret).assertEqual(undefined);
done();
})
/*
* @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();
})
})
}
......@@ -46,7 +46,7 @@ describe('AccessibleCheckAbility', function () {
it('CheckAbilityIsOpen_0170', 0, async function (done) {
console.info('CheckAbilityIsOpen_0170');
accessibility.isOpenAccessibility((err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityApi: CheckAbilityIsOpen_0170 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -92,7 +92,7 @@ describe('AccessibleCheckAbility', function () {
it('CheckAbilityIsOpen_0190', 0, async function (done) {
console.info('CheckAbilityIsOpen_0190');
accessibility.isOpenTouchGuide((err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(`AccessibilityApi: CheckAbilityIsOpen_0190 has error: ${err.code}`);
expect(null).assertFail();
done();
......@@ -117,11 +117,9 @@ describe('AccessibleCheckAbility', function () {
expect(typeof (result)).assertEqual('boolean');
done();
}).catch((err) => {
if (err && err.code != 0){
console.error(`AccessibilityApi: CheckAbilityIsOpen_0200 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.error(`AccessibilityApi: CheckAbilityIsOpen_0200 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
})
......
......@@ -37,6 +37,27 @@ describe('AccessibleSendEvent', function () {
/* are for accessibility.sendEvent() API test */
/******************************************************************************** */
/*
* @tc.number SendEvent_null_0010
* @tc.name SendEvent_null_0010
* @tc.desc The parameter input is null, test the sendEvent() function
* The result of sendEvent() should be equal to an error code with error
* @tc.size SmallTest
* @tc.type User
*/
it('SendEvent_null_0010', 0, async function (done) {
console.info('SendEvent_null_0010');
let event = null;
accessibility.sendEvent(event, (err, data) => {
console.info(`AccessibleSendEvent: SendEvent_null_0010 has error: ${err.code}`);
expect(err.code).assertEqual(-1);
console.info(`AccessibleSendEvent: SendEvent_null_0010 has data: ${data}`);
expect(data).assertEqual(undefined);
done();
})
})
/*
* @tc.number SendEvent_null_0020
* @tc.name SendEvent_null_0020
......@@ -55,11 +76,40 @@ describe('AccessibleSendEvent', function () {
done();
}).catch((err) => {
console.info(`AccessibleSendEvent: SendEvent_null_0020 has error: ${err}`);
expect(true).assertTrue();
expect(err).assertEqual(undefined);
done();
});
})
/*
* @tc.number SendEvent_construct_0010
* @tc.name SendEvent_construct_0010
* @tc.desc The parameter input is EventInfo, test the sendEvent() function
* The result of sendEvent() should be equal to an error code with no error.
* Another test point is to test whether the modified constructor (EventInfo)
* works correctly.
* @tc.size SmallTest
* @tc.type User
*/
it('SendEvent_construct_0010', 0, async function (done) {
console.info('SendEvent_construct_0010');
let jsonObj = {
type : eventType,
bundleName : bundleName,
triggerAction : triggerAction,
}
let event = new accessibility.EventInfo(jsonObj);
accessibility.sendEvent(event, (err, data) => {
console.info(`AccessibleSendEventTest: SendEvent_construct_0010 has error: ${err.code}`);
expect(err.code).assertEqual(0);
console.info(`AccessibleSendEventTest: SendEvent_construct_0010 has data: ${data}`);
expect(data).assertEqual(undefined);
done();
})
})
/*********************************************************************************************************** */
/* Cases SendEvent_type_0010-SendEvent_itemCount_constructor_0030
/* are for interface accessibility.EventInfo API test */
......@@ -424,7 +474,7 @@ describe('AccessibleSendEvent', function () {
done();
}).catch((err) => {
console.info(`AccessibleSendEvent: SendEvent_type_constructor_0120 has error: ${err}`);
expect(true).assertTrue();
expect(err).assertEqual(undefined);
done();
});
})
......@@ -458,7 +508,7 @@ describe('AccessibleSendEvent', function () {
done();
}).catch((err) => {
console.info(`AccessibleSendEvent: SendEvent_type_constructor_0130 has error: ${err}`);
expect(true).assertTrue();
expect(err).assertEqual(undefined);
done();
});
})
......@@ -622,7 +672,7 @@ describe('AccessibleSendEvent', function () {
done();
}).catch((err) => {
console.info(`AccessibleSendEvent: SendEvent_bundleName_constructor_0020 has error: ${err}`);
expect(true).assertTrue();
expect(err).assertEqual(undefined);
done();
});
})
......@@ -655,7 +705,7 @@ describe('AccessibleSendEvent', function () {
done();
}).catch((err) => {
console.info(`AccessibleSendEvent: SendEvent_bundleName_constructor_0030 has error: ${err}`);
expect(true).assertTrue();
expect(err).assertEqual(undefined);
done();
});
})
......@@ -1495,7 +1545,7 @@ describe('AccessibleSendEvent', function () {
done();
}).catch((err) => {
console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0170 has error: ${err}`);
expect(true).assertTrue();
expect(err).assertEqual(undefined);
done();
});
})
......@@ -1528,7 +1578,7 @@ describe('AccessibleSendEvent', function () {
done();
}).catch((err) => {
console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0180 has error: ${err}`);
expect(true).assertTrue();
expect(err).assertEqual(undefined);
done();
});
})
......
......@@ -61,7 +61,7 @@ struct Index {
.margin(5)
.onClick((e) => {
accessibility.getAbilityLists('all', 'enable', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(LOG_PREFIX + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......
......@@ -52,7 +52,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('spoken', 'install', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -98,7 +98,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('audible', 'install', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -144,7 +144,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('visual', 'install', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -190,7 +190,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('haptic', 'install', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -236,7 +236,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('generic', 'install', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -282,7 +282,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('all', 'enable', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -306,7 +306,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('all', 'enable', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -333,7 +333,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('all', 'enable', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -360,7 +360,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('all', 'enable', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.error(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -514,7 +514,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('all', 'disable', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......@@ -560,7 +560,7 @@ export default function abilityTest() {
disableAbility(logTag, [AUDIBLE_BUNDLE_NAME])
setTimeout(() => {
accessibility.getAbilityLists('all', 'disable', (err, data) => {
if (err && err.code != 0) {
if (err.code != 0) {
console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err))
return
}
......
......@@ -6,7 +6,7 @@
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"default",
"phone",
"tablet"
],
......@@ -36,17 +36,13 @@
],
"requestPermissions": [
{
"name": "ohos.permission.SYSTEM_FLOAT_WINDOW",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
"name": "ohos.permission.SYSTEM_FLOAT_WINDOW",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
},
{
"name": "ohos.permission.CAPTURE_SCREEN",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
},
{
"name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG"
"name": "ohos.permission.CAPTURE_SCREEN",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
}
]
}
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"default",
"phone",
"tablet"
],
......@@ -43,10 +43,14 @@
"name": "ohos.permission.CAPTURE_SCREEN",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
},
{
"name": "ohos.permission.READ_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.READ_ACCESSIBILITY_CONFIG"
},
{
"name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG",
"reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG"
}
]
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册