diff --git a/barrierfree/BUILD.gn b/barrierfree/BUILD.gn index a82607d2fe80acef628a1d9ca6963ffc97c46ae0..fc10957c93a9a727bf601d7f4ea1cb2b6abfc08e 100644 --- a/barrierfree/BUILD.gn +++ b/barrierfree/BUILD.gn @@ -19,19 +19,18 @@ 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", "accessibleregisterstate:ActsAccessibleRegisterStateTest", "accessiblesendevent:ActsAccessibleSendEventTest", - "accessibilityerrcode:ActsAccessibilityErrCodeTest", - "accessibilitysendaccessibilityevent:ActsAccessibilitySendAccessibilityEventTest", "accessibletest:actsaccessibletest", "targetProject/aceTest:aceTest", ] diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts b/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts index 22ace777430d60e1b7cb1cd94f237a9b5d923653..6d7718634d95fefd48c1aa3d4c03a56d5ba31b54 100644 --- a/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts +++ b/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts @@ -743,8 +743,8 @@ export class ElementTest { } } catch (e) { console.info('ElementTest executePerformActionPromise ' + caseName + ' catch(e): ' + JSON.stringify(e)); - if (action == invalidString && e && e.code != 0) { - if (e.code == 9300005) { + if (e && e.code != 0) { + if (e.code == 9300005 || e.code == 9300000) { result = true; } result = true; @@ -854,7 +854,9 @@ 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.code == 0 && Array.isArray(names)) { + if (err && err.code != 0) { + result = false; + } else if (Array.isArray(names)) { result = true; } this.publishCaseResult(caseName, result); @@ -877,9 +879,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 (input == invalidString && err && err.code != 0) { + if (err && err.code != 0) { result = true; - } else if (err.code == 0 && typeof(value) == outputType) { + } else if (typeof(value) == outputType) { result = true; } else { console.warn('ElementTest executeAttributeValueCallback ' + caseName + ' valueType: ' + typeof(value)); @@ -903,10 +905,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 (err.code == 0 && typeof(value) == 'object' && typeof(value.left) == 'number' + if (typeof(value) == 'object' && typeof(value.left) == 'number' && typeof(value.top) == 'number' && typeof(value.width) == 'number' && typeof(value.height) == 'number') { result = true; - } else { + } else if (err) { console.warn('ElementTest executeAttributeValueCallbackRect ' + caseName + ' valueType: ' + typeof(value)); } this.publishCaseResult(caseName, result); @@ -932,7 +934,9 @@ 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.code == 0 && eventType == 'click' && typeof(value) == 'string') { + if (err) { + this.publishCaseResult(caseName, false); + } else if (eventType == 'click' && typeof(value) == 'string') { this.publishCaseResult(caseName, true); } }); @@ -964,7 +968,9 @@ 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.code == 0 && typeof(value) == 'object') { + if (err) { + let result = false; + } else if (typeof(value) == 'object') { result = true; } else { console.warn('ElementTest executeAttributeValueCallback ' + caseName + ' valueType: ' + typeof(value)); @@ -982,7 +988,9 @@ 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.code == 0 && Array.isArray(value)) { + if (err) { + let result = false; + } else if (Array.isArray(value)) { if ((value.length == 0)|| (value.length > 0 && typeof(value[0]) == outputType)) { result = true; @@ -1000,7 +1008,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 (err.code == 0 && Array.isArray(actions)) { + if (Array.isArray(actions)) { if ((actions.length == 0) || (actions.length > 0 && typeof(actions[0]) == 'string')) { result = true; @@ -1020,12 +1028,12 @@ 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 (action == invalidString && err && err.code != 0) { - if (err.code == 9300005) { + if (err && err.code != 0) { + if (err.code == 9300005 || err.code == 9300000) { result = true; } result = true; - } else if (err.code == 0 && typeof(ret) == 'undefined') { + } else if (typeof(ret) == 'undefined') { result = true; } this.publishCaseResult(caseName, result); @@ -1043,7 +1051,7 @@ export class ElementTest { console.info('ElementTest executeFindElementCallbackByContent ' + caseName + ' element: ' + JSON.stringify(found)); if (condition == invalidString && err && err.code != 0) { result = true; - } else if (err.code == 0 && Array.isArray(found)) { + } else if (Array.isArray(found)) { if (found.length == 0 || typeof(found[0]) == 'object') { result = true; } @@ -1067,7 +1075,7 @@ export class ElementTest { console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' element: ' + JSON.stringify(found)); if (condition == invalidString && err && err.code != 0) { result = true; - } else if (err.code == 0 && typeof(found) == 'object') { + } else if (typeof(found) == 'object') { result = true; } this.publishCaseResult(caseName, result); @@ -1092,7 +1100,7 @@ export class ElementTest { console.info('ElementTest executeFindElementCallbackByFocusDirection ' + caseName + ' element: ' + JSON.stringify(found)); if (condition == invalidString && err.code != 0) { result = true; - } else if (err.code == 0 && typeof(found) == 'object') { + } else if (typeof(found) == 'object') { result = true; } this.publishCaseResult(caseName, result); @@ -1113,7 +1121,9 @@ 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.code == 0 && typeof(found) == 'object') { + if (err && err.code != 0) { + + }if (typeof(found) == 'object') { result = true; } this.publishCaseResult(caseName, result);