提交 35fba99d 编写于 作者: E e 提交者: qianwangdq

添加list用例

Signed-off-by: Ne <qianwangdq@isoftstone.com>
上级 4c58eaf1
/**
* 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 { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct List_ListDirection{
@State addListDirection: number = Axis.Vertical;
messageManager:MessageManager = new MessageManager();
private content: string = "List_ListDirection Page";
onPageShow() {
console.info('List_ListDirection 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 == 'addListDirection') {
this.addListDirection = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('List_ListDirection page build done called');
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ListItem() {
Text('1')
.width('100%')
.height('100%')
.fontSize(16)
}
.width(300)
.height(100)
.key('List_ListDirection_011')
.editable(true)
.backgroundColor(0xF5DEB3)
ListItem() {
Text('2')
.width('100%')
.height('100%')
.fontSize(16)
}
.width(300)
.height(100)
.key('List_ListDirection_012')
.editable(true)
.backgroundColor(0xD2B48C)
ListItem() {
Text('3')
.width('100%')
.height('100%')
.fontSize(16)
}
.width(300)
.height(100)
.key('List_ListDirection_013')
.editable(true)
.backgroundColor(0xffa500)
ListItem() {
Text('4')
.width('100%')
.height('100%')
.fontSize(16)
}
.width(300)
.height(100)
.key('List_ListDirection_014')
.editable(true)
.backgroundColor(0xFFFFFF)
}
.height(520)
.width(350)
.key('List_ListDirection_01')
.backgroundColor(0xAFEEEE)
.listDirection(this.addListDirection)
.scrollBar(BarState.On)
}.width(350).height(520).backgroundColor(0xDCDCDC)
}
}
\ No newline at end of file
/**
* 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 { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct List_ListSize{
@State changeWidth: number = 350;
@State changeHeight: number = 500;
messageManager:MessageManager = new MessageManager();
private content: string = "List_ListSize Page";
onPageShow() {
console.info('List_ListSize 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 == 'changeWidth') {
this.changeWidth = message.value;
}
if (message.name == 'changeHeight') {
this.changeHeight = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('List_ListSize page build done called');
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ListItem() {
Text('1')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_ListSize_011').editable(true).backgroundColor(0xF5DEB3)
ListItem() {
Text('2')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_ListSize_012').editable(true).backgroundColor(0xD2B48C)
ListItem() {
Text('3')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_ListSize_013').editable(true).backgroundColor(0xffa500)
ListItem() {
Text('4')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_ListSize_014').editable(true).backgroundColor(0xFFFFFF)
}
.height(this.changeHeight)
.width(this.changeWidth)
.key('List_ListSize_01')
.backgroundColor(0xAFEEEE)
.scrollBar(BarState.On)
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
\ No newline at end of file
/**
* 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 { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct List_Margin{
@State addMargin: number = 10;
messageManager:MessageManager = new MessageManager();
private content: string = "List_Margin Page";
onPageShow() {
console.info('List_Margin 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 == 'addMargin') {
this.addMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('List_Margin page build done called');
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ListItem() {
Text('1')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_Margin_011').editable(true).backgroundColor(0xF5DEB3)
ListItem() {
Text('2')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_Margin_012').editable(true).backgroundColor(0xD2B48C)
ListItem() {
Text('3')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_Margin_013').editable(true).backgroundColor(0xffa500)
ListItem() {
Text('4')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_Margin_014').editable(true).backgroundColor(0xFFFFFF)
}
.height(520)
.width(350)
.key('List_Margin_01')
.backgroundColor(0xAFEEEE)
.margin(this.addMargin)
.scrollBar(BarState.On)
}.height(540).width(370).backgroundColor(0xDCDCDC)
.key('List_Margin_01_B0x')
}
}
\ No newline at end of file
/**
* 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 { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct List_PadMar{
@State addPadding: number = 10;
@State addMargin: number = 5;
messageManager:MessageManager = new MessageManager();
private content: string = "List_PadMar Page";
onPageShow() {
console.info('List_PadMar 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 == 'addPadding') {
this.addPadding = message.value;
}
if (message.name == 'addMargin') {
this.addMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('List_PadMar page build done called');
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ListItem() {
Text('1')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_PadMar_011').editable(true).backgroundColor(0xF5DEB3)
ListItem() {
Text('2')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_PadMar_012').editable(true).backgroundColor(0xD2B48C)
ListItem() {
Text('3')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_PadMar_013').editable(true).backgroundColor(0xffa500)
ListItem() {
Text('4')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_PadMar_014').editable(true).backgroundColor(0xFFFFFF)
}
.height(520)
.width(350)
.key('List_PadMar_01')
.backgroundColor(0xAFEEEE)
.padding(this.addPadding)
.margin(this.addMargin)
.scrollBar(BarState.On)
}.height(530).width(360).backgroundColor(0xDCDCDC)
.key('List_PadMar_01_Box')
}
}
\ No newline at end of file
/**
* 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 { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct List_Padding{
@State addPadding: number = 20;
messageManager:MessageManager = new MessageManager();
private content: string = "List_Padding Page";
onPageShow() {
console.info('List_Padding 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 == 'addPadding') {
this.addPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('List_Padding page build done called');
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ListItem() {
Text('1')
.width('100%')
.height('100%')
.fontSize(16)
}
.width(300)
.height(100)
.key('List_Padding_011')
.editable(true)
.backgroundColor(0xF5DEB3)
ListItem() {
Text('2')
.width('100%')
.height('100%')
.fontSize(16)
}
.width(300)
.height(100)
.key('List_Padding_012')
.editable(true)
.backgroundColor(0xD2B48C)
ListItem() {
Text('3')
.width('100%')
.height('100%')
.fontSize(16)
}
.width(300)
.height(100)
.key('List_Padding_013')
.editable(true)
.backgroundColor(0xffa500)
ListItem() {
Text('4')
.width('100%')
.height('100%')
.fontSize(16)
}
.width(300)
.height(100)
.key('List_Padding_014')
.editable(true)
.backgroundColor(0xFFFFFF)
}
.height(500)
.width(350)
.key('List_Padding_01')
.backgroundColor(0xAFEEEE)
.padding(this.addPadding)
.scrollBar(BarState.On)
}.width('100%').height('100%')
}
}
\ No newline at end of file
/**
* 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 { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct List_alignListItem{
@State addAlignListItem: number = ListItemAlign.Start;
messageManager:MessageManager = new MessageManager();
private content: string = "List_alignListItem Page"
onPageShow() {
console.info('List_alignListItem 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 == 'addAlignListItem') {
this.addAlignListItem = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('List_alignListItem page build done called');
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ListItem() {
Text('1')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_alignListItem_011').editable(true).backgroundColor(0xF5DEB3)
ListItem() {
Text('2')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_alignListItem_012').editable(true).backgroundColor(0xD2B48C)
ListItem() {
Text('3')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_alignListItem_013').editable(true).backgroundColor(0xffa500)
ListItem() {
Text('4')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_alignListItem_014').editable(true).backgroundColor(0xFFFFFF)
}
.height(520)
.width(350)
.key('List_alignListItem_01')
.backgroundColor(0xAFEEEE)
.alignListItem(this.addAlignListItem)
.scrollBar(BarState.On)
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
\ No newline at end of file
/**
* 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 { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct List_divider{
@State addDividerWidth: number = 10;
messageManager:MessageManager = new MessageManager();
private content: string = "List_divider Page";
onPageShow() {
console.info('List_divider 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 == 'strokeWidth') {
this.addDividerWidth = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('List_divider page build done called');
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ListItem() {
Text('1')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_divider_011').editable(true).backgroundColor(0xF5DEB3)
ListItem() {
Text('2')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_divider_012').editable(true).backgroundColor(0xD2B48C)
ListItem() {
Text('3')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_divider_013').editable(true).backgroundColor(0xffa500)
ListItem() {
Text('4')
.width('100%')
.height('100%')
.fontSize(16)
}.width(300).height(100).key('List_divider_014').editable(true).backgroundColor(0xFFFFFF)
}
.height(500)
.width(350)
.key('List_divider_01')
.backgroundColor(0xAFEEEE)
.editMode(true)
.divider({ strokeWidth: this.addDividerWidth, color: 0x000000, startMargin: 20, endMargin: 20 })
.scrollBar(BarState.On)
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
\ No newline at end of file
/**
* 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 { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct List_lanes{
@State addLanes: number = 1;
messageManager:MessageManager = new MessageManager();
private content: string = "List_lanes Page"
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 == 'addLanes') {
this.addLanes = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('List_lanes page build done called');
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ListItem() {
Text('1')
.width('100%')
.height('100%')
.fontSize(16)
}.width(100).height(100).key('List_lanes_011').editable(true).backgroundColor(0xF5DEB3)
ListItem() {
Text('2')
.width('100%')
.height('100%')
.fontSize(16)
}.width(100).height(100).key('List_lanes_012').editable(true).backgroundColor(0xD2B48C)
ListItem() {
Text('3')
.width('100%')
.height('100%')
.fontSize(16)
}.width(100).height(100).key('List_lanes_013').editable(true).backgroundColor(0xffa500)
ListItem() {
Text('4')
.width('100%')
.height('100%')
.fontSize(16)
}.width(100).height(100).key('List_lanes_014').editable(true).backgroundColor(0xFFFFFF)
}
.height(520)
.width(350)
.key('List_lanes_01')
.backgroundColor(0xAFEEEE)
.lanes(this.addLanes)
.scrollBar(BarState.On)
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
\ No newline at end of file
/*
* 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 '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function List_ListDirection() {
describe('List_ListDirection', function () {
beforeEach(async function (done) {
console.info("List_ListDirection beforeEach start");
let options = {
uri: 'MainAbility/pages/List/List_Space/ListChange/List_ListDirection',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get List_ListDirection state pages:" + JSON.stringify(pages));
if (!("List_ListDirection" == pages.name)) {
console.info("get List_ListDirection state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push List_ListDirection page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push List_ListDirection page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
console.info("List_ListDirection beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("List_ListDirection after each called");
});
/**
* @tc.number SUB_ACE_LIST_LIDTDIRECTION_TEST_0100
* @tc.name testListListDirectionAxisVertical
* @tc.desc List parent component binding direction property and value set to Axis.Vertical
*/
it('testListListDirectionAxisVertical', 0, async function (done) {
console.info('testListListDirectionAxisVertical START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_ListDirection_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_ListDirection_011 = CommonFunc.getComponentRect('List_ListDirection_011');
let List_ListDirection_012 = CommonFunc.getComponentRect('List_ListDirection_012');
let List_ListDirection_013 = CommonFunc.getComponentRect('List_ListDirection_013');
let List_ListDirection_014 = CommonFunc.getComponentRect('List_ListDirection_014');
let List_ListDirection_01 = CommonFunc.getComponentRect('List_ListDirection_01');
expect(List_ListDirection_011.left).assertEqual(List_ListDirection_01.left);
expect(List_ListDirection_012.left).assertEqual(List_ListDirection_01.left);
expect(List_ListDirection_013.left).assertEqual(List_ListDirection_01.left);
expect(List_ListDirection_014.left).assertEqual(List_ListDirection_01.left);
expect(List_ListDirection_011.top).assertEqual(List_ListDirection_01.top);
expect(Math.round(List_ListDirection_012.top - List_ListDirection_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_ListDirection_013.top - List_ListDirection_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_ListDirection_014.top - List_ListDirection_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_ListDirection_01.bottom - List_ListDirection_014.bottom)).assertEqual(vp2px(60));
expect(Math.round(List_ListDirection_011.right - List_ListDirection_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListDirection_012.right - List_ListDirection_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListDirection_013.right - List_ListDirection_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListDirection_014.right - List_ListDirection_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListDirection_011.bottom - List_ListDirection_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListDirection_012.bottom - List_ListDirection_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListDirection_013.bottom - List_ListDirection_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListDirection_014.bottom - List_ListDirection_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(
Math.round(List_ListDirection_013.left + ((List_ListDirection_013.right - List_ListDirection_013.left) / 2)),
Math.round(List_ListDirection_013.bottom),
Math.round(List_ListDirection_012.left + ((List_ListDirection_012.right - List_ListDirection_012.left) / 2)),
Math.round(List_ListDirection_012.bottom));
await CommonFunc.sleep(1000);
let List_ListDirection_024 = CommonFunc.getComponentRect('List_ListDirection_014');
expect(List_ListDirection_01.bottom - List_ListDirection_024.bottom).assertEqual(vp2px(60));
console.info('testListListDirectionAxisVertical END');
done();
});
/**
* @tc.number SUB_ACE_LIST_LIDTDIRECTION_TEST_0200
* @tc.name testListListDirectionAxisHorizontal
* @tc.desc List parent component binding direction property and value set to Axis.Horizontal
*/
it('testListListDirectionAxisHorizontal', 0, async function (done) {
console.info('testListListDirectionAxisHorizontal START');
globalThis.value.message.notify({name:'addListDirection', value:Axis.Horizontal})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('List_ListDirection_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_ListDirection_011 = CommonFunc.getComponentRect('List_ListDirection_011');
let List_ListDirection_012 = CommonFunc.getComponentRect('List_ListDirection_012');
let driver = await UiDriver.create();
await driver.swipe(List_ListDirection_012.left,100, List_ListDirection_011.left,100);
await CommonFunc.sleep(2000);
let List_ListDirection_022 = CommonFunc.getComponentRect('List_ListDirection_012');
let List_ListDirection_023 = CommonFunc.getComponentRect('List_ListDirection_013');
await driver.swipe(List_ListDirection_012.left,100, List_ListDirection_011.left,100);
await CommonFunc.sleep(2000);
let List_ListDirection_013 = CommonFunc.getComponentRect('List_ListDirection_013');
let List_ListDirection_014 = CommonFunc.getComponentRect('List_ListDirection_014');
let List_ListDirection_01 = CommonFunc.getComponentRect('List_ListDirection_01');
expect(List_ListDirection_011.top).assertEqual(List_ListDirection_01.top);
expect(List_ListDirection_012.top).assertEqual(List_ListDirection_01.top);
expect(List_ListDirection_013.top).assertEqual(List_ListDirection_01.top);
expect(List_ListDirection_014.top).assertEqual(List_ListDirection_01.top);
expect(List_ListDirection_011.left).assertEqual(List_ListDirection_01.left);
expect(Math.round(List_ListDirection_012.left - List_ListDirection_011.right)).assertEqual(vp2px(20));
expect(Math.round(List_ListDirection_023.left - List_ListDirection_022.right)).assertEqual(vp2px(20));
expect(Math.round(List_ListDirection_014.left - List_ListDirection_013.right)).assertEqual(vp2px(20));
expect(Math.round(List_ListDirection_011.right - List_ListDirection_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListDirection_012.right - List_ListDirection_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListDirection_013.right - List_ListDirection_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListDirection_014.right - List_ListDirection_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListDirection_011.bottom - List_ListDirection_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListDirection_012.bottom - List_ListDirection_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListDirection_013.bottom - List_ListDirection_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListDirection_014.bottom - List_ListDirection_014.top)).assertEqual(vp2px(100));
console.info('testListListDirectionAxisHorizontal END');
done();
});
});
}
\ No newline at end of file
/*
* 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 '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function List_ListSize() {
describe('List_ListSizeTest', function () {
beforeEach(async function (done) {
console.info("List_ListSizeTest beforeEach start");
let options = {
uri: 'MainAbility/pages/List/List_Space/ListChange/List_ListSize',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get List_ListSize state pages:" + JSON.stringify(pages));
if (!("List_ListSize" == pages.name)) {
console.info("get List_ListSize state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push List_ListSize page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push List_ListSize page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
console.info("List_ListSizeTest beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("List_ListSizeTest after each called");
});
/**
* @tc.number SUB_ACE_LIST_LISTSIZE_TEST_0100
* @tc.name testListListSizeMeet
* @tc.desc The List parent component sets the width and height to meet the layout of the child component
*/
it('testListListSizeMeet', 0, async function (done) {
console.info('testListListSizeMeet START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_ListSize_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_ListSize_011 = CommonFunc.getComponentRect('List_ListSize_011');
let List_ListSize_012 = CommonFunc.getComponentRect('List_ListSize_012');
let List_ListSize_013 = CommonFunc.getComponentRect('List_ListSize_013');
let List_ListSize_014 = CommonFunc.getComponentRect('List_ListSize_014');
let List_ListSize_01 = CommonFunc.getComponentRect('List_ListSize_01');
expect(List_ListSize_011.left).assertEqual(List_ListSize_01.left);
expect(List_ListSize_012.left).assertEqual(List_ListSize_01.left);
expect(List_ListSize_013.left).assertEqual(List_ListSize_01.left);
expect(List_ListSize_014.left).assertEqual(List_ListSize_01.left);
expect(List_ListSize_011.top).assertEqual(List_ListSize_01.top);
expect(Math.round(List_ListSize_012.top - List_ListSize_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_ListSize_013.top - List_ListSize_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_ListSize_014.top - List_ListSize_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_ListSize_01.bottom - List_ListSize_014.bottom)).assertEqual(vp2px(40));
expect(Math.round(List_ListSize_011.right - List_ListSize_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListSize_012.right - List_ListSize_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListSize_013.right - List_ListSize_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListSize_014.right - List_ListSize_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_ListSize_011.bottom - List_ListSize_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListSize_012.bottom - List_ListSize_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListSize_013.bottom - List_ListSize_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListSize_014.bottom - List_ListSize_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(
Math.round(List_ListSize_013.left + ((List_ListSize_013.right - List_ListSize_013.left) / 2)),
Math.round(List_ListSize_013.bottom),
Math.round(List_ListSize_012.left + ((List_ListSize_012.right - List_ListSize_012.left) / 2)),
Math.round(List_ListSize_012.bottom));
await CommonFunc.sleep(1000);
let List_ListSize_024 = CommonFunc.getComponentRect('List_ListSize_014');
expect(List_ListSize_01.bottom - List_ListSize_024.bottom).assertEqual(vp2px(40));
console.info('testListListSizeMeet END');
done();
});
/**
* @tc.number SUB_ACE_LIST_LIST_LISTSIZE_TEST_0200
* @tc.name testListListSizeOverflow
* @tc.desc The List parent component sets the width and height to not meet the layout of the child component
*/
it('testListListSizeOverflow', 0, async function (done) {
console.info('testListListSizeOverflow START');
globalThis.value.message.notify({name:'changeWidth', value:280})
globalThis.value.message.notify({name:'changeHeight', value:400})
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_ListSize_01');
let obj = JSON.parse(strJson);
await CommonFunc.sleep(1000);
expect(obj.$type).assertEqual('List');
let List_ListSize_011 = CommonFunc.getComponentRect('List_ListSize_011');
let List_ListSize_012 = CommonFunc.getComponentRect('List_ListSize_012');
let List_ListSize_013 = CommonFunc.getComponentRect('List_ListSize_013');
let List_ListSize_014 = CommonFunc.getComponentRect('List_ListSize_014');
let List_ListSize_01 = CommonFunc.getComponentRect('List_ListSize_01');
expect(List_ListSize_011.left).assertEqual(List_ListSize_01.left);
expect(List_ListSize_012.left).assertEqual(List_ListSize_01.left);
expect(List_ListSize_013.left).assertEqual(List_ListSize_01.left);
expect(List_ListSize_014.left).assertEqual(List_ListSize_01.left);
expect(List_ListSize_011.top).assertEqual(List_ListSize_01.top);
expect(Math.round(List_ListSize_012.top - List_ListSize_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_ListSize_013.top - List_ListSize_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_ListSize_014.top - List_ListSize_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_ListSize_014.bottom - List_ListSize_01.bottom)).assertEqual(vp2px(60))
expect(Math.round(List_ListSize_011.right - List_ListSize_011.left)).assertEqual(vp2px(280));
expect(Math.round(List_ListSize_012.right - List_ListSize_012.left)).assertEqual(vp2px(280));
expect(Math.round(List_ListSize_013.right - List_ListSize_013.left)).assertEqual(vp2px(280));
expect(Math.round(List_ListSize_014.right - List_ListSize_014.left)).assertEqual(vp2px(280));
expect(Math.round(List_ListSize_011.bottom - List_ListSize_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListSize_012.bottom - List_ListSize_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListSize_013.bottom - List_ListSize_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_ListSize_014.bottom - List_ListSize_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(
Math.round(List_ListSize_013.left + ((List_ListSize_013.right - List_ListSize_013.left) / 2)),
Math.round(List_ListSize_013.bottom),
Math.round(List_ListSize_012.left + ((List_ListSize_012.right - List_ListSize_012.left) / 2)),
Math.round(List_ListSize_012.bottom));
await CommonFunc.sleep(1000);
let List_ListSize_024 = CommonFunc.getComponentRect('List_ListSize_014');
expect(List_ListSize_024.bottom).assertEqual(List_ListSize_01.bottom);
console.info('testListListSizeOverflow END');
done();
});
})
}
\ No newline at end of file
/*
* 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 '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function List_Margin() {
describe('List_Margin', function () {
beforeEach(async function (done) {
console.info("text beforeEach start");
let options = {
uri: 'MainAbility/pages/List/List_Space/ListChange/List_Margin',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get List_Margin state pages:" + JSON.stringify(pages));
if (!("List_Margin" == pages.name)) {
console.info("get List_Margin state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push List_Margin page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push List_Margin page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("List_Margin after each called");
});
/**
* @tc.number SUB_ACE_LIST_List_Margin_TEST_0100
* @tc.name testListMargin
* @tc.desc List parent component binding margin property
*/
it('testListMargin', 0, async function (done) {
console.info('testListMargin START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_Margin_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_Margin_011 = CommonFunc.getComponentRect('List_Margin_011');
let List_Margin_012 = CommonFunc.getComponentRect('List_Margin_012');
let List_Margin_013 = CommonFunc.getComponentRect('List_Margin_013');
let List_Margin_014 = CommonFunc.getComponentRect('List_Margin_014');
let List_Margin_01 = CommonFunc.getComponentRect('List_Margin_01');
let List_Margin_01_B0x = CommonFunc.getComponentRect('List_Margin_01_B0x');
expect(List_Margin_011.left).assertEqual(List_Margin_01.left);
expect(List_Margin_012.left).assertEqual(List_Margin_01.left);
expect(List_Margin_013.left).assertEqual(List_Margin_01.left);
expect(List_Margin_014.left).assertEqual(List_Margin_01.left);
expect(List_Margin_011.top).assertEqual(List_Margin_01.top);
expect(Math.round(List_Margin_012.top - List_Margin_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_Margin_013.top - List_Margin_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_Margin_014.top - List_Margin_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_Margin_01.top - List_Margin_01_B0x.top)).assertEqual(vp2px(10));
expect(Math.round(List_Margin_01.left - List_Margin_01_B0x.left)).assertEqual(vp2px(10));
expect(Math.round(List_Margin_011.right - List_Margin_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_Margin_012.right - List_Margin_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_Margin_013.right - List_Margin_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_Margin_014.right - List_Margin_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_Margin_011.bottom - List_Margin_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_Margin_012.bottom - List_Margin_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_Margin_013.bottom - List_Margin_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_Margin_014.bottom - List_Margin_014.top)).assertEqual(vp2px(100));
expect(Math.round(List_Margin_01.bottom - List_Margin_01.top)).assertEqual(vp2px(520));
expect(Math.round(List_Margin_01.right - List_Margin_01.left)).assertEqual(vp2px(350));
let driver = await Driver.create();
await driver.swipe(360, 690, 360, 30);
let List_Margin_014Again = CommonFunc.getComponentRect('List_Margin_014');
expect(List_Margin_014.top).assertEqual(List_Margin_014Again.top);
console.info('testListMargin END');
done();
});
})
}
\ No newline at end of file
/*
* 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 '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function List_PadMar() {
describe('List_PadMar', function () {
beforeEach(async function (done) {
console.info("List_PadMar beforeEach start");
let options = {
uri: 'MainAbility/pages/List/List_Space/ListChange/List_PadMar',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get List_PadMar state pages:" + JSON.stringify(pages));
if (!("List_PadMar" == pages.name)) {
console.info("get List_PadMar state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push List_PadMar page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push List_PadMar page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
console.info("List_PadMar beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("List_PadMar after each called");
});
/**
* @tc.number SUB_ACE_LIST_List_PadMar_TEST_0100
* @tc.name testListPadMar
* @tc.desc List parent component binding padding and margin property and padding set to 10,margin set to 5
*/
it('testListPadMar', 0, async function (done) {
console.info('testListPadMar START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_PadMar_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_PadMar_011 = CommonFunc.getComponentRect('List_PadMar_011');
let List_PadMar_012 = CommonFunc.getComponentRect('List_PadMar_012');
let List_PadMar_013 = CommonFunc.getComponentRect('List_PadMar_013');
let List_PadMar_014 = CommonFunc.getComponentRect('List_PadMar_014');
let List_PadMar_01 = CommonFunc.getComponentRect('List_PadMar_01');
let List_PadMar_01_Box = CommonFunc.getComponentRect('List_PadMar_01_Box');
expect(Math.round(List_PadMar_011.left - List_PadMar_01.left)).assertEqual(vp2px(10));
expect(Math.round(List_PadMar_012.left - List_PadMar_01.left)).assertEqual(vp2px(10));
expect(Math.round(List_PadMar_013.left - List_PadMar_01.left)).assertEqual(vp2px(10));
expect(Math.round(List_PadMar_014.left - List_PadMar_01.left)).assertEqual(vp2px(10));
expect(Math.round(List_PadMar_011.top - List_PadMar_01.top)).assertEqual(vp2px(10));
expect(Math.round(List_PadMar_012.top - List_PadMar_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_PadMar_013.top - List_PadMar_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_PadMar_014.top - List_PadMar_013.bottom)).assertEqual(vp2px(20));
expect(Math.round((List_PadMar_01.top - List_PadMar_01_Box.top)*10)/10).assertEqual(Math.round(vp2px(5)*10)/10);
expect(Math.round((List_PadMar_01.left - List_PadMar_01_Box.left)*10)/10).assertEqual(Math.round(vp2px(5)*10)/10);
expect(Math.round(List_PadMar_011.right - List_PadMar_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_PadMar_012.right - List_PadMar_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_PadMar_013.right - List_PadMar_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_PadMar_014.right - List_PadMar_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_PadMar_011.bottom - List_PadMar_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_PadMar_012.bottom - List_PadMar_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_PadMar_013.bottom - List_PadMar_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_PadMar_014.bottom - List_PadMar_014.top)).assertEqual(vp2px(100));
expect(Math.round(List_PadMar_01.bottom - List_PadMar_01.top)).assertEqual(vp2px(520));
expect(Math.round(List_PadMar_01.right - List_PadMar_01.left)).assertEqual(vp2px(350));
let driver = await Driver.create();
await driver.swipe(360, 690, 360, 30);
let List_PadMar_014Again = CommonFunc.getComponentRect('List_PadMar_014');
expect(List_PadMar_014.top).assertEqual(List_PadMar_014Again.top);
console.info('testListPadMar END');
done();
});
})
}
\ No newline at end of file
/*
* 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 '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function List_Padding() {
describe('List_Padding', function () {
beforeEach(async function (done) {
console.info("List_Padding beforeEach start");
let options = {
uri: 'MainAbility/pages/List/List_Space/ListChange/List_Padding',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get List_Padding state pages:" + JSON.stringify(pages));
if (!("List_Padding" == pages.name)) {
console.info("get List_Padding state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push List_Padding page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push List_Padding page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
console.info("List_Padding beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("List_Padding after each called");
});
/**
* @tc.number SUB_ACE_LIST_LIST_PADDING_TEST_0100
* @tc.name testListPaddingToTwenty
* @tc.desc List parent component binding padding property and value set to 20
*/
it('testListPaddingToTwenty', 0, async function (done) {
console.info('testListPaddingToTwenty START');
globalThis.value.message.notify({name:'addPadding', value:20})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('List_Padding_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_Padding_011 = CommonFunc.getComponentRect('List_Padding_011');
let List_Padding_012 = CommonFunc.getComponentRect('List_Padding_012');
let List_Padding_013 = CommonFunc.getComponentRect('List_Padding_013');
let List_Padding_014 = CommonFunc.getComponentRect('List_Padding_014');
let List_Padding_01 = CommonFunc.getComponentRect('List_Padding_01');
expect(Math.round(List_Padding_011.right - List_Padding_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_Padding_012.right - List_Padding_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_Padding_013.right - List_Padding_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_Padding_014.right - List_Padding_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_Padding_011.bottom - List_Padding_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_Padding_012.bottom - List_Padding_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_Padding_013.bottom - List_Padding_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_Padding_014.bottom - List_Padding_014.top)).assertEqual(vp2px(100));
expect(Math.round(List_Padding_011.left - List_Padding_01.left)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_012.left - List_Padding_01.left)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_013.left - List_Padding_01.left)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_014.left - List_Padding_01.left)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_011.top - List_Padding_01.top)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_01.bottom - List_Padding_014.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_01.right - List_Padding_011.right)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_01.right - List_Padding_012.right)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_01.right - List_Padding_013.right)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_01.right - List_Padding_014.right)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_012.top - List_Padding_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_013.top - List_Padding_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_014.top - List_Padding_013.bottom)).assertEqual(vp2px(20));
let driver = await Driver.create();
await driver.swipe(360, 690, 360, 30);
let List_Padding_014Again = CommonFunc.getComponentRect('List_Padding_014');
expect(List_Padding_014.top).assertEqual(List_Padding_014Again.top);
console.info('testListPaddingToTwenty END');
done();
});
/**
* @tc.number SUB_ACE_LIST_LIST_PADDING_TEST_0200
* @tc.name testListPaddingToThirty
* @tc.desc List parent component binding padding property and value set to 30
*/
it('testListPaddingToThirty', 0, async function (done) {
console.info('testListPaddingToThirty START');
globalThis.value.message.notify({name:'addPadding', value:30})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('List_Padding_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_Padding_011 = CommonFunc.getComponentRect('List_Padding_011');
let List_Padding_012 = CommonFunc.getComponentRect('List_Padding_012');
let List_Padding_013 = CommonFunc.getComponentRect('List_Padding_013');
let List_Padding_014 = CommonFunc.getComponentRect('List_Padding_014');
let List_Padding_01 = CommonFunc.getComponentRect('List_Padding_01');
expect(Math.round(List_Padding_011.left - List_Padding_01.left)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_012.left - List_Padding_01.left)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_013.left - List_Padding_01.left)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_014.left - List_Padding_01.left)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_011.top - List_Padding_01.top)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_01.bottom - List_Padding_014.bottom)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_01.right - List_Padding_011.right)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_01.right - List_Padding_012.right)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_01.right - List_Padding_013.right)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_01.right - List_Padding_014.right)).assertEqual(vp2px(30));
expect(Math.round(List_Padding_012.top - List_Padding_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_013.top - List_Padding_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_014.top - List_Padding_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_Padding_011.right - List_Padding_011.left)).assertEqual(vp2px(290));
expect(Math.round(List_Padding_012.right - List_Padding_012.left)).assertEqual(vp2px(290));
expect(Math.round(List_Padding_013.right - List_Padding_013.left)).assertEqual(vp2px(290));
expect(Math.round(List_Padding_014.right - List_Padding_014.left)).assertEqual(vp2px(290));
expect(Math.round(List_Padding_011.bottom - List_Padding_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_Padding_012.bottom - List_Padding_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_Padding_013.bottom - List_Padding_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_Padding_014.bottom - List_Padding_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(360, Math.round(List_Padding_014.top), 360, Math.round(List_Padding_013.top));
await CommonFunc.sleep(3000);
let List_Padding_014Again = CommonFunc.getComponentRect('List_Padding_014');
expect(List_Padding_01.top - List_Padding_014Again.top).assertFalse(vp2px(30));
console.info('testListPaddingToThirty END');
done();
});
})
}
\ No newline at end of file
/*
* 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 '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager,Callback } from '../../../../MainAbility/common/MessageManager';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function List_alignListItem() {
describe('List_alignListItem', function () {
beforeEach(async function (done) {
console.info("List_alignListItem beforeEach start");
let options = {
uri: 'MainAbility/pages/List/List_Space/ListChange/List_alignListItem',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get List_alignListItem state pages:" + JSON.stringify(pages));
if (!("List_alignListItem" == pages.name)) {
console.info("get List_alignListItem state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push List_alignListItem page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push List_alignListItem page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
console.info("List_alignListItem beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("List_alignListItem after each called");
});
/**
* @tc.number SUB_ACE_LIST_ALIGNLISTITEM_TEST_0100
* @tc.name testListAlignListItemStart
* @tc.desc The List parent component binds the alignListItem property ListItemAlign.Start
*/
it('testListAlignListItemStart', 0, async function (done) {
console.info('testListAlignListItemStart START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_alignListItem_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_alignListItem_011 = CommonFunc.getComponentRect('List_alignListItem_011');
let List_alignListItem_012 = CommonFunc.getComponentRect('List_alignListItem_012');
let List_alignListItem_013 = CommonFunc.getComponentRect('List_alignListItem_013');
let List_alignListItem_014 = CommonFunc.getComponentRect('List_alignListItem_014');
let List_alignListItem_01 = CommonFunc.getComponentRect('List_alignListItem_01');
expect(List_alignListItem_011.left).assertEqual(List_alignListItem_01.left);
expect(List_alignListItem_012.left).assertEqual(List_alignListItem_01.left);
expect(List_alignListItem_013.left).assertEqual(List_alignListItem_01.left);
expect(List_alignListItem_014.left).assertEqual(List_alignListItem_01.left);
expect(List_alignListItem_011.top).assertEqual(List_alignListItem_01.top);
expect(Math.round(List_alignListItem_012.top - List_alignListItem_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_alignListItem_013.top - List_alignListItem_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_alignListItem_014.top - List_alignListItem_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_alignListItem_01.bottom - List_alignListItem_014.bottom)).assertEqual(vp2px(60));
expect(Math.round(List_alignListItem_011.right - List_alignListItem_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_012.right - List_alignListItem_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_013.right - List_alignListItem_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_014.right - List_alignListItem_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_011.bottom - List_alignListItem_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_alignListItem_012.bottom - List_alignListItem_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_alignListItem_013.bottom - List_alignListItem_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_alignListItem_014.bottom - List_alignListItem_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(
Math.round(List_alignListItem_013.left + ((List_alignListItem_013.right - List_alignListItem_013.left) / 2)),
Math.round(List_alignListItem_013.bottom),
Math.round(List_alignListItem_012.left + ((List_alignListItem_012.right - List_alignListItem_012.left) / 2)),
Math.round(List_alignListItem_012.bottom));
await CommonFunc.sleep(1000);
let List_alignListItem_024 = CommonFunc.getComponentRect('List_alignListItem_014');
expect(List_alignListItem_01.bottom - List_alignListItem_024.bottom).assertEqual(vp2px(60));
console.info('testListAlignListItemStart END');
done();
});
/**
* @tc.number SUB_ACE_LIST_ALIGNLISTITEM_TEST_0200
* @tc.name testListAlignListItemCenter
* @tc.desc The List parent component binds the alignListItem property ListItemAlign.Center
*/
it('testListAlignListItemCenter', 0, async function (done) {
console.info('testListAlignListItemCenter START');
globalThis.value.message.notify({name:'addAlignListItem', value:ListItemAlign.Center})
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_alignListItem_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_alignListItem_011 = CommonFunc.getComponentRect('List_alignListItem_011');
let List_alignListItem_012 = CommonFunc.getComponentRect('List_alignListItem_012');
let List_alignListItem_013 = CommonFunc.getComponentRect('List_alignListItem_013');
let List_alignListItem_014 = CommonFunc.getComponentRect('List_alignListItem_014');
let List_alignListItem_01 = CommonFunc.getComponentRect('List_alignListItem_01');
expect(Math.round(List_alignListItem_011.left - List_alignListItem_01.left))
.assertEqual(Math.round(List_alignListItem_01.right - List_alignListItem_011.right));
expect(Math.round(List_alignListItem_012.left - List_alignListItem_01.left))
.assertEqual(Math.round(List_alignListItem_01.right - List_alignListItem_012.right));
expect(Math.round(List_alignListItem_013.left - List_alignListItem_01.left))
.assertEqual(Math.round(List_alignListItem_01.right - List_alignListItem_013.right));
expect(Math.round(List_alignListItem_014.left - List_alignListItem_01.left))
.assertEqual(Math.round(List_alignListItem_01.right - List_alignListItem_014.right));
expect(List_alignListItem_011.top).assertEqual(List_alignListItem_01.top);
expect(Math.round(List_alignListItem_012.top - List_alignListItem_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_alignListItem_013.top - List_alignListItem_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_alignListItem_014.top - List_alignListItem_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_alignListItem_01.bottom - List_alignListItem_014.bottom)).assertEqual(vp2px(60));
expect(Math.round(List_alignListItem_011.right - List_alignListItem_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_012.right - List_alignListItem_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_013.right - List_alignListItem_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_014.right - List_alignListItem_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_011.bottom - List_alignListItem_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_alignListItem_012.bottom - List_alignListItem_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_alignListItem_013.bottom - List_alignListItem_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_alignListItem_014.bottom - List_alignListItem_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(
Math.round(List_alignListItem_013.left + ((List_alignListItem_013.right - List_alignListItem_013.left) / 2)),
Math.round(List_alignListItem_013.bottom),
Math.round(List_alignListItem_012.left + ((List_alignListItem_012.right - List_alignListItem_012.left) / 2)),
Math.round(List_alignListItem_012.bottom));
await CommonFunc.sleep(1000);
let List_alignListItem_024 = CommonFunc.getComponentRect('List_alignListItem_014');
expect(List_alignListItem_01.bottom - List_alignListItem_024.bottom).assertEqual(vp2px(60));
console.info('testListAlignListItemCenter END');
done();
});
/**
* @tc.number SUB_ACE_LIST_ALIGNLISTITEM_TEST_0300
* @tc.name testListAlignListItemEnd
* @tc.desc The List parent component binds the alignListItem property ListItemAlign.End
*/
it('testListAlignListItemEnd', 0, async function (done) {
console.info('testListAlignListItemEnd START');
globalThis.value.message.notify({name:'addAlignListItem', value:ListItemAlign.End})
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_alignListItem_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_alignListItem_011 = CommonFunc.getComponentRect('List_alignListItem_011');
let List_alignListItem_012 = CommonFunc.getComponentRect('List_alignListItem_012');
let List_alignListItem_013 = CommonFunc.getComponentRect('List_alignListItem_013');
let List_alignListItem_014 = CommonFunc.getComponentRect('List_alignListItem_014');
let List_alignListItem_01 = CommonFunc.getComponentRect('List_alignListItem_01');
expect(List_alignListItem_011.right).assertEqual(List_alignListItem_01.right);
expect(List_alignListItem_012.right).assertEqual(List_alignListItem_01.right);
expect(List_alignListItem_013.right).assertEqual(List_alignListItem_01.right);
expect(List_alignListItem_014.right).assertEqual(List_alignListItem_01.right);
expect(List_alignListItem_011.top).assertEqual(List_alignListItem_01.top);
expect(Math.round(List_alignListItem_012.top - List_alignListItem_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_alignListItem_013.top - List_alignListItem_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_alignListItem_014.top - List_alignListItem_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_alignListItem_01.bottom - List_alignListItem_014.bottom)).assertEqual(vp2px(60));
expect(Math.round(List_alignListItem_011.right - List_alignListItem_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_012.right - List_alignListItem_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_013.right - List_alignListItem_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_014.right - List_alignListItem_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_alignListItem_011.bottom - List_alignListItem_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_alignListItem_012.bottom - List_alignListItem_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_alignListItem_013.bottom - List_alignListItem_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_alignListItem_014.bottom - List_alignListItem_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(
Math.round(List_alignListItem_013.left + ((List_alignListItem_013.right - List_alignListItem_013.left) / 2)),
Math.round(List_alignListItem_013.bottom),
Math.round(List_alignListItem_012.left + ((List_alignListItem_012.right - List_alignListItem_012.left) / 2)),
Math.round(List_alignListItem_012.bottom));
await CommonFunc.sleep(1000);
let List_alignListItem_024 = CommonFunc.getComponentRect('List_alignListItem_014');
expect(List_alignListItem_01.bottom - List_alignListItem_024.bottom).assertEqual(vp2px(60));
console.info('testListAlignListItemEnd END');
done();
});
})
}
\ No newline at end of file
/*
* 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 '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function List_divider() {
describe('List_divider', function () {
beforeEach(async function (done) {
console.info("List_divider beforeEach start");
let options = {
uri: 'MainAbility/pages/List/List_Space/ListChange/List_divider',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get List_divider state pages:" + JSON.stringify(pages));
if (!("List_divider" == pages.name)) {
console.info("get List_divider state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push List_divider page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push List_divider page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
console.info("List_divider beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("List_divider after each called");
});
/**
* @tc.number SUB_ACE_LIST_LIST_DIVIDER_TEST_0100
* @tc.name testListDividerStrokeWidthToTen
* @tc.desc List parent component binding divider property and strokeWidth set to 10
*/
it('testListDividerStrokeWidthToTen', 0, async function (done) {
console.info('testListDividerStrokeWidthToTen START');
globalThis.value.message.notify({name:'strokeWidth', value:10})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('List_divider_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_divider_011 = CommonFunc.getComponentRect('List_divider_011');
let List_divider_012 = CommonFunc.getComponentRect('List_divider_012');
let List_divider_013 = CommonFunc.getComponentRect('List_divider_013');
let List_divider_014 = CommonFunc.getComponentRect('List_divider_014');
let List_divider_01 = CommonFunc.getComponentRect('List_divider_01');
expect(Math.round(List_divider_011.right - List_divider_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_divider_012.right - List_divider_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_divider_013.right - List_divider_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_divider_014.right - List_divider_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_divider_011.bottom - List_divider_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_divider_012.bottom - List_divider_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_divider_013.bottom - List_divider_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_divider_014.bottom - List_divider_014.top)).assertEqual(vp2px(100));
expect(List_divider_011.left).assertEqual(List_divider_01.left);
expect(List_divider_012.left).assertEqual(List_divider_01.left);
expect(List_divider_013.left).assertEqual(List_divider_01.left);
expect(List_divider_014.left).assertEqual(List_divider_01.left);
expect(List_divider_011.top).assertEqual(List_divider_01.top);
expect(Math.round(List_divider_012.top - List_divider_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_divider_013.top - List_divider_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_divider_014.top - List_divider_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_divider_01.bottom - List_divider_014.bottom)).assertEqual(vp2px(40));
expect(Math.round(List_divider_01.bottom - List_divider_01.top)).assertEqual(vp2px(500));
expect(Math.round(List_divider_01.right - List_divider_01.left)).assertEqual(vp2px(350));
let driver = await Driver.create();
await driver.swipe(360, 690, 360, 30);
await CommonFunc.sleep(3000);
let List_divider_014Again = CommonFunc.getComponentRect('List_divider_014');
expect(List_divider_014.top).assertEqual(List_divider_014Again.top);
console.info('testListDividerStrokeWidthToTen END');
done();
});
/**
* @tc.number SUB_ACE_LIST_LIST_DIVIDER_TEST_0200
* @tc.name testListDividerStrokeWidthToForty
* @tc.desc List parent component binding divider property and strokeWidth set to 40
*/
it('testListDividerStrokeWidthToForty', 0, async function (done) {
console.info('testListDividerStrokeWidthToForty START');
globalThis.value.message.notify({name:'strokeWidth', value:40})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('List_divider_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_divider_011 = CommonFunc.getComponentRect('List_divider_011');
let List_divider_012 = CommonFunc.getComponentRect('List_divider_012');
let List_divider_013 = CommonFunc.getComponentRect('List_divider_013');
let List_divider_014 = CommonFunc.getComponentRect('List_divider_014');
let List_divider_01 = CommonFunc.getComponentRect('List_divider_01');
expect(Math.round(List_divider_011.right - List_divider_011.left)).assertEqual(vp2px(300));
expect(Math.round(List_divider_012.right - List_divider_012.left)).assertEqual(vp2px(300));
expect(Math.round(List_divider_013.right - List_divider_013.left)).assertEqual(vp2px(300));
expect(Math.round(List_divider_014.right - List_divider_014.left)).assertEqual(vp2px(300));
expect(Math.round(List_divider_011.bottom - List_divider_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_divider_012.bottom - List_divider_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_divider_013.bottom - List_divider_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_divider_014.bottom - List_divider_014.top)).assertEqual(vp2px(100));
expect(List_divider_011.left).assertEqual(List_divider_01.left);
expect(List_divider_012.left).assertEqual(List_divider_01.left);
expect(List_divider_013.left).assertEqual(List_divider_01.left);
expect(List_divider_014.left).assertEqual(List_divider_01.left);
expect(List_divider_011.top).assertEqual(List_divider_01.top);
expect(Math.round(List_divider_014.bottom - List_divider_01.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_divider_012.top - List_divider_011.bottom)).assertEqual(vp2px(40));
expect(Math.round(List_divider_013.top - List_divider_012.bottom)).assertEqual(vp2px(40));
expect(Math.round(List_divider_014.top - List_divider_013.bottom)).assertEqual(vp2px(40));
expect(Math.round(List_divider_01.bottom - List_divider_01.top)).assertEqual(vp2px(500));
expect(Math.round(List_divider_01.right - List_divider_01.left)).assertEqual(vp2px(350));
let driver = await Driver.create();
await driver.swipe(360, 690, 360, 30);
await CommonFunc.sleep(3000);
let List_divider_014Again = CommonFunc.getComponentRect('List_divider_014');
expect(List_divider_01.bottom).assertEqual(List_divider_014Again.bottom);
console.info('testListDividerStrokeWidthToForty END');
done();
});
})
}
\ No newline at end of file
/*
* 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 '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function List_lanes() {
describe('List_lanes', function () {
beforeEach(async function (done) {
console.info("List_lanes beforeEach start");
let options = {
uri: 'MainAbility/pages/List/List_Space/ListChange/List_lanes',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get List_lanes state pages:" + JSON.stringify(pages));
if (!("List_lanes" == pages.name)) {
console.info("get List_lanes state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push List_lanes page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push List_lanes page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
console.info("List_lanes beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("List_lanes after each called");
});
/**
* @tc.number SUB_ACE_LIST_LANES_TEST_0100
* @tc.name testListLanesToOne
* @tc.desc List parent component binds the lanes property lanes(1)
*/
it('testListLanesToOne', 0, async function (done) {
console.info('testListLanesToOne START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_lanes_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_lanes_011 = CommonFunc.getComponentRect('List_lanes_011');
let List_lanes_012 = CommonFunc.getComponentRect('List_lanes_012');
let List_lanes_013 = CommonFunc.getComponentRect('List_lanes_013');
let List_lanes_014 = CommonFunc.getComponentRect('List_lanes_014');
let List_lanes_01 = CommonFunc.getComponentRect('List_lanes_01');
expect(List_lanes_011.left).assertEqual(List_lanes_01.left);
expect(List_lanes_012.left).assertEqual(List_lanes_01.left);
expect(List_lanes_013.left).assertEqual(List_lanes_01.left);
expect(List_lanes_014.left).assertEqual(List_lanes_01.left);
expect(List_lanes_011.top).assertEqual(List_lanes_01.top);
expect(Math.round(List_lanes_012.top - List_lanes_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_lanes_013.top - List_lanes_012.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_lanes_014.top - List_lanes_013.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_lanes_01.bottom - List_lanes_014.bottom)).assertEqual(vp2px(60));
expect(Math.round(List_lanes_011.right - List_lanes_011.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_012.right - List_lanes_012.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_013.right - List_lanes_013.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_014.right - List_lanes_014.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_011.bottom - List_lanes_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_012.bottom - List_lanes_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_013.bottom - List_lanes_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_014.bottom - List_lanes_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(
Math.round(List_lanes_013.left + ((List_lanes_013.right - List_lanes_013.left) / 2)),
Math.round(List_lanes_013.bottom),
Math.round(List_lanes_012.left + ((List_lanes_012.right - List_lanes_012.left) / 2)),
Math.round(List_lanes_012.bottom));
await CommonFunc.sleep(1000);
let List_lanes_024 = CommonFunc.getComponentRect('List_lanes_014');
expect(List_lanes_01.bottom - List_lanes_024.bottom).assertEqual(vp2px(60));
console.info('testListLanesToOne END');
done();
});
/**
* @tc.number SUB_ACE_LIST_LANES_TEST_0200
* @tc.name testListLanesToTwo
* @tc.desc List parent component binds the lanes property lanes(2)
*/
it('testListLanesToTwo', 0, async function (done) {
console.info('testListLanesToTwo START');
globalThis.value.message.notify({name:'addLanes', value:2})
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_lanes_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_lanes_011 = CommonFunc.getComponentRect('List_lanes_011');
let List_lanes_012 = CommonFunc.getComponentRect('List_lanes_012');
let List_lanes_013 = CommonFunc.getComponentRect('List_lanes_013');
let List_lanes_014 = CommonFunc.getComponentRect('List_lanes_014');
let List_lanes_01 = CommonFunc.getComponentRect('List_lanes_01');
expect(List_lanes_011.top).assertEqual(List_lanes_01.top);
expect(List_lanes_012.top).assertEqual(List_lanes_01.top);
expect(Math.round(List_lanes_013.top - List_lanes_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_lanes_014.top - List_lanes_012.bottom)).assertEqual(vp2px(20));
expect(List_lanes_011.left).assertEqual(List_lanes_01.left);
expect(List_lanes_013.left).assertEqual(List_lanes_01.left);
expect(Math.round((List_lanes_012.left - List_lanes_011.right)*10)/10).assertEqual(Math.round(vp2px(75)*10)/10);
expect(Math.round((List_lanes_014.left - List_lanes_013.right)*10)/10).assertEqual(Math.round(vp2px(75)*10)/10);
expect(Math.round(List_lanes_011.right - List_lanes_011.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_012.right - List_lanes_012.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_013.right - List_lanes_013.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_014.right - List_lanes_014.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_011.bottom - List_lanes_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_012.bottom - List_lanes_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_013.bottom - List_lanes_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_014.bottom - List_lanes_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(100,120,100,0);
await CommonFunc.sleep(1000);
let List_lanes_024 = CommonFunc.getComponentRect('List_lanes_013');
expect(List_lanes_024.top - List_lanes_01.top).assertEqual(vp2px(120));
console.info('testListLanesToTwo END');
done();
});
/**
* @tc.number SUB_ACE_LIST_LANES_TEST_0300
* @tc.name testListLanesToRange01
* @tc.desc List parent component binds the lanes property lanes({minLength:100,maxLength:150})
*/
it('testListLanesToRange01', 0, async function (done) {
console.info('testListLanesToRange01 START');
globalThis.value.message.notify({name:'addLanes', value:{minLength:100,maxLength:150}})
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('List_lanes_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_lanes_011 = CommonFunc.getComponentRect('List_lanes_011');
let List_lanes_012 = CommonFunc.getComponentRect('List_lanes_012');
let List_lanes_013 = CommonFunc.getComponentRect('List_lanes_013');
let List_lanes_014 = CommonFunc.getComponentRect('List_lanes_014');
let List_lanes_01 = CommonFunc.getComponentRect('List_lanes_01');
expect(List_lanes_011.top).assertEqual(List_lanes_01.top);
expect(List_lanes_012.top).assertEqual(List_lanes_01.top);
expect(List_lanes_013.top).assertEqual(List_lanes_01.top);
expect(List_lanes_014.top - List_lanes_011.bottom).assertEqual(vp2px(20));
expect(List_lanes_011.left).assertEqual(List_lanes_01.left);
expect(List_lanes_014.left).assertEqual(List_lanes_01.left);
expect(Math.round((List_lanes_012.left - List_lanes_011.right)*10)/10).assertEqual(Math.round(vp2px(50/3)*10)/10);
expect(Math.round((List_lanes_013.left - List_lanes_012.right)*10)/10).assertEqual(Math.round(vp2px(50/3)*10)/10);
expect(Math.round(List_lanes_011.right - List_lanes_011.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_012.right - List_lanes_012.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_013.right - List_lanes_013.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_014.right - List_lanes_014.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_011.bottom - List_lanes_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_012.bottom - List_lanes_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_013.bottom - List_lanes_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_014.bottom - List_lanes_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(100,120,100,0);
await CommonFunc.sleep(1000);
let List_lanes_024 = CommonFunc.getComponentRect('List_lanes_014');
expect(List_lanes_024.top - List_lanes_01.top).assertEqual(vp2px(120));
console.info('testListLanesToRange01 END');
done();
});
/**
* @tc.number SUB_ACE_LIST_LANES_TEST_0400
* @tc.name testListLanesToRange02
* @tc.desc List parent component binds the lanes property lanes({minLength:150,maxLength:200})
*/
it('testListLanesToRange02', 0, async function (done) {
console.info('testListLanesToRange02 START');
globalThis.value.message.notify({name:'addLanes', value:{minLength:150,maxLength:200}})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('List_lanes_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
let List_lanes_011 = CommonFunc.getComponentRect('List_lanes_011');
let List_lanes_012 = CommonFunc.getComponentRect('List_lanes_012');
let List_lanes_013 = CommonFunc.getComponentRect('List_lanes_013');
let List_lanes_014 = CommonFunc.getComponentRect('List_lanes_014');
let List_lanes_01 = CommonFunc.getComponentRect('List_lanes_01');
expect(List_lanes_011.top).assertEqual(List_lanes_01.top);
expect(List_lanes_012.top).assertEqual(List_lanes_01.top);
expect(Math.round(List_lanes_013.top - List_lanes_011.bottom)).assertEqual(vp2px(20));
expect(Math.round(List_lanes_014.top - List_lanes_012.bottom)).assertEqual(vp2px(20));
expect(List_lanes_011.left).assertEqual(List_lanes_01.left);
expect(List_lanes_013.left).assertEqual(List_lanes_01.left);
expect(Math.round((List_lanes_012.left - List_lanes_011.right)*10)/10).assertEqual(Math.round(vp2px(75)*10)/10);
expect(Math.round((List_lanes_014.left - List_lanes_013.right)*10)/10).assertEqual(Math.round(vp2px(75)*10)/10);
expect(Math.round(List_lanes_011.right - List_lanes_011.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_012.right - List_lanes_012.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_013.right - List_lanes_013.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_014.right - List_lanes_014.left)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_011.bottom - List_lanes_011.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_012.bottom - List_lanes_012.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_013.bottom - List_lanes_013.top)).assertEqual(vp2px(100));
expect(Math.round(List_lanes_014.bottom - List_lanes_014.top)).assertEqual(vp2px(100));
let driver = await Driver.create();
await driver.swipe(100,120,100,0);
await CommonFunc.sleep(1000);
let List_lanes_024 = CommonFunc.getComponentRect('List_lanes_013');
expect(List_lanes_024.top - List_lanes_01.top).assertEqual(vp2px(120));
console.info('testListLanesToRange02 END');
done();
});
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册