Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
329acc85
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看板
未验证
提交
329acc85
编写于
8月 11, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 11, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9730 Grid添加7个回调函数的相关XTS用例
Merge pull request !9730 from 王关/master
上级
99ea1982
75114d6c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
128 addition
and
9 deletion
+128
-9
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/GridPage.ets
...nent_ui/entry/src/main/ets/MainAbility/pages/GridPage.ets
+56
-3
arkui/ace_ets_component_ui/entry/src/main/ets/test/GridJsunit.test.ets
..._component_ui/entry/src/main/ets/test/GridJsunit.test.ets
+72
-6
未找到文件。
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/GridPage.ets
浏览文件 @
329acc85
...
...
@@ -40,6 +40,13 @@ struct GridPage {
@State onItemDragMove: string = 'onItemDragMove'
@State onItemDragLeave: string = 'onItemDragLeave'
@State onItemDrop: string = 'onItemDrop'
@State onScrollText: string = 'onScroll'
@State onScrollIndexText: string = 'onScrollIndex'
@State onReachStartText: string = 'onReachStart'
@State onReachEndText: string = 'onReachEnd'
@State onScrollStartText: string = 'onScrollStart'
@State onScrollStopText: string = 'onScrollStop'
@State onScrollFrameBeginText: string = 'onScrollFrameBegin'
@State myKey: number = 0
scroller: Scroller = new Scroller()
messageManager:MessageManager = new MessageManager()
...
...
@@ -144,7 +151,8 @@ struct GridPage {
.width('90%')
.key('grid1')
.backgroundColor(0xFAEEE0)
.height(200)
.height(150)
.edgeEffect(EdgeEffect.Spring)
.onItemDragStart((event: ItemDragInfo, itemIndex: number) => {
this.onItemDragStart = 'onItemDragStart:succ'
console.info('DragInfo_x: ' + event.x + ' DragInfo_y: ' + event.y)
...
...
@@ -195,7 +203,36 @@ struct GridPage {
})
.width('90%')
.backgroundColor(0xFAEEE0)
.height(250)
.height(200)
.onScroll((scrollOffset: number, scrollState: ScrollState) => {
this.onScrollText = 'onScroll:succ'
console.info('onScroll scrollOffset:' + scrollOffset.toString() + ' ScrollState:' + ScrollState.toString())
})
.onScrollIndex((first: number,last: number) => {
this.onScrollIndexText = "onScrollIndex:succ"
console.info("onScrollIndex first:" + first.toString() + " last:" + last.toString())
})
.onReachStart(() => {
this.onReachStartText = 'onReachStart:succ'
console.info('onReachStart !')
})
.onReachEnd(() => {
this.onReachEndText = 'onReachEnd:succ'
console.info('onReachEnd !')
})
.onScrollStart(() => {
this.onScrollStartText = 'onScrollStart:succ'
console.info('onScrollStart !')
})
.onScrollStop(() => {
this.onScrollStopText = 'onScrollStop:succ'
console.info('onScrollStop !')
})
.onScrollFrameBegin((offset: number, state: ScrollState) => {
this.onScrollFrameBeginText = 'onScrollFrameBegin:succ'
console.info('onScrollFrameBegin offset:' + offset +' state:' + state)
return { offsetRemain: offset }
})
Button(this.buttonName)
.key('button')
...
...
@@ -209,6 +246,22 @@ struct GridPage {
Text(this.onItemDragMove).key('onItemDragMove')
Text(this.onItemDragLeave).key('onItemDragLeave')
Text(this.onItemDrop).key('onItemDrop')
Row()
{
Text(this.onScrollText).margin({right:10}).key('onScrollText')
Text(this.onReachStartText).key('onReachStartText')
}
Row()
{
Text(this.onReachEndText).margin({right:10}).key('onReachEndText')
Text(this.onScrollStartText).key('onScrollStartText')
}
Row()
{
Text(this.onScrollIndexText).margin({right:10}).key('onScrollIndexText')
Text(this.onScrollStopText).key('onScrollStopText')
}
Text(this.onScrollFrameBeginText).key('onScrollFrameBeginText')
}.width('100%').margin({ top: 5 })
}
}
\ No newline at end of file
}
arkui/ace_ets_component_ui/entry/src/main/ets/test/GridJsunit.test.ets
浏览文件 @
329acc85
...
...
@@ -139,28 +139,29 @@ export default function GridJsunit() {
// Verify the event of the Grid component
console.info('[GridJsunit_0400] START');
await CommonFunc.sleep(1000);
// Verify onScrollIndex event
let grid2 = CommonFunc.getComponentRect('grid2');
let top = grid2.top
let bottom = grid2.bottom
let left = grid2.left
let right = grid2.right
let driver = await
Ui
Driver.create()
let driver = await Driver.create()
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
let onScrollIndex1 = await driver.findComponent(
BY.key
('onScrollIndex'));
let onScrollIndex1 = await driver.findComponent(
ON.text
('onScrollIndex'));
let text1 = await onScrollIndex1.getText();
expect(text1).assertEqual('onScrollIndex:10');
await CommonFunc.sleep(1000);
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
let onScrollIndex2 = await driver.findComponent(
BY.key
('onScrollIndex'));
let onScrollIndex2 = await driver.findComponent(
ON.text
('onScrollIndex'));
let text2 = await onScrollIndex2.getText();
expect(text2).assertEqual('onScrollIndex:10');
// Verify common attribute click event
let button = await driver.findComponent(
BY.key
('button'));
let button = await driver.findComponent(
ON.text
('button'));
await button.click();
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('button');
...
...
@@ -204,7 +205,7 @@ export default function GridJsunit() {
let gridItem2 = CommonFunc.getComponentRect('2');
let top = gridItem2.top
expect(top > bottom).assertTrue();
// Verify grid componentcan cannot scroll
let driver = await UiDriver.create()
let grid_1 = await driver.findComponent(BY.key('grid1'));
...
...
@@ -262,5 +263,70 @@ export default function GridJsunit() {
console.info('[GridJsunit_0900] END');
done();
});
it('GridJsunit_1000', 0, async function (done) {
// Verify Neither rowsTemplate nor columnsTemplate is set
console.info('[GridJsunit_1000] START');
let grid2 = CommonFunc.getComponentRect('grid2');
let top = grid2.top
let bottom = grid2.bottom
let left = grid2.left
let right = grid2.right
let driver = await UiDriver.create()
await driver.swipe(Math.round((right - left)), Math.round(bottom - 60), Math.round((right - left)), Math.round(top + 60));
await CommonFunc.sleep(200);
let onReachStartText = await driver.findComponent(BY.key('onReachStartText'));
let text3 = await onReachStartText.getText();
console.info('[GridJsunit_1000] onReachStartText' + text3);
expect(text3).assertEqual('onReachStart:succ');
await CommonFunc.sleep(200);
let onScrollText = await driver.findComponent(BY.key('onScrollText'));
let text4 = await onScrollText.getText();
console.info('[GridJsunit_1000] onScrollText' + text4);
expect(text4).assertEqual('onScroll:succ');
let onScrollIndexText = await driver.findComponent(BY.key('onScrollIndexText'));
let text5 = await onScrollIndexText.getText();
console.info('[GridJsunit_1000] onScrollIndexText' + text5);
expect(text5).assertEqual('onScrollIndex:succ');
let onScrollStartText = await driver.findComponent(BY.key('onScrollStartText'));
let text6 = await onScrollStartText.getText();
console.info('[GridJsunit_1000] onScrollStartText' + text6);
expect(text6).assertEqual('onScrollStart:succ');
await CommonFunc.sleep(200);
let onScrollStopText = await driver.findComponent(BY.key('onScrollStopText'));
let text7 = await onScrollStopText.getText();
console.info('[GridJsunit_1000] onScrollStopText' + text7);
expect(text7).assertEqual('onScrollStop:succ');
await CommonFunc.sleep(200);
let onScrollFrameBeginText = await driver.findComponent(BY.key('onScrollFrameBeginText'));
let text8 = await onScrollFrameBeginText.getText();
console.info('[GridJsunit_1000] nScrollFrameBeginText ' + text8);
expect(text8).assertEqual('onScrollFrameBegin:succ');
await CommonFunc.sleep(200);
await driver.swipe(Math.round((right - left)), Math.round(top + 60), Math.round((right - left)), Math.round(bottom - 60));
await driver.swipe(Math.round((right - left)), Math.round(top + 60), Math.round((right - left)), Math.round(bottom - 60));
await driver.swipe(Math.round((right - left)), Math.round(top + 60), Math.round((right - left)), Math.round(bottom - 60));
await CommonFunc.sleep(1000);
await driver.swipe(Math.round((right - left)), Math.round(top + 60), Math.round((right - left)), Math.round(bottom - 60));
await driver.swipe(Math.round((right - left)), Math.round(top + 60), Math.round((right - left)), Math.round(bottom - 60));
await driver.swipe(Math.round((right - left)), Math.round(top + 60), Math.round((right - left)), Math.round(bottom - 60));
await CommonFunc.sleep(1000);
let onReachEndText = await driver.findComponent(BY.key('onReachEndText'));
let text9= await onReachEndText.getText();
console.info("[GridJsunit_1000] onReachEndText: " + text9);
expect(text9).assertEqual('onReachEnd:succ');
await CommonFunc.sleep(1000);
console.info('[GridJsunit_1000] END');
done();
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录