提交 c55ebaa2 编写于 作者: 李鲲辉

fix bug for "滚动类组件支持配置fling效果的参数"XTS用例

Signed-off-by: N李鲲辉 <likunhui@huawei.com>
上级 f7e021ae
...@@ -69,7 +69,7 @@ struct GridFrictionPage { ...@@ -69,7 +69,7 @@ struct GridFrictionPage {
this.scroller.scrollPage({ next: true }) this.scroller.scrollPage({ next: true })
}) })
.friction(this.friction) .friction(this.friction)
.key(Grid_GridFriction) .key('Grid_GridFriction')
}.width('100%').margin({ top: 5 }) }.width('100%').margin({ top: 5 })
} }
} }
...@@ -57,7 +57,7 @@ struct ListFrictionPage { ...@@ -57,7 +57,7 @@ struct ListFrictionPage {
}) })
.width('90%') .width('90%')
.friction(this.friction) .friction(this.friction)
.key(List_ListFriction) .key('List_ListFriction')
} }
.width('100%') .width('100%')
.height('100%') .height('100%')
......
...@@ -66,7 +66,7 @@ struct ScrollFrictionPage { ...@@ -66,7 +66,7 @@ struct ScrollFrictionPage {
console.info('Scroll Stop') console.info('Scroll Stop')
}) })
.friction(this.friction) .friction(this.friction)
.key(Scroll_ScrollFriction) .key('Scroll_ScrollFriction')
}.width('100%').height('100%').backgroundColor(0xDCDCDC) }.width('100%').height('100%').backgroundColor(0xDCDCDC)
} }
} }
\ No newline at end of file
...@@ -26,6 +26,7 @@ struct WaterFlowFrictionPage { ...@@ -26,6 +26,7 @@ struct WaterFlowFrictionPage {
datasource: WaterFlowDataSource = new WaterFlowDataSource() datasource: WaterFlowDataSource = new WaterFlowDataSource()
private itemWidthArray: number[] = [] private itemWidthArray: number[] = []
private itemHeightArray: number[] = [] private itemHeightArray: number[] = []
@State friction:number = 1000
messageManager:MessageManager = new MessageManager(); messageManager:MessageManager = new MessageManager();
onPageShow() { onPageShow() {
...@@ -42,13 +43,11 @@ struct WaterFlowFrictionPage { ...@@ -42,13 +43,11 @@ struct WaterFlowFrictionPage {
this.messageManager.registerCallback(callback); this.messageManager.registerCallback(callback);
} }
// 计算flow item宽/高
getSize() { getSize() {
let ret = Math.floor(Math.random() * this.maxSize) let ret = Math.floor(Math.random() * this.maxSize)
return (ret > this.minSize ? ret : this.minSize) return (ret > this.minSize ? ret : this.minSize)
} }
// 保存flow item宽/高
getItemSizeArray() { getItemSizeArray() {
for (let i = 0; i < 100; i++) { for (let i = 0; i < 100; i++) {
this.itemWidthArray.push(this.getSize()) this.itemWidthArray.push(this.getSize())
...@@ -110,7 +109,7 @@ struct WaterFlowFrictionPage { ...@@ -110,7 +109,7 @@ struct WaterFlowFrictionPage {
.height('80%') .height('80%')
.layoutDirection(FlexDirection.Column) .layoutDirection(FlexDirection.Column)
.friction(this.friction) .friction(this.friction)
.key(WaterFlow_WaterFlowFriction) .key('WaterFlow_WaterFlowFriction')
} }
} }
} }
...@@ -369,7 +369,7 @@ import Row_Size from './Row/parentComponentChanged/Row_Size.test'; ...@@ -369,7 +369,7 @@ import Row_Size from './Row/parentComponentChanged/Row_Size.test';
import Row_VerticalAlign from './Row/parentComponentChanged/Row_VerticalAlign.test'; import Row_VerticalAlign from './Row/parentComponentChanged/Row_VerticalAlign.test';
import list_ListFrictionTest from './List/List_attribute/List_ListFriction.test'; import list_ListFrictionTest from './List/List_attribute/List_ListFriction.test';
import grid_GridFrictionTest from './Grid/Grid_attribute/Grid_GridFriction.test'; import grid_GridFrictionTest from './Grid/Grid_attribute/Grid_GridFriction.test';
import waterflow_WaterFlowFrictionTest from './WaterFlow/WaterFlow_attribute/Waterflow_WaterFlowFriction.test'; import waterflow_WaterFlowFrictionTest from './WaterFlow/WaterFlow_attribute/WaterFlow_WaterFlowFriction.test';
import scroll_ScrollFrictionTest from './Scroll/Scroll_attribute/Scroll_ScrollFriction.test'; import scroll_ScrollFrictionTest from './Scroll/Scroll_attribute/Scroll_ScrollFriction.test';
import AlignContentFlex_Start from './Flex/alignContent/Start/AlignContentFlex_Start.test.ets'; import AlignContentFlex_Start from './Flex/alignContent/Start/AlignContentFlex_Start.test.ets';
......
...@@ -17,62 +17,62 @@ import router from '@ohos.router'; ...@@ -17,62 +17,62 @@ import router from '@ohos.router';
import CommonFunc from '../../../MainAbility/common/Common'; import CommonFunc from '../../../MainAbility/common/Common';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest'; WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function Waterflow_WaterflowFrictionTest() { export default function WaterFlow_WaterFlowFrictionTest() {
describe('Waterflow_WaterflowFrictionTest', function () { describe('WaterFlow_WaterFlowFrictionTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("Waterflow_WaterflowFrictionTest beforeEach start"); console.info("WaterFlow_WaterFlowFrictionTest beforeEach start");
let options = { let options = {
url: 'MainAbility/pages/Waterflow/Waterflow_attribute/WaterflowFrictionPage', url: 'MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowFrictionPage',
} }
try { try {
router.clear(); router.clear();
let pages = router.getState(); let pages = router.getState();
console.info("get Waterflow_WaterflowFrictionTest state pages:" + JSON.stringify(pages)); console.info("get WaterFlow_WaterFlowFrictionTest state pages:" + JSON.stringify(pages));
if (!("Waterflow_WaterflowFrictionTest" == pages.name)) { if (!("WaterFlow_WaterFlowFrictionTest" == pages.name)) {
console.info("get Waterflow_WaterflowInitialIndex1 pages.name:" + JSON.stringify(pages.name)); console.info("get WaterFlow_WaterFlow pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options); let result = await router.push(options);
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
console.info("push Waterflow_WaterflowFrictionTest page result:" + JSON.stringify(result)); console.info("push WaterFlow_WaterFlowFrictionTest page result:" + JSON.stringify(result));
} }
} catch (err) { } catch (err) {
console.error("push Waterflow_WaterflowFrictionTest page error:" + err); console.error("push WaterFlow_WaterFlowFrictionTest page error:" + err);
} }
console.info("Waterflow_WaterflowFrictionTest beforeEach end"); console.info("WaterFlow_WaterFlowFrictionTest beforeEach end");
done(); done();
}); });
afterEach(async function () { afterEach(async function () {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
console.info("Waterflow_WaterflowFrictionTest after each called"); console.info("WaterFlow_WaterFlowFrictionTest after each called");
}); });
/** /**
* @tc.number SUB_ACE_WATERFLOW_WATERFLOWFRICTION_001 * @tc.number SUB_ACE_WATERFLOW_WATERFLOWFRICTION_001
* @tc.name testWaterflowFriction * @tc.name testWaterFlowFriction
* @tc.desc set friction to -1 * @tc.desc set friction to -1
*/ */
it('testWaterflowFriction', 0, async function (done) { it('testWaterFlowFriction', 0, async function (done) {
console.info('[testWaterflowFriction] START'); console.info('[testWaterFlowFriction] START');
globalThis.value.message.notify({name:'friction', value:-1}) globalThis.value.message.notify({name:'friction', value:-1})
let scrollContainerStrJson = getInspectorByKey('Waterflow_WaterflowFriction'); let scrollContainerStrJson = getInspectorByKey('WaterFlow_WaterFlowFriction');
let scrollContainerObj = JSON.parse(scrollContainerStrJson); let scrollContainerObj = JSON.parse(scrollContainerStrJson);
expect(scrollContainerObj.$type).assertEqual('Waterflow'); expect(scrollContainerObj.$type).assertEqual('WaterFlow');
expect(scrollContainerObj.$friction).assertEqual(0.6); expect(scrollContainerObj.$friction).assertEqual(0.6);
console.info('[testWaterflowFriction] END'); console.info('[testWaterFlowFriction] END');
done(); done();
}); });
/** /**
* @tc.number SUB_ACE_WATERFLOW_WATERFLOWFRICTION_002 * @tc.number SUB_ACE_WATERFLOW_WATERFLOWFRICTION_002
* @tc.name testWaterflowFriction * @tc.name testWaterFlowFriction
* @tc.desc set friction to 10 * @tc.desc set friction to 10
*/ */
it('testWaterflowFriction', 0, async function (done) { it('testWaterFlowFriction', 0, async function (done) {
console.info('[testWaterflowFriction] START'); console.info('[testWaterFlowFriction] START');
globalThis.value.message.notify({name:'friction', value:10}) globalThis.value.message.notify({name:'friction', value:10})
let scrollContainerStrJson = getInspectorByKey('Waterflow_WaterflowFriction'); let scrollContainerStrJson = getInspectorByKey('WaterFlow_WaterFlowFriction');
let scrollContainerObj = JSON.parse(scrollContainerStrJson); let scrollContainerObj = JSON.parse(scrollContainerStrJson);
expect(scrollContainerObj.$type).assertEqual('Waterflow'); expect(scrollContainerObj.$type).assertEqual('WaterFlow');
expect(scrollContainerObj.$friction).assertEqual(10); expect(scrollContainerObj.$friction).assertEqual(10);
console.info('[testWaterflowFriction] END'); console.info('[testWaterFlowFriction] END');
done(); done();
}); });
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册