Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
81cf550e
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
81cf550e
编写于
7月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4653 合入无障碍xts api测试用例
Merge pull request !4653 from Mupceet/release_0727_xts
上级
9f285899
d9bf6dab
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
144 addition
and
38 deletion
+144
-38
barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts
...entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts
+56
-4
barrierfree/accessibilityevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts
...in/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts
+3
-1
barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets
...t/entry/src/main/ets/test/AccessibilityEventTest.test.ets
+85
-33
未找到文件。
barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts
浏览文件 @
81cf550e
...
...
@@ -100,7 +100,7 @@ export class ElementTest {
result
=
await
this
.
executeAttributeValuePromise
(
caseName
,
'
textLengthLimit
'
,
'
number
'
);
break
;
case
'
AccessibilityElementTest_attributeValue_asyncPromise_1500
'
:
result
=
await
this
.
executeAttributeValuePromise
(
caseName
,
'
rect
'
,
'
obj
ect
'
);
result
=
await
this
.
executeAttributeValuePromise
Rect
(
caseName
,
'
r
ect
'
);
break
;
case
'
AccessibilityElementTest_attributeValue_asyncPromise_1600
'
:
result
=
await
this
.
executeAttributeValuePromise
(
caseName
,
'
checkable
'
,
'
boolean
'
);
...
...
@@ -184,7 +184,7 @@ export class ElementTest {
result
=
await
this
.
executeAttributeValuePromise
(
caseName
,
'
isActive
'
,
'
boolean
'
,
true
);
break
;
case
'
AccessibilityElementTest_attributeValue_asyncPromise_5300
'
:
result
=
await
this
.
executeAttributeValuePromise
(
caseName
,
'
screenRect
'
,
'
obj
ect
'
,
true
);
result
=
await
this
.
executeAttributeValuePromise
Rect
(
caseName
,
'
screenR
ect
'
,
true
);
break
;
case
'
AccessibilityElementTest_attributeValue_asyncPromise_5400
'
:
result
=
await
this
.
executeAttributeValuePromise
(
caseName
,
'
layer
'
,
'
number
'
,
true
);
...
...
@@ -334,7 +334,7 @@ export class ElementTest {
await
this
.
executeAttributeValueCallback
(
caseName
,
'
textLengthLimit
'
,
'
number
'
);
return
;
case
'
AccessibilityElementTest_attributeValue_asyncCallback_1500
'
:
await
this
.
executeAttributeValueCallback
(
caseName
,
'
rect
'
,
'
obj
ect
'
);
await
this
.
executeAttributeValueCallback
Rect
(
caseName
,
'
r
ect
'
);
return
;
case
'
AccessibilityElementTest_attributeValue_asyncCallback_1600
'
:
await
this
.
executeAttributeValueCallback
(
caseName
,
'
checkable
'
,
'
boolean
'
);
...
...
@@ -418,7 +418,7 @@ export class ElementTest {
await
this
.
executeAttributeValueCallback
(
caseName
,
'
isActive
'
,
'
boolean
'
,
true
);
return
;
case
'
AccessibilityElementTest_attributeValue_asyncCallback_5300
'
:
await
this
.
executeAttributeValueCallback
(
caseName
,
'
screenRect
'
,
'
obj
ect
'
,
true
);
await
this
.
executeAttributeValueCallback
Rect
(
caseName
,
'
screenR
ect
'
,
true
);
return
;
case
'
AccessibilityElementTest_attributeValue_asyncCallback_5400
'
:
await
this
.
executeAttributeValueCallback
(
caseName
,
'
layer
'
,
'
number
'
,
true
);
...
...
@@ -600,6 +600,33 @@ export class ElementTest {
return
result
;
}
private
async
executeAttributeValuePromiseRect
(
caseName
:
string
,
input
:
string
,
isWindow
:
boolean
=
false
):
Promise
<
boolean
>
{
let
element
=
undefined
;
if
(
isWindow
)
{
element
=
await
this
.
getWindowElement
();
}
else
{
element
=
await
this
.
getBaseElement
();
}
let
result
=
false
;
if
(
element
)
{
try
{
console
.
info
(
'
ElementTest executeAttributeValuePromiseRect
'
+
caseName
);
let
value
=
await
element
.
attributeValue
(
input
);
console
.
info
(
'
ElementTest executeAttributeValuePromiseRect
'
+
caseName
+
'
value:
'
+
JSON
.
stringify
(
value
));
if
(
typeof
(
value
)
==
'
object
'
&&
typeof
(
value
.
left
)
==
'
number
'
&&
typeof
(
value
.
top
)
==
'
number
'
&&
typeof
(
value
.
width
)
==
'
number
'
&&
typeof
(
value
.
height
)
==
'
number
'
)
{
result
=
true
;
}
else
{
console
.
warn
(
'
ElementTest executeAttributeValuePromiseRect
'
+
caseName
+
'
valueType:
'
+
typeof
(
value
));
}
}
catch
(
e
)
{
console
.
info
(
'
ElementTest executeAttributeValuePromiseRect
'
+
caseName
+
'
catch(e):
'
+
JSON
.
stringify
(
e
));
}
}
return
result
;
}
private
async
executeAttributeValuePromiseTriggerAction
(
caseName
:
string
)
{
console
.
info
(
'
ElementTest executeAttributeValuePromiseTriggerAction
'
+
caseName
+
'
start
'
);
let
event
=
new
accessibility
.
EventInfo
({});
...
...
@@ -846,6 +873,31 @@ export class ElementTest {
}
}
private
async
executeAttributeValueCallbackRect
(
caseName
:
string
,
input
:
string
,
isWindow
:
boolean
=
false
)
{
let
element
=
undefined
;
if
(
isWindow
)
{
element
=
await
this
.
getWindowElement
();
}
else
{
element
=
await
this
.
getBaseElement
();
}
let
result
=
false
;
if
(
element
)
{
console
.
info
(
'
ElementTest executeAttributeValueCallbackRect
'
+
caseName
);
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
'
&&
typeof
(
value
.
top
)
==
'
number
'
&&
typeof
(
value
.
width
)
==
'
number
'
&&
typeof
(
value
.
height
)
==
'
number
'
)
{
result
=
true
;
}
else
{
console
.
warn
(
'
ElementTest executeAttributeValueCallbackRect
'
+
caseName
+
'
valueType:
'
+
typeof
(
value
));
}
this
.
publishCaseResult
(
caseName
,
result
);
});
}
}
private
async
executeAttributeValueCallbackTriggerAction
(
caseName
:
string
)
{
console
.
info
(
'
ElementTest executeAttributeValueCallbackTriggerAction
'
+
caseName
+
'
start
'
);
let
event
=
new
accessibility
.
EventInfo
({});
...
...
barrierfree/accessibilityevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts
浏览文件 @
81cf550e
...
...
@@ -50,7 +50,9 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility {
let
commonEventPublishData
=
{
data
:
'
accessibilityEvent
'
,
parameters
:
{
eventType
:
accessibilityEvent
.
eventType
eventType
:
accessibilityEvent
.
eventType
,
haveTarget
:
(
typeof
(
accessibilityEvent
.
target
)
==
'
object
'
),
timeStamp
:
accessibilityEvent
.
timeStamp
}
}
commonEvent
.
publish
(
'
accessibilityEvent
'
,
commonEventPublishData
,
publishCallback
);
...
...
barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets
浏览文件 @
81cf550e
...
...
@@ -20,7 +20,7 @@ export default function abilityTest(abilityContext) {
let targetBundleName = 'com.example.myapplication';
let subScriber = undefined;
let isConnected: boolean = false;
let event
Types: Array<string
> = [];
let event
s: Array<any
> = [];
describe('AccessibilityEventTest', function () {
beforeAll(async function (done) {
...
...
@@ -33,7 +33,7 @@ export default function abilityTest(abilityContext) {
} else if (data.data == 'disconnect') {
isConnected = false;
} else if (data.data == 'accessibilityEvent') {
event
Types.push(data.parameters.eventType
);
event
s.push(data.parameters
);
}
});
...
...
@@ -58,7 +58,7 @@ export default function abilityTest(abilityContext) {
beforeEach(async function (done) {
console.info(`AccessibilityEventTest: beforeEach`);
event
Type
s.length = 0;
events.length = 0;
setTimeout(done, 2000);
})
...
...
@@ -86,10 +86,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -117,10 +116,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -148,10 +146,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -179,10 +176,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -210,10 +206,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -241,10 +236,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -272,10 +266,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -303,10 +296,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -365,10 +357,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -396,10 +387,9 @@ export default function abilityTest(abilityContext) {
await accessibility.sendEvent(event);
setTimeout(() => {
let types = eventTypes;
let findResult = false;
for (let
type of type
s) {
if (
t
ype == eventType) {
for (let
item of event
s) {
if (
item.eventT
ype == eventType) {
findResult = true;
}
}
...
...
@@ -408,5 +398,67 @@ export default function abilityTest(abilityContext) {
done();
}, 3000);
})
/*
* @tc.number AccessibilityEventTest_1200
* @tc.name AccessibilityEventTest_1200
* @tc.desc The parameter input is 'scroll', test the Ability event function,
* and return void, verify existence of 'target'.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityEventTest_1200', 0, async function (done) {
console.info(`AccessibilityEventTest_1200`);
let eventType = 'scroll';
let event = new accessibility.EventInfo({});
event.type = eventType;
event.bundleName = targetBundleName;
event.triggerAction = 'scrollForward';
await accessibility.sendEvent(event);
setTimeout(() => {
let findResult = false;
for (let item of events) {
console.info(`AccessibilityEventTest_1200 haveTarget: ${item.haveTarget}`);
if (item.eventType == eventType && item.haveTarget) {
findResult = true;
}
}
console.info('AccessibilityEventTest_1200 case: ' + findResult);
expect(findResult).assertTrue();
done();
}, 3000);
})
/*
* @tc.number AccessibilityEventTest_1300
* @tc.name AccessibilityEventTest_1300
* @tc.desc The parameter input is 'scroll', test the Ability event function,
* and return void, verify existence of 'timeStamp'.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityEventTest_1300', 0, async function (done) {
console.info(`AccessibilityEventTest_1300`);
let eventType = 'scroll';
let event = new accessibility.EventInfo({});
event.type = eventType;
event.bundleName = targetBundleName;
event.triggerAction = 'scrollForward';
await accessibility.sendEvent(event);
setTimeout(() => {
let findResult = false;
for (let item of events) {
console.info(`AccessibilityEventTest_1300 timeStamp: ${item.timeStamp}`);
if (item.eventType == eventType && typeof(item.timeStamp) == 'number') {
findResult = true;
}
}
console.info('AccessibilityEventTest_1300 case: ' + findResult);
expect(findResult).assertTrue();
done();
}, 3000);
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录