Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
03e29671
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看板
提交
03e29671
编写于
6月 30, 2023
作者:
李
李鲲辉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加"滚动类组件支持配置fling效果的参数"XTS用例
Signed-off-by:
N
李鲲辉
<
likunhui@huawei.com
>
上级
9d79df53
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
728 addition
and
1 deletion
+728
-1
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Grid/Grid_attribute/GridFrictionPage.ets
...ainAbility/pages/Grid/Grid_attribute/GridFrictionPage.ets
+61
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/List/List_attribute/ListFrictionPage.ets
...ainAbility/pages/List/List_attribute/ListFrictionPage.ets
+53
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Scroll/Scroll_attribute/ScrollFrictionPage.ets
...lity/pages/Scroll/Scroll_attribute/ScrollFrictionPage.ets
+58
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets
...ges/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets
+117
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowFrictionPage.ets
...s/WaterFlow/WaterFlow_attribute/WaterFlowFrictionPage.ets
+102
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Grid/Grid_attribute/Grid_GridFriction.test.ets
...n/ets/test/Grid/Grid_attribute/Grid_GridFriction.test.ets
+81
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets
...ace_ets_layout_test/entry/src/main/ets/test/List.test.ets
+8
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/List/List_attribute/List_ListFriction.test.ets
...n/ets/test/List/List_attribute/List_ListFriction.test.ets
+81
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Scroll/Scroll_attribute/Scroll_ScrollFriction.test.ets
...st/Scroll/Scroll_attribute/Scroll_ScrollFriction.test.ets
+81
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/WaterFlow/WaterFlow_attribute/WaterFlow_WaterFlowFriction.test.ets
.../WaterFlow_attribute/WaterFlow_WaterFlowFriction.test.ets
+81
-0
arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+5
-1
未找到文件。
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Grid/Grid_attribute/GridFrictionPage.ets
0 → 100644
浏览文件 @
03e29671
import { MessageManager, Callback } from '../../../common/MessageManager';
@Entry
@Component
struct GridFrictionPage {
@State Number: String[] = ['0', '1', '2', '3', '4']
scroller: Scroller = new Scroller()
@State friction:number = 1000
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('Grid_lanes page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'friction') {
this.friction = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column({ space: 5 }) {
Grid(this.scroller) {
ForEach(this.Number, (day: string) => {
ForEach(this.Number, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
.backgroundColor(0xF9CF93)
.width('100%')
.height(80)
.textAlign(TextAlign.Center)
}
}, day => day)
}, day => day)
}
.columnsTemplate('1fr 1fr 1fr 1fr 1fr')
.columnsGap(10)
.rowsGap(10)
.edgeEffect(EdgeEffect.Spring)
.onScrollIndex((first: number) => {
console.info(first.toString())
})
.onScrollBarUpdate((index: number, offset: number) => {
return {totalOffset: (index / 5) * (80 + 10) - 10 + offset, totalLength: 80 * 5 + 10 * 4}
})
.width('90%')
.backgroundColor(0xFAEEE0)
.height(300)
.scrollBar(BarState.Off)
.onClick(() => { // 点击后滑到下一页
this.scroller.scrollPage({ next: true })
})
.friction(this.friction)
.key(Grid_GridFriction)
}.width('100%').margin({ top: 5 })
}
}
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/List/List_attribute/ListFrictionPage.ets
0 → 100644
浏览文件 @
03e29671
import { MessageManager, Callback } from '../../../common/MessageManager';
@Entry
@Component
struct ListFrictionPage {
private arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
@State friction:number = 1000
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('List_lanes page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'friction') {
this.friction = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%')
.height(100)
.fontSize(16)
.textAlign(TextAlign.Center)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
}
})
}
.listDirection(Axis.Vertical) // 排列方向
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // 每行之间的分界线
.edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.width('90%')
.friction(this.friction)
.key(List_ListFriction)
}
.width('100%')
.height('100%')
.backgroundColor(0xDCDCDC)
.padding({ top: 5 })
}
}
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Scroll/Scroll_attribute/ScrollFrictionPage.ets
0 → 100644
浏览文件 @
03e29671
import { MessageManager, Callback } from '../../../common/MessageManager';
@Entry
@Component
struct ScrollFrictionPage {
scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@State friction:number = 1000
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('Scroll_lanes page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'friction') {
this.friction = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
Column() {
ForEach(this.arr, (item) => {
Text(item.toString())
.width('90%')
.height(150)
.backgroundColor(0xFFFFFF)
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
}, item => item)
}.width('100%')
}
.scrollable(ScrollDirection.Vertical) // 滚动方向纵向
.scrollBar(BarState.On) // 滚动条常驻显示
.scrollBarColor(Color.Gray) // 滚动条颜色
.scrollBarWidth(10) // 滚动条宽度
.edgeEffect(EdgeEffect.None)
.onScroll((xOffset: number, yOffset: number) => {
console.info(xOffset + ' ' + yOffset)
})
.onScrollEdge((side: Edge) => {
console.info('To the edge')
})
.onScrollEnd(() => {
console.info('Scroll Stop')
})
.friction(this.friction)
.key(Scroll_ScrollFriction)
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets
0 → 100644
浏览文件 @
03e29671
// WaterFlowDataSource.ets
// 实现IDataSource接口的对象,用于瀑布流组件加载数据
export class WaterFlowDataSource implements IDataSource {
private dataArray: number[] = []
private listeners: DataChangeListener[] = []
constructor() {
for (let i = 0; i < 100; i++) {
this.dataArray.push(i)
}
}
// 获取索引对应的数据
public getData(index: number): any {
return this.dataArray[index]
}
// 通知控制器数据重新加载
notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded()
})
}
// 通知控制器数据增加
notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdded(index)
})
}
// 通知控制器数据变化
notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChanged(index)
})
}
// 通知控制器数据删除
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDeleted(index)
})
}
// 通知控制器数据位置变化
notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMoved(from, to)
})
}
// 获取数据总数
public totalCount(): number {
return this.dataArray.length
}
// 注册改变数据的控制器
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener)
}
}
// 注销改变数据的控制器
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
this.listeners.splice(pos, 1)
}
}
// 增加数据
public Add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray.length)
this.notifyDataAdd(0)
}
// 在数据尾部增加一个元素
public AddLastItem(): void {
this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length)
this.notifyDataAdd(this.dataArray.length-1)
}
// 在指定索引位置增加一个元素
public AddItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray.length)
this.notifyDataAdd(index)
}
// 删除第一个元素
public Delete1stItem(): void {
this.dataArray.splice(0, 1)
this.notifyDataDelete(0)
}
// 删除第二个元素
public Delete2ndItem(): void {
this.dataArray.splice(1, 1)
this.notifyDataDelete(1)
}
// 删除最后一个元素
public DeleteLastItem(): void {
this.dataArray.splice(-1, 1)
this.notifyDataDelete(this.dataArray.length)
}
// 重新加载数据
public Reload(): void {
this.dataArray.splice(1, 1)
this.dataArray.splice(3, 2)
this.notifyDataReload()
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowFrictionPage.ets
0 → 100644
浏览文件 @
03e29671
import { MessageManager, Callback } from '../../../common/MessageManager';
import { WaterFlowDataSource } from './WaterFlowDataSource';
@Entry
@Component
struct WaterFlowFrictionPage {
@State minSize: number = 50
@State maxSize: number = 100
@State fontSize: number = 24
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]
scroller: Scroller = new Scroller()
datasource: WaterFlowDataSource = new WaterFlowDataSource()
private itemWidthArray: number[] = []
private itemHeightArray: number[] = []
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('WaterFlow_lanes page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'friction') {
this.friction = message.value;
}
}
this.messageManager.registerCallback(callback);
}
// 计算flow item宽/高
getSize() {
let ret = Math.floor(Math.random() * this.maxSize)
return (ret > this.minSize ? ret : this.minSize)
}
// 保存flow item宽/高
getItemSizeArray() {
for (let i = 0; i < 100; i++) {
this.itemWidthArray.push(this.getSize())
this.itemHeightArray.push(this.getSize())
}
}
aboutToAppear() {
this.getItemSizeArray()
}
@Builder itemFoot() {
Column() {
Text(`Footer`)
.fontSize(10)
.backgroundColor(Color.Red)
.width(50)
.height(50)
.align(Alignment.Center)
.margin({ top: 2 })
}
}
build() {
Column({ space: 2 }) {
WaterFlow({ footer: this.itemFoot.bind(this), scroller: this.scroller }) {
LazyForEach(this.datasource, (item: number) => {
FlowItem() {
Column() {
Text("N" + item).fontSize(12).height('16')
Image('res/waterFlowTest(' + item % 5 + ').jpg')
.objectFit(ImageFit.Fill)
.width('100%')
.layoutWeight(1)
}
}
.width('100%')
.height(this.itemHeightArray[item])
.backgroundColor(this.colors[item % 5])
}, item => item)
}
.columnsTemplate("1fr 1fr 1fr 1fr")
.itemConstraintSize({
minWidth: 0,
maxWidth: '100%',
minHeight: 0,
maxHeight: '100%'
})
.columnsGap(10)
.rowsGap(5)
.onReachStart(() => {
console.info("onReachStart")
})
.onReachEnd(() => {
console.info("onReachEnd")
})
.backgroundColor(0xFAEEE0)
.width('100%')
.height('80%')
.layoutDirection(FlexDirection.Column)
.friction(this.friction)
.key(WaterFlow_WaterFlowFriction)
}
}
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Grid/Grid_attribute/Grid_GridFriction.test.ets
0 → 100644
浏览文件 @
03e29671
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import router from '@ohos.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function Grid_GridFrictionTest() {
describe('Grid_GridFrictionTest', function () {
beforeEach(async function (done) {
console.info("Grid_GridFrictionTest beforeEach start");
let options = {
url: 'MainAbility/pages/Grid/Grid_attribute/GridFrictionPage',
}
try {
router.clear();
let pages = router.getState();
console.info("get Grid_GridFrictionTest state pages:" + JSON.stringify(pages));
if (!("Grid_GridFrictionTest" == pages.name)) {
console.info("get Grid_GridInitialIndex1 pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Grid_GridFrictionTest page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Grid_GridFrictionTest page error:" + err);
}
console.info("Grid_GridFrictionTest beforeEach end");
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Grid_GridFrictionTest after each called");
});
/**
* @tc.number SUB_ACE_GRID_GRIDFRICTION_001
* @tc.name testGridFriction
* @tc.desc set friction to -1
*/
it('testGridFriction', 0, async function (done) {
console.info('[testGridFriction] START');
globalThis.value.message.notify({name:'friction', value:-1})
let listContainerStrJson = getInspectorByKey('Grid_GridFriction');
let listContainerObj = JSON.parse(listContainerStrJson);
expect(listContainerObj.$type).assertEqual('Grid');
expect(listContainerObj.$friction).assertEqual(0.6);
console.info('[testGridFriction] END');
done();
});
/**
* @tc.number SUB_ACE_GRID_GRIDFRICTION_002
* @tc.name testGridFriction
* @tc.desc set friction to 100
*/
it('testGridFriction', 0, async function (done) {
console.info('[testGridFriction] START');
globalThis.value.message.notify({name:'friction', value:10})
let listContainerStrJson = getInspectorByKey('Grid_GridFriction');
let listContainerObj = JSON.parse(listContainerStrJson);
expect(listContainerObj.$type).assertEqual('Grid');
expect(listContainerObj.$friction).assertEqual(10);
console.info('[testGridFriction] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets
浏览文件 @
03e29671
...
...
@@ -367,6 +367,10 @@ import Row_MarginPadding from './Row/parentComponentChanged/Row_MarginPadding.te
import Row_Padding from './Row/parentComponentChanged/Row_Padding.test';
import Row_Size from './Row/parentComponentChanged/Row_Size.test';
import Row_VerticalAlign from './Row/parentComponentChanged/Row_VerticalAlign.test';
import list_ListFrictionTest from './List/List_attribute/List_ListFriction.test';
import grid_GridFrictionTest from './List/List_attribute/Grid_GridFriction.test';
import waterflow_WaterFlowFrictionTest from './List/List_attribute/Waterflow_WaterFlowFriction.test';
import scroll_ScrollFrictionTest from './List/List_attribute/Scroll_ScrollFriction.test';
import AlignContentFlex_Start from './Flex/alignContent/Start/AlignContentFlex_Start.test.ets';
import AlignContent_FlexAlign_Start_Margin from './Flex/alignContent/Start/AlignContent_FlexAlign_Start_Margin.test.ets';
...
...
@@ -759,6 +763,10 @@ RelativeContainer_AnchorPoint_Position()
Row_Padding();
Row_Size();
Row_VerticalAlign();
list_ListFrictionTest();
grid_GridFrictionTest();
waterflow_WaterFlowFrictionTest();
scroll_ScrollFrictionTest();
AlignContentFlex_Start();
AlignContent_FlexAlign_Start_Margin();
AlignContent_FlexAlign_Start_Margin_padding();
...
...
arkui/ace_ets_layout_test/entry/src/main/ets/test/List/List_attribute/List_ListFriction.test.ets
0 → 100644
浏览文件 @
03e29671
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import router from '@ohos.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function list_ListFrictionTest() {
describe('List_ListFrictionTest', function () {
beforeEach(async function (done) {
console.info("List_ListFrictionTest beforeEach start");
let options = {
url: 'MainAbility/pages/List/List_attribute/ListFrictionPage',
}
try {
router.clear();
let pages = router.getState();
console.info("get List_ListFrictionTest state pages:" + JSON.stringify(pages));
if (!("list_ListFrictionTest" == pages.name)) {
console.info("get List_ListInitialIndex1 pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push List_ListFrictionTest page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push List_ListFrictionTest page error:" + err);
}
console.info("List_ListFrictionTest beforeEach end");
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("List_ListFrictionTest after each called");
});
/**
* @tc.number SUB_ACE_LIST_LISTFRICTION_001
* @tc.name testListFriction
* @tc.desc set friction to -1
*/
it('testListFriction', 0, async function (done) {
console.info('[testListFriction] START');
globalThis.value.message.notify({name:'friction', value:-1})
let listContainerStrJson = getInspectorByKey('List_ListFriction');
let listContainerObj = JSON.parse(listContainerStrJson);
expect(listContainerObj.$type).assertEqual('List');
expect(listContainerObj.$friction).assertEqual(0.6);
console.info('[testListFriction] END');
done();
});
/**
* @tc.number SUB_ACE_LIST_LISTFRICTION_002
* @tc.name testListFriction
* @tc.desc set friction to 100
*/
it('testListFriction', 0, async function (done) {
console.info('[testListFriction] START');
globalThis.value.message.notify({name:'friction', value:10})
let listContainerStrJson = getInspectorByKey('List_ListFriction');
let listContainerObj = JSON.parse(listContainerStrJson);
expect(listContainerObj.$type).assertEqual('List');
expect(listContainerObj.$friction).assertEqual(10);
console.info('[testListFriction] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Scroll/Scroll_attribute/Scroll_ScrollFriction.test.ets
0 → 100644
浏览文件 @
03e29671
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import router from '@ohos.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function Scroll_ScrollFrictionTest() {
describe('Scroll_ScrollFrictionTest', function () {
beforeEach(async function (done) {
console.info("Scroll_ScrollFrictionTest beforeEach start");
let options = {
url: 'MainAbility/pages/Scroll/Scroll_attribute/ScrollFrictionPage',
}
try {
router.clear();
let pages = router.getState();
console.info("get Scroll_ScrollFrictionTest state pages:" + JSON.stringify(pages));
if (!("Scroll_ScrollFrictionTest" == pages.name)) {
console.info("get Scroll_ScrollInitialIndex1 pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Scroll_ScrollFrictionTest page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Scroll_ScrollFrictionTest page error:" + err);
}
console.info("Scroll_ScrollFrictionTest beforeEach end");
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Scroll_ScrollFrictionTest after each called");
});
/**
* @tc.number SUB_ACE_SCROLL_SCROLLFRICTION_001
* @tc.name testScrollFriction
* @tc.desc set friction to -1
*/
it('testScrollFriction', 0, async function (done) {
console.info('[testScrollFriction] START');
globalThis.value.message.notify({name:'friction', value:-1})
let listContainerStrJson = getInspectorByKey('Scroll_ScrollFriction');
let listContainerObj = JSON.parse(listContainerStrJson);
expect(listContainerObj.$type).assertEqual('Scroll');
expect(listContainerObj.$friction).assertEqual(0.6);
console.info('[testScrollFriction] END');
done();
});
/**
* @tc.number SUB_ACE_SCROLL_SCROLLFRICTION_002
* @tc.name testScrollFriction
* @tc.desc set friction to 100
*/
it('testScrollFriction', 0, async function (done) {
console.info('[testScrollFriction] START');
globalThis.value.message.notify({name:'friction', value:10})
let listContainerStrJson = getInspectorByKey('Scroll_ScrollFriction');
let listContainerObj = JSON.parse(listContainerStrJson);
expect(listContainerObj.$type).assertEqual('Scroll');
expect(listContainerObj.$friction).assertEqual(10);
console.info('[testScrollFriction] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/WaterFlow/WaterFlow_attribute/WaterFlow_WaterFlowFriction.test.ets
0 → 100644
浏览文件 @
03e29671
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import router from '@ohos.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function Waterflow_WaterflowFrictionTest() {
describe('Waterflow_WaterflowFrictionTest', function () {
beforeEach(async function (done) {
console.info("Waterflow_WaterflowFrictionTest beforeEach start");
let options = {
url: 'MainAbility/pages/Waterflow/Waterflow_attribute/WaterflowFrictionPage',
}
try {
router.clear();
let pages = router.getState();
console.info("get Waterflow_WaterflowFrictionTest state pages:" + JSON.stringify(pages));
if (!("Waterflow_WaterflowFrictionTest" == pages.name)) {
console.info("get Waterflow_WaterflowInitialIndex1 pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Waterflow_WaterflowFrictionTest page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Waterflow_WaterflowFrictionTest page error:" + err);
}
console.info("Waterflow_WaterflowFrictionTest beforeEach end");
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Waterflow_WaterflowFrictionTest after each called");
});
/**
* @tc.number SUB_ACE_WATERFLOW_WATERFLOWFRICTION_001
* @tc.name testWaterflowFriction
* @tc.desc set friction to -1
*/
it('testWaterflowFriction', 0, async function (done) {
console.info('[testWaterflowFriction] START');
globalThis.value.message.notify({name:'friction', value:-1})
let listContainerStrJson = getInspectorByKey('Waterflow_WaterflowFriction');
let listContainerObj = JSON.parse(listContainerStrJson);
expect(listContainerObj.$type).assertEqual('Waterflow');
expect(listContainerObj.$friction).assertEqual(0.6);
console.info('[testWaterflowFriction] END');
done();
});
/**
* @tc.number SUB_ACE_WATERFLOW_WATERFLOWFRICTION_002
* @tc.name testWaterflowFriction
* @tc.desc set friction to 100
*/
it('testWaterflowFriction', 0, async function (done) {
console.info('[testWaterflowFriction] START');
globalThis.value.message.notify({name:'friction', value:10})
let listContainerStrJson = getInspectorByKey('Waterflow_WaterflowFriction');
let listContainerObj = JSON.parse(listContainerStrJson);
expect(listContainerObj.$type).assertEqual('Waterflow');
expect(listContainerObj.$friction).assertEqual(10);
console.info('[testWaterflowFriction] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
03e29671
...
...
@@ -249,6 +249,7 @@
"MainAbility/pages/Grid/GridTemplatesAllSet/GridItemChange/Grid_RowCol_ItemRowStartEnd"
,
"MainAbility/pages/Grid/GridTemplatesAllSet/GridItemChange/Grid_RowCol_ItemVisibility"
,
"MainAbility/pages/Grid/GridTemplatesAllSet/GridTemplateChange/Grid_RowCol_TemplateChange"
,
"MainAbility/pages/List/List_attribute/ListFrictionPage"
,
"MainAbility/pages/List/List_initialIndex/List_ListInitialIndex1"
,
"MainAbility/pages/List/List_initialIndex/List_ListInitialIndex2"
,
"MainAbility/pages/List/List_initialIndex/List_ListInitialIndex3"
,
...
...
@@ -397,6 +398,7 @@
"MainAbility/pages/Grid/Grid_Row/onBreakpointChange/onBreakpointChange"
,
"MainAbility/pages/Grid/Grid_Row/Grid_Row_Direction/Grid_Row_Direction_Row"
,
"MainAbility/pages/Grid/Grid_Row/Grid_Row_Direction/Grid_Row_Direction_RowReverse"
,
"MainAbility/pages/Grid/Grid_attribute/GridFrictionPage"
,
"MainAbility/pages/Tabs/tabs_index/Tabs_index"
,
"MainAbility/pages/Tabs/Tabs_ItemsChange/Tabs_itemPadMar"
,
"MainAbility/pages/Tabs/Tabs_ItemsChange/Tabs_itemSize"
,
...
...
@@ -405,6 +407,8 @@
"MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_barWidHei"
,
"MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_PadMar"
,
"MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_scrollable"
,
"MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_WidHei"
"MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_WidHei"
,
"MainAbility/pages/Scroll/Scroll_attribute/ScrollFrictionPage"
,
"MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowFrictionPage"
]
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录