提交 b5b0ac17 编写于 作者: W wangguan

Grid XTS 用例修复

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