未验证 提交 5d968d34 编写于 作者: O openharmony_ci 提交者: Gitee

!7448 test:Add column&row_space xts_acts test

Merge pull request !7448 from 王倩/column_row
/*
* Copyright (c) 2023-2030 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 AlignStart_AddAlign {
@State addSpace: number = 10
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_NoSpace onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'addSpace') {
this.addSpace = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column({space:this.addSpace}) {
Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('Column_Space_011')
Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('Column_Space_012')
Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('Column_Space_013')
}.key('Column_Space_01').width(350).height(400).backgroundColor(0xAFEEEE)
}
}
/**
* Copyright (c) 2023-2030 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 Row_FlexPad_TextMarPad{
@State addSpace: number = 5
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_NoSpace onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'addSpace') {
this.addSpace = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Row({space:this.addSpace}){
Text('1').width(100).height(50).backgroundColor(0xF5DEB3).key('Row_Space_011')
Text('2').width(100).height(100).backgroundColor(0xD2B48C).key('Row_Space_012')
Text('3').width(100).height(150).backgroundColor(0xF5DEB3).key('Row_Space_013')
}
.width(350)
.height(200)
.key('Row_Space_01')
.backgroundColor(0xAFEEEE)
}
}
\ No newline at end of file
/**
* Copyright (c) 2023-2030 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 {MessageManager,Callback} from '../../../MainAbility/common/MessageManager';
export default function Column_Space() {
describe('column_SpaceTest', function () {
beforeEach(async function (done) {
console.info("Column_Space beforeEach start");
let options = {
url: "MainAbility/pages/Column/spaceChanged/Column_Space",
}
try {
router.clear();
let pages = router.getState();
console.info("get Column_Space state pages:" + JSON.stringify(pages));
if (!("Column_Space" == pages.name)) {
console.info("get Column_Space pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Column_Space page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Column_Space page error " + JSON.stringify(err));
expect().assertFail();
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Column_Space after each called")
});
/**
* @tc.number SUB_ACE_COLUMN_SPACE_TEST_0100
* @tc.name Column_Space
* @tc.desc The value of space changes, and the layout size of the parent and child components is fixed
*/
it('SUB_ACE_COLUMN_SPACE_TEST_0100', 0, async function (done) {
console.info('[SUB_ACE_COLUMN_SPACE_TEST_0100] START');
globalThis.value.message.notify({name:'addSpace', value:30});
await CommonFunc.sleep(3000);
let Column_Space_011 = CommonFunc.getComponentRect('Column_Space_011');
let Column_Space_012 = CommonFunc.getComponentRect('Column_Space_012');
let Column_Space_013 = CommonFunc.getComponentRect('Column_Space_013');
let Column_Space_01 = CommonFunc.getComponentRect('Column_Space_01');
expect(Column_Space_011.left - Column_Space_01.left).assertEqual(Column_Space_01.right - Column_Space_011.right);
expect(Column_Space_012.left - Column_Space_01.left).assertEqual(Column_Space_01.right - Column_Space_012.right);
expect(Column_Space_013.left - Column_Space_01.left).assertEqual(Column_Space_01.right - Column_Space_013.right);
expect(Column_Space_012.top - Column_Space_011.bottom).assertEqual(Column_Space_013.top - Column_Space_012.bottom)
expect(Column_Space_012.top - Column_Space_011.bottom).assertEqual(vp2px(30));
expect(Column_Space_01.top).assertEqual(Column_Space_011.top);
expect(Column_Space_013.bottom).assertLess(Column_Space_01.bottom);
expect(Column_Space_011.bottom - Column_Space_011.top).assertEqual(vp2px(50));
expect(Column_Space_012.bottom - Column_Space_012.top).assertEqual(vp2px(100));
expect(Column_Space_013.bottom - Column_Space_013.top).assertEqual(vp2px(150));
expect(Column_Space_011.right - Column_Space_011.left).assertEqual(vp2px(300));
expect(Column_Space_012.right - Column_Space_012.left).assertEqual(vp2px(300));
expect(Column_Space_013.right - Column_Space_013.left).assertEqual(vp2px(300));
console.info('[SUB_ACE_COLUMN_SPACE_TEST_0100] END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_SPACE_TEST_0200
* @tc.name Column_Space
* @tc.desc The value of space changes, and the layout size of the parent and child components is fixed
*/
it('SUB_ACE_COLUMN_SPACE_TEST_0200', 0, async function (done) {
console.info('[SUB_ACE_COLUMN_SPACE_TEST_0200] START');
globalThis.value.message.notify({name:'addSpace', value:50});
await CommonFunc.sleep(3000);
let Column_Space_011 = CommonFunc.getComponentRect('Column_Space_011');
let Column_Space_012 = CommonFunc.getComponentRect('Column_Space_012');
let Column_Space_013 = CommonFunc.getComponentRect('Column_Space_013');
let Column_Space_01 = CommonFunc.getComponentRect('Column_Space_01');
expect(Column_Space_011.left - Column_Space_01.left).assertEqual(Column_Space_01.right - Column_Space_011.right);
expect(Column_Space_012.left - Column_Space_01.left).assertEqual(Column_Space_01.right - Column_Space_012.right);
expect(Column_Space_013.left - Column_Space_01.left).assertEqual(Column_Space_01.right - Column_Space_013.right);
expect(Column_Space_012.top - Column_Space_011.bottom).assertEqual(Column_Space_013.top - Column_Space_012.bottom);
expect(Column_Space_012.top - Column_Space_011.bottom).assertEqual(vp2px(50));
expect(Column_Space_01.top).assertEqual(Column_Space_011.top);
expect(Column_Space_013.bottom).assertEqual(Column_Space_01.bottom);
expect(Column_Space_011.bottom - Column_Space_011.top).assertEqual(vp2px(50));
expect(Column_Space_012.bottom - Column_Space_012.top).assertEqual(vp2px(100));
expect(Column_Space_013.bottom - Column_Space_013.top).assertEqual(vp2px(150));
expect(Column_Space_011.right - Column_Space_011.left).assertEqual(vp2px(300));
expect(Column_Space_012.right - Column_Space_012.left).assertEqual(vp2px(300));
expect(Column_Space_013.right - Column_Space_013.left).assertEqual(vp2px(300));
console.info('[SUB_ACE_COLUMN_SPACE_TEST_0200] END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_SPACE_TEST_0300
* @tc.name Column_Space
* @tc.desc The value of space changes, and the layout size of the parent and child components is fixed
*/
it('SUB_ACE_COLUMN_SPACE_TEST_0300', 0, async function (done) {
console.info('[SUB_ACE_COLUMN_SPACE_TEST_0300] START');
globalThis.value.message.notify({name:'addSpace', value:70});
await CommonFunc.sleep(3000);
let Column_Space_011 = CommonFunc.getComponentRect('Column_Space_011');
let Column_Space_012 = CommonFunc.getComponentRect('Column_Space_012');
let Column_Space_013 = CommonFunc.getComponentRect('Column_Space_013');
let Column_Space_01 = CommonFunc.getComponentRect('Column_Space_01');
expect(Column_Space_011.left - Column_Space_01.left).assertEqual(Column_Space_01.right - Column_Space_011.right);
expect(Column_Space_012.left - Column_Space_01.left).assertEqual(Column_Space_01.right - Column_Space_012.right);
expect(Column_Space_013.left - Column_Space_01.left).assertEqual(Column_Space_01.right - Column_Space_013.right);
expect(Column_Space_012.top - Column_Space_011.bottom).assertEqual(Column_Space_013.top - Column_Space_012.bottom);
expect(Column_Space_012.top - Column_Space_011.bottom).assertEqual(vp2px(70));
expect(Column_Space_01.top).assertEqual(Column_Space_011.top);
expect(Column_Space_013.bottom).assertLarger(Column_Space_01.bottom);
expect(Column_Space_011.bottom - Column_Space_011.top).assertEqual(vp2px(50));
expect(Column_Space_012.bottom - Column_Space_012.top).assertEqual(vp2px(100));
expect(Column_Space_013.bottom - Column_Space_013.top).assertEqual(vp2px(150));
expect(Column_Space_011.right - Column_Space_011.left).assertEqual(vp2px(300));
expect(Column_Space_012.right - Column_Space_012.left).assertEqual(vp2px(300));
expect(Column_Space_013.right - Column_Space_013.left).assertEqual(vp2px(300));
console.info('[SUB_ACE_COLUMN_SPACE_TEST_0300] END');
done();
});
})
}
/**
* Copyright (c) 2023-2030 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 {MessageManager,Callback} from '../../../MainAbility/common/MessageManager';
export default function Row_Space() {
describe('row_SpaceTest', function () {
beforeEach(async function (done) {
console.info("Row_Space beforeEach start");
let options = {
url: "MainAbility/pages/Row/spaceChanged/Row_Space",
}
try {
router.clear();
let pages = router.getState();
console.info("get Row_Space state pages:" + JSON.stringify(pages));
if (!("Row_Space" == pages.name)) {
console.info("get Row_Space pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Row_Space page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Row_Space page error " + JSON.stringify(err));
expect().assertFail();
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Row_Space after each called")
});
/**
* @tc.number SUB_ACE_ROW_SPACE_TEST_0100
* @tc.name Row_Space
* @tc.desc The value of space changes, and the layout size of the parent and child components is fixed
*/
it('SUB_ACE_ROW_SPACE_0100', 0, async function (done) {
console.info('[SUB_ACE_ROW_SPACE_TEST_0100] START');
globalThis.value.message.notify({name:'addSpace', value:10});
await CommonFunc.sleep(3000);
let Row_Space_011 = CommonFunc.getComponentRect('Row_Space_011');
let Row_Space_012 = CommonFunc.getComponentRect('Row_Space_012');
let Row_Space_013 = CommonFunc.getComponentRect('Row_Space_013');
let Row_Space_01 = CommonFunc.getComponentRect('Row_Space_01');
expect(Row_Space_011.top - Row_Space_01.top).assertEqual(Row_Space_01.bottom - Row_Space_011.bottom);
expect(Row_Space_012.top - Row_Space_01.top).assertEqual(Row_Space_01.bottom - Row_Space_012.bottom);
expect(Row_Space_013.top - Row_Space_01.top).assertEqual(Row_Space_01.bottom - Row_Space_013.bottom);
expect(Row_Space_012.left - Row_Space_011.right).assertEqual(Row_Space_013.left - Row_Space_012.right);
expect(Row_Space_012.left - Row_Space_011.right).assertEqual(vp2px(10))
expect(Row_Space_01.left).assertEqual(Row_Space_011.left);
expect(Row_Space_013.right).assertLess(Row_Space_01.right);
expect(Row_Space_011.bottom - Row_Space_011.top).assertEqual(vp2px(50));
expect(Row_Space_012.bottom - Row_Space_012.top).assertEqual(vp2px(100));
expect(Row_Space_013.bottom - Row_Space_013.top).assertEqual(vp2px(150));
expect(Row_Space_011.right - Row_Space_011.left).assertEqual(vp2px(100));
expect(Row_Space_012.right - Row_Space_012.left).assertEqual(vp2px(100));
expect(Row_Space_013.right - Row_Space_013.left).assertEqual(vp2px(100));
console.info('[SUB_ACE_ROW_SPACE_TEST_0100] END');
done();
});
/**
* @tc.number SUB_ACE_ROW_SPACE_TEST_0200
* @tc.name Row_Space
* @tc.desc The value of space changes, and the layout size of the parent and child components is fixed
*/
it('SUB_ACE_ROW_SPACE_TEST_0200', 0, async function (done) {
console.info('[SUB_ACE_ROW_SPACE_TEST_0200] START');
globalThis.value.message.notify({name:'addSpace', value:25});
await CommonFunc.sleep(3000);
let Row_Space_011 = CommonFunc.getComponentRect('Row_Space_011');
let Row_Space_012 = CommonFunc.getComponentRect('Row_Space_012');
let Row_Space_013 = CommonFunc.getComponentRect('Row_Space_013');
let Row_Space_01 = CommonFunc.getComponentRect('Row_Space_01');
expect(Row_Space_011.top - Row_Space_01.top).assertEqual(Row_Space_01.bottom - Row_Space_011.bottom);
expect(Row_Space_012.top - Row_Space_01.top).assertEqual(Row_Space_01.bottom - Row_Space_012.bottom);
expect(Row_Space_013.top - Row_Space_01.top).assertEqual(Row_Space_01.bottom - Row_Space_013.bottom);
expect(Row_Space_012.left - Row_Space_011.right).assertEqual(Row_Space_013.left - Row_Space_012.right);
expect(Row_Space_012.left - Row_Space_011.right).assertEqual(vp2px(25));
expect(Row_Space_01.left).assertEqual(Row_Space_011.left);
expect(Row_Space_013.right).assertEqual(Row_Space_01.right);
expect(Row_Space_011.bottom - Row_Space_011.top).assertEqual(vp2px(50));
expect(Row_Space_012.bottom - Row_Space_012.top).assertEqual(vp2px(100));
expect(Row_Space_013.bottom - Row_Space_013.top).assertEqual(vp2px(150));
expect(Row_Space_011.right - Row_Space_011.left).assertEqual(vp2px(100));
expect(Row_Space_012.right - Row_Space_012.left).assertEqual(vp2px(100));
expect(Row_Space_013.right - Row_Space_013.left).assertEqual(vp2px(100));
console.info('[SUB_ACE_ROW_SPACE_TEST_0200] END');
done();
});
/**
* @tc.number SUB_ACE_ROW_SPACE_TEST_0300
* @tc.name Row_Space
* @tc.desc The value of space changes, and the layout size of the parent and child components is fixed
*/
it('SUB_ACE_ROW_SPACE_TEST_0300', 0, async function (done) {
console.info('[SUB_ACE_ROW_SPACE_TEST_0300] START');
globalThis.value.message.notify({name:'addSpace', value:30});
await CommonFunc.sleep(3000);
let Row_Space_011 = CommonFunc.getComponentRect('Row_Space_011');
let Row_Space_012 = CommonFunc.getComponentRect('Row_Space_012');
let Row_Space_013 = CommonFunc.getComponentRect('Row_Space_013');
let Row_Space_01 = CommonFunc.getComponentRect('Row_Space_01');
expect(Row_Space_011.top - Row_Space_01.top).assertEqual(Row_Space_01.bottom - Row_Space_011.bottom);
expect(Row_Space_012.top - Row_Space_01.top).assertEqual(Row_Space_01.bottom - Row_Space_012.bottom);
expect(Row_Space_013.top - Row_Space_01.top).assertEqual(Row_Space_01.bottom - Row_Space_013.bottom);
expect(Row_Space_012.left - Row_Space_011.right).assertEqual(Row_Space_013.left - Row_Space_012.right);
expect(Row_Space_012.left - Row_Space_011.right).assertEqual(vp2px(30))
expect(Row_Space_01.left).assertEqual(Row_Space_011.left);
expect(Row_Space_013.right).assertLarger(Row_Space_01.right);
expect(Row_Space_011.bottom - Row_Space_011.top).assertEqual(vp2px(50));
expect(Row_Space_012.bottom - Row_Space_012.top).assertEqual(vp2px(100));
expect(Row_Space_013.bottom - Row_Space_013.top).assertEqual(vp2px(150));
expect(Row_Space_011.right - Row_Space_011.left).assertEqual(vp2px(100));
expect(Row_Space_012.right - Row_Space_012.left).assertEqual(vp2px(100));
expect(Row_Space_013.right - Row_Space_013.left).assertEqual(vp2px(100));
console.info('[SUB_ACE_ROW_SPACE_TEST_0300] END');
done();
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册