提交 e275f6f8 编写于 作者: M Mupceet

add xts api case

Signed-off-by: NMupceet <laiguizhong@huawei.com>
上级 e1f92667
......@@ -32,8 +32,6 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility {
function publishCallback(err) {
console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err));
}
this.context.setEventTypeFilter(['click']);
}
onDisconnect() {
......
......@@ -157,7 +157,13 @@ export class ElementTest {
result = await this.executeAttributeValuePromise(caseName, 'endIndex', 'number');
break;
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;
case 'AccessibilityElementTest_attributeValue_asyncPromise_4200':
result = await this.executeAttributeValuePromise(caseName, 'error', 'string');
......@@ -391,7 +397,13 @@ export class ElementTest {
await this.executeAttributeValueCallback(caseName, 'endIndex', 'number');
return;
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;
case 'AccessibilityElementTest_attributeValue_asyncCallback_4200':
await this.executeAttributeValueCallback(caseName, 'error', 'string');
......
......@@ -26,11 +26,6 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility {
function publishCallback(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() {
......
......@@ -62,62 +62,6 @@ export class ExtensionContextTest {
let gesturePos3 = {};
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':
bundleName = ['com.example.accessibleformextension'];
this.setTargetBundleNameCallback(caseName, bundleName);
......@@ -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>) {
let result = false;
let result = true;
this.context.setTargetBundleName(bundleName, (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;
result = false;
}
this.publishCaseResult(caseName, result);
});
}
private async setTargetBundleNamePromise(caseName: string, bundleName: Array<string>) {
let result = false;
let result = true;
this.context.setTargetBundleName(bundleName).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));
result = false;
this.publishCaseResult(caseName, result);
});
}
......@@ -718,7 +605,7 @@ export class ExtensionContextTest {
private async gestureInjectCallback(caseName: string, gesturePath: object) {
let result = false;
if (gesturePath == undefined) {
this.context.gestureInject(gesturePath, () => {}, (err, res) => {
this.context.injectGesture(gesturePath, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
......@@ -730,15 +617,11 @@ export class ExtensionContextTest {
this.publishCaseResult(caseName, result);
});
} else {
this.context.gestureInject(gesturePath, () => {}, (err, res) => {
this.context.injectGesture(gesturePath, (err, res) => {
console.info(caseName + " res: " + JSON.stringify(res));
result = true;
if (err.code != 0) {
console.error(caseName + " err: " + JSON.stringify(err.code));
}
if (typeof(res) == 'boolean') {
result = true;
}
if (res == undefined) {
result = false;
}
this.publishCaseResult(caseName, result);
......@@ -750,7 +633,7 @@ export class ExtensionContextTest {
private async gestureInjectPromise(caseName: string, gesturePath: object) {
let result = false;
if (gesturePath == undefined) {
this.context.gestureInject(gesturePath, () => {}).then((res) => {
this.context.injectGesture(gesturePath).then((res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (res == undefined) {
result = true;
......@@ -762,17 +645,13 @@ export class ExtensionContextTest {
this.publishCaseResult(caseName, result);
});
} else {
this.context.gestureInject(gesturePath, () => {}).then((res) => {
this.context.injectGesture(gesturePath).then((res) => {
console.info(caseName + " res: " + JSON.stringify(res));
if (typeof(res) == 'boolean') {
result = true;
}
if (res == undefined) {
result = false;
}
result = true;
this.publishCaseResult(caseName, result);
}).catch ((err) => {
console.error(caseName + 'error:' + JSON.stringify(err));
result = false;
this.publishCaseResult(caseName, result);
});
}
......
......@@ -32,8 +32,6 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility {
function publishCallback(err) {
console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err));
}
this.context.setEventTypeFilter(['gesture']);
}
onDisconnect() {
......
......@@ -280,7 +280,7 @@ export class GestureEventTest {
}
private async gestureInject(caseName: string, gesturePath: object) {
let ret = await this.context?.gestureInject(gesturePath, () => {});
console.info('GestureEventTest processCase: ' + caseName + ' ret: ' + ret);
await this.context?.injectGesture(gesturePath);
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.
先完成此消息的编辑!
想要评论请 注册