提交 b5b0ac17 编写于 作者: W wangguan

Grid XTS 用例修复

Signed-off-by: Nwangguan <wangguan27@huawei.com>
上级 630f5f2b
......@@ -178,10 +178,10 @@ struct GridCallbackPage {
Text('scroll').fontColor(0xCCCCCC).fontSize(9).width('90%')
Grid(this.scroller) {
ForEach(this.Number, (day: string) => {
ForEach(this.Number, (day: string) => {
ForEach(this.Number, (row: string) => {
ForEach(this.Number, (column: string) => {
GridItem() {
Text(day)
Text(row +"-"+ column)
.fontSize(16)
.backgroundColor(0xF9CF93)
.width('100%')
......@@ -235,12 +235,20 @@ struct GridCallbackPage {
return { offsetRemain: offset }
})
Row(){
Button("scoll to bottom")
.key("bottom")
.onClick(() => { // 滑动到底部
console.log("滑动到底部")
this.scroller.scrollTo({xOffset:0,yOffset:2000})
})
Button(this.buttonName)
.key('button')
.onClick(() => { // 点击后滑到下一页
this.buttonName = 'clicked'
this.scroller.scrollPage({ next: true })
})
}
Text('onScrollIndex:' + this.onScrollIndex).key('onScrollIndex')
Text(this.onItemDragStart).key('onItemDragStart')
Text(this.onItemDragEnter).key('onItemDragEnter')
......
......@@ -52,6 +52,7 @@ export default function GridCallbackJsunit() {
let bottom = grid2.bottom
let left = grid2.left
let right = grid2.right
console.log('[GridCallbackJsunit_1000] grid 2 top:' + top +" bottom:" + bottom + "left: " + left + " right:" + 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);
......@@ -91,18 +92,13 @@ export default function GridCallbackJsunit() {
expect(text7).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 bottomButton = await driver.findComponent(BY.key('bottom'));
await bottomButton.click()
await CommonFunc.sleep(2000)
let onReachEndText = await driver.findComponent(BY.key('onReachEndText'));
let text9 = await onReachEndText.getText();
console.info("[GridCallbackJsunit_1000] onReachEndText: " + text9);
expect(text9).assertEqual('onReachEnd:succ');
await CommonFunc.sleep(1000);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册