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

!4674 合入无障碍的xts api全case

Merge pull request !4674 from Mupceet/release_0726_xts
...@@ -22,6 +22,7 @@ group("barrierfree") { ...@@ -22,6 +22,7 @@ group("barrierfree") {
"accessibilityevent:ActsAccessibilityEventTest", "accessibilityevent:ActsAccessibilityEventTest",
"accessibilityextension:ActsAccessibilityExtensionTest", "accessibilityextension:ActsAccessibilityExtensionTest",
"accessibilityextensioncontext:ActsAccessibilityExtensionContextTest", "accessibilityextensioncontext:ActsAccessibilityExtensionContextTest",
"accessibilitygestureevent:ActsAccessibilityGestureEventTest",
"accessibleabilitylist:ActsAccessibleAbilityListTest", "accessibleabilitylist:ActsAccessibleAbilityListTest",
"accessiblecaptionconfiguration:ActsAccessibleCaptionConfigurationTest", "accessiblecaptionconfiguration:ActsAccessibleCaptionConfigurationTest",
"accessiblecheckability:ActsAccessibleCheckAbilityTest", "accessiblecheckability:ActsAccessibleCheckAbilityTest",
......
...@@ -32,8 +32,6 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility { ...@@ -32,8 +32,6 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility {
function publishCallback(err) { function publishCallback(err) {
console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err)); console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err));
} }
this.context.setEventTypeFilter(['click']);
} }
onDisconnect() { onDisconnect() {
......
...@@ -157,7 +157,13 @@ export class ElementTest { ...@@ -157,7 +157,13 @@ export class ElementTest {
result = await this.executeAttributeValuePromise(caseName, 'endIndex', 'number'); result = await this.executeAttributeValuePromise(caseName, 'endIndex', 'number');
break; break;
case 'AccessibilityElementTest_attributeValue_asyncPromise_3700': case 'AccessibilityElementTest_attributeValue_asyncPromise_3700':
result = await this.executeAttributeValuePromise(caseName, 'rangeInfo', 'object'); result = await this.executeAttributeValuePromise(caseName, 'valueMax', 'number');
break;
case 'AccessibilityElementTest_attributeValue_asyncPromise_3800':
result = await this.executeAttributeValuePromise(caseName, 'valueMin', 'number');
break;
case 'AccessibilityElementTest_attributeValue_asyncPromise_3900':
result = await this.executeAttributeValuePromise(caseName, 'valueNow', 'number');
break; break;
case 'AccessibilityElementTest_attributeValue_asyncPromise_4200': case 'AccessibilityElementTest_attributeValue_asyncPromise_4200':
result = await this.executeAttributeValuePromise(caseName, 'error', 'string'); result = await this.executeAttributeValuePromise(caseName, 'error', 'string');
...@@ -391,7 +397,13 @@ export class ElementTest { ...@@ -391,7 +397,13 @@ export class ElementTest {
await this.executeAttributeValueCallback(caseName, 'endIndex', 'number'); await this.executeAttributeValueCallback(caseName, 'endIndex', 'number');
return; return;
case 'AccessibilityElementTest_attributeValue_asyncCallback_3700': case 'AccessibilityElementTest_attributeValue_asyncCallback_3700':
await this.executeAttributeValueCallback(caseName, 'rangeInfo', 'object'); await this.executeAttributeValueCallback(caseName, 'valueMax', 'number');
return;
case 'AccessibilityElementTest_attributeValue_asyncCallback_3800':
await this.executeAttributeValueCallback(caseName, 'valueMin', 'number');
return;
case 'AccessibilityElementTest_attributeValue_asyncCallback_3900':
await this.executeAttributeValueCallback(caseName, 'valueNow', 'number');
return; return;
case 'AccessibilityElementTest_attributeValue_asyncCallback_4200': case 'AccessibilityElementTest_attributeValue_asyncCallback_4200':
await this.executeAttributeValueCallback(caseName, 'error', 'string'); await this.executeAttributeValueCallback(caseName, 'error', 'string');
......
...@@ -26,11 +26,6 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility { ...@@ -26,11 +26,6 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility {
function publishCallback(err) { function publishCallback(err) {
console.info("[Demo] onConnect====>onConnect publish call back result:" + JSON.stringify(err)); console.info("[Demo] onConnect====>onConnect publish call back result:" + JSON.stringify(err));
} }
this.context.setEventTypeFilter([
'accessibilityFocus', 'accessibilityFocusClear', 'click', 'longClick', 'focus', 'select', 'hoverEnter',
'hoverExit', 'textUpdate', 'textSelectionUpdate', 'scroll'
]);
} }
onDisconnect() { onDisconnect() {
......
...@@ -62,62 +62,6 @@ export class ExtensionContextTest { ...@@ -62,62 +62,6 @@ export class ExtensionContextTest {
let gesturePos3 = {}; let gesturePos3 = {};
switch (caseName) { switch (caseName) {
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0100':
eventType = ['accessibilityFocus'];
this.setEventTypeFilterCallback(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0200':
eventType = ['accessibilityFocusClear'];
this.setEventTypeFilterCallback(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0300':
eventType = ['click', 'longClick'];
this.setEventTypeFilterCallback(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0400':
eventType = ['focus', 'select'];
this.setEventTypeFilterCallback(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0500':
eventType = ['hoverEnter', 'hoverExit'];
this.setEventTypeFilterCallback(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0600':
eventType = ['accessibilityFocus', 'accessibilityFocusClear', 'click', 'longClick',
'focus', 'select', 'hoverEnter', 'hoverExit', 'textUpdate', 'textSelectionUpdate','scroll'];
this.setEventTypeFilterCallback(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0700':
this.setEventTypeFilterCallback(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0800':
eventType = ['accessibilityFocus'];
this.setEventTypeFilterPromise(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0900':
eventType = ['accessibilityFocusClear'];
this.setEventTypeFilterPromise(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1000':
eventType = ['click', 'longClick'];
this.setEventTypeFilterPromise(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1100':
eventType = ['focus', 'select'];
this.setEventTypeFilterPromise(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1200':
eventType = ['hoverEnter', 'hoverExit'];
this.setEventTypeFilterPromise(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1300':
eventType = ['accessibilityFocus', 'accessibilityFocusClear', 'click', 'longClick',
'focus', 'select', 'hoverEnter', 'hoverExit', 'textUpdate', 'textSelectionUpdate','scroll'];
this.setEventTypeFilterPromise(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1400':
this.setEventTypeFilterPromise(caseName, eventType);
break;
case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500': case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500':
bundleName = ['com.example.accessibleformextension']; bundleName = ['com.example.accessibleformextension'];
this.setTargetBundleNameCallback(caseName, bundleName); this.setTargetBundleNameCallback(caseName, bundleName);
...@@ -374,83 +318,26 @@ export class ExtensionContextTest { ...@@ -374,83 +318,26 @@ export class ExtensionContextTest {
} }
} }
private async setEventTypeFilterCallback(caseName: string, eventType: Array<accessibility.Event>) {
let result = false;
if (eventType.length == 0) {
this.context.setEventTypeFilter(eventType, (err, res) => {
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.setEventTypeFilter(eventType, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err.code != 0 ) {
console.error(caseName + " err: " + JSON.stringify(err.code));
}
if (typeof(res) == 'boolean') {
result = true;
}
this.publishCaseResult(caseName, result);
});
}
}
private async setEventTypeFilterPromise(caseName: string, eventType: Array<accessibility.Event>) {
let result = false;
if (eventType.length == 0) {
this.context.setEventTypeFilter(eventType).then((res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (res == undefined) {
result = true;
}
this.publishCaseResult(caseName, result);
}).catch((error) => {
console.error(caseName + " error: " + JSON.stringify(error));
result = true;
this.publishCaseResult(caseName, result);
});
} else {
this.context.setEventTypeFilter(eventType).then((res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (typeof(res) == 'boolean') {
result = true;
}
this.publishCaseResult(caseName, result);
}).catch((error) => {
console.error(caseName + " error: " + JSON.stringify(error));
this.publishCaseResult(caseName, result);
});
}
}
private async setTargetBundleNameCallback(caseName: string, bundleName: Array<string>) { private async setTargetBundleNameCallback(caseName: string, bundleName: Array<string>) {
let result = false; let result = true;
this.context.setTargetBundleName(bundleName, (err, res) => { this.context.setTargetBundleName(bundleName, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res)); console.info(caseName + " res: " + JSON.stringify(res));
if (err.code != 0) { if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code)); console.error(caseName + " err: " + JSON.stringify(err.code));
} result = false;
if (typeof(res) == 'boolean') {
result = true;
} }
this.publishCaseResult(caseName, result); this.publishCaseResult(caseName, result);
}); });
} }
private async setTargetBundleNamePromise(caseName: string, bundleName: Array<string>) { private async setTargetBundleNamePromise(caseName: string, bundleName: Array<string>) {
let result = false; let result = true;
this.context.setTargetBundleName(bundleName).then((res) => { this.context.setTargetBundleName(bundleName).then((res) => {
console.info(caseName + " res: " + JSON.stringify(res)); console.info(caseName + " res: " + JSON.stringify(res));
if (typeof(res) == 'boolean') { this.publishCaseResult(caseName, result);
result = true; }).catch((error) => {
} console.error(caseName + " error: " + JSON.stringify(error));
result = false;
this.publishCaseResult(caseName, result); this.publishCaseResult(caseName, result);
}); });
} }
...@@ -718,7 +605,7 @@ export class ExtensionContextTest { ...@@ -718,7 +605,7 @@ export class ExtensionContextTest {
private async gestureInjectCallback(caseName: string, gesturePath: object) { private async gestureInjectCallback(caseName: string, gesturePath: object) {
let result = false; let result = false;
if (gesturePath == undefined) { if (gesturePath == undefined) {
this.context.gestureInject(gesturePath, () => {}, (err, res) => { this.context.injectGesture(gesturePath, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res)); console.info(caseName + " res: " + JSON.stringify(res));
if (err.code != 0) { if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code)); console.error(caseName + " err: " + JSON.stringify(err.code));
...@@ -730,15 +617,11 @@ export class ExtensionContextTest { ...@@ -730,15 +617,11 @@ export class ExtensionContextTest {
this.publishCaseResult(caseName, result); this.publishCaseResult(caseName, result);
}); });
} else { } else {
this.context.gestureInject(gesturePath, () => {}, (err, res) => { this.context.injectGesture(gesturePath, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res)); console.info(caseName + " res: " + JSON.stringify(res));
result = true;
if (err.code != 0) { if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code)); console.error(caseName + " err: " + JSON.stringify(err.code));
}
if (typeof(res) == 'boolean') {
result = true;
}
if (res == undefined) {
result = false; result = false;
} }
this.publishCaseResult(caseName, result); this.publishCaseResult(caseName, result);
...@@ -750,7 +633,7 @@ export class ExtensionContextTest { ...@@ -750,7 +633,7 @@ export class ExtensionContextTest {
private async gestureInjectPromise(caseName: string, gesturePath: object) { private async gestureInjectPromise(caseName: string, gesturePath: object) {
let result = false; let result = false;
if (gesturePath == undefined) { if (gesturePath == undefined) {
this.context.gestureInject(gesturePath, () => {}).then((res) => { this.context.injectGesture(gesturePath).then((res) => {
console.info(caseName + " res: " + JSON.stringify(res)); console.info(caseName + " res: " + JSON.stringify(res));
if (res == undefined) { if (res == undefined) {
result = true; result = true;
...@@ -762,17 +645,13 @@ export class ExtensionContextTest { ...@@ -762,17 +645,13 @@ export class ExtensionContextTest {
this.publishCaseResult(caseName, result); this.publishCaseResult(caseName, result);
}); });
} else { } else {
this.context.gestureInject(gesturePath, () => {}).then((res) => { this.context.injectGesture(gesturePath).then((res) => {
console.info(caseName + " res: " + JSON.stringify(res)); console.info(caseName + " res: " + JSON.stringify(res));
if (typeof(res) == 'boolean') { result = true;
result = true;
}
if (res == undefined) {
result = false;
}
this.publishCaseResult(caseName, result); this.publishCaseResult(caseName, result);
}).catch ((err) => { }).catch ((err) => {
console.error(caseName + 'error:' + JSON.stringify(err)); console.error(caseName + 'error:' + JSON.stringify(err));
result = false;
this.publishCaseResult(caseName, result); this.publishCaseResult(caseName, result);
}); });
} }
......
...@@ -32,8 +32,6 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility { ...@@ -32,8 +32,6 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility {
function publishCallback(err) { function publishCallback(err) {
console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err)); console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err));
} }
this.context.setEventTypeFilter(['gesture']);
} }
onDisconnect() { onDisconnect() {
......
...@@ -280,7 +280,7 @@ export class GestureEventTest { ...@@ -280,7 +280,7 @@ export class GestureEventTest {
} }
private async gestureInject(caseName: string, gesturePath: object) { private async gestureInject(caseName: string, gesturePath: object) {
let ret = await this.context?.gestureInject(gesturePath, () => {}); await this.context?.injectGesture(gesturePath);
console.info('GestureEventTest processCase: ' + caseName + ' ret: ' + ret); console.info('GestureEventTest processCase: ' + caseName);
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册