Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9392fd2d
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9392fd2d
编写于
4月 12, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 12, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7461 test:add flex_Wrap_NoWrap xts_acts testcase part2
Merge pull request !7461 from 李伟明/flex_nowrap_1
上级
f15c2aab
b5ea4270
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
813 addition
and
0 deletion
+813
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMarPad_TextMarPad.ets
...es/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMarPad_TextMarPad.ets
+85
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMar_TextMarPad.ets
...pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMar_TextMarPad.ets
+80
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexPad_TextMarPad.ets
...pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexPad_TextMarPad.ets
+78
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMarPad_TextMarPad.test.ets
...ex/Wrap/NoWrap/Flex_NoWrap_FlexMarPad_TextMarPad.test.ets
+198
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMar_TextMarPad.test.ets
.../Flex/Wrap/NoWrap/Flex_NoWrap_FlexMar_TextMarPad.test.ets
+196
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/NoWrap/Flex_NoWrap_FlexPad_TextMarPad.test.ets
.../Flex/Wrap/NoWrap/Flex_NoWrap_FlexPad_TextMarPad.test.ets
+176
-0
未找到文件。
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMarPad_TextMarPad.ets
0 → 100644
浏览文件 @
9392fd2d
/**
* 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 Flex_NoWrap_FlexMarPad_TextMarPad{
@State firstTextPadding: number = 0;
@State secondTextPadding: number = 0;
@State thirdTextPadding: number = 0;
@State firstTextMargin: number = 0;
@State secondTextMargin: number = 0;
@State thirdTextMargin: number = 0;
@State flexMargin: number = 0;
@State flexPadding: number = 0;
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('Flex_NoWrap_FlexMarPad_TextMarPad onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'firstTextPadding') {
this.firstTextPadding = message.value;
}
if (message.name == 'secondTextPadding') {
this.secondTextPadding = message.value;
}
if (message.name == 'thirdTextPadding') {
this.thirdTextPadding = message.value;
}
if (message.name == 'firstTextMargin') {
this.firstTextMargin = message.value;
}
if (message.name == 'secondTextMargin') {
this.secondTextMargin = message.value;
}
if (message.name == 'thirdTextMargin') {
this.thirdTextMargin = message.value;
}
if (message.name == 'flexMargin') {
this.flexMargin = message.value;
}
if (message.name == 'flexPadding') {
this.flexPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.NoWrap}){
Text('1').width(150).height(100).backgroundColor(0xF5DEB3).margin(this.firstTextMargin)
.padding(this.firstTextPadding).key('NoWrap_FlexMarPad_TextPad1');
Text('2').width(150).height(150).backgroundColor(0xD2B48C).margin(this.secondTextMargin)
.padding(this.secondTextPadding).key('NoWrap_FlexMarPad_TextPad2');
Text('3').width(150).height(200).backgroundColor(0xF5DEB3).margin(this.thirdTextMargin)
.padding(this.thirdTextPadding).key('NoWrap_FlexMarPad_TextPad3');
}
.width(500)
.height(200)
.margin(this.flexMargin)
.padding(this.flexPadding)
.backgroundColor(0xAFEEEE)
.key('FlexNoWrap_FlexMarPad_TextMarPad_Container01')
}
.alignItems(HorizontalAlign.Start)
.width('100%')
.height('100%')
.key('Column_Container01')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMar_TextMarPad.ets
0 → 100644
浏览文件 @
9392fd2d
/**
* 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 Flex_NoWrap_FlexMar_TextMarPad{
@State firstTextPadding: number = 0;
@State secondTextPadding: number = 0;
@State thirdTextPadding: number = 0;
@State firstTextMargin: number = 0;
@State secondTextMargin: number = 0;
@State thirdTextMargin: number = 0;
@State flexMargin: number = 0;
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('FlexAlignContent_SpaceAround_01 onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'firstTextPadding') {
this.firstTextPadding = message.value;
}
if (message.name == 'secondTextPadding') {
this.secondTextPadding = message.value;
}
if (message.name == 'thirdTextPadding') {
this.thirdTextPadding = message.value;
}
if (message.name == 'firstTextMargin') {
this.firstTextMargin = message.value;
}
if (message.name == 'secondTextMargin') {
this.secondTextMargin = message.value;
}
if (message.name == 'thirdTextMargin') {
this.thirdTextMargin = message.value;
}
if (message.name == 'flexMargin') {
this.flexMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.NoWrap}){
Text('1').width(150).height(100).backgroundColor(0xF5DEB3).margin(this.firstTextMargin)
.padding(this.firstTextPadding).key('NoWrap_FlexMar_TextPad1');
Text('2').width(150).height(150).backgroundColor(0xD2B48C).margin(this.secondTextMargin)
.padding(this.secondTextPadding).key('NoWrap_FlexMar_TextPad2');
Text('3').width(150).height(200).backgroundColor(0xF5DEB3).margin(this.thirdTextMargin)
.padding(this.thirdTextPadding).key('NoWrap_FlexMar_TextPad3');
}
.width(500)
.height(200)
.margin(this.flexMargin)
.backgroundColor(0xAFEEEE)
.key('FlexMar_TextMarPad_Container01')
}
.alignItems(HorizontalAlign.Start)
.width('100%')
.height('100%')
.key('Column_FlexMar_TextMarPad_Container01')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexPad_TextMarPad.ets
0 → 100644
浏览文件 @
9392fd2d
/**
* 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 Flex_NoWrap_FlexPad_TextMarPad{
@State firstTextPadding: number = 0;
@State secondTextPadding: number = 0;
@State thirdTextPadding: number = 0;
@State firstTextMargin: number = 0;
@State secondTextMargin: number = 0;
@State thirdTextMargin: number = 0;
@State flexPadding: number = 0;
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('Flex_NoWrap_FlexPad_TextMarPad onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'firstTextPadding') {
this.firstTextPadding = message.value;
}
if (message.name == 'secondTextPadding') {
this.secondTextPadding = message.value;
}
if (message.name == 'thirdTextPadding') {
this.thirdTextPadding = message.value;
}
if (message.name == 'firstTextMargin') {
this.firstTextMargin = message.value;
}
if (message.name == 'secondTextMargin') {
this.secondTextMargin = message.value;
}
if (message.name == 'thirdTextMargin') {
this.thirdTextMargin = message.value;
}
if (message.name == 'flexPadding') {
this.flexPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.NoWrap}){
Text('1').width(150).height(100).backgroundColor(0xF5DEB3).margin(this.firstTextMargin)
.padding(this.firstTextPadding).key('NoWrap_FlexPad_TextMarPad1');
Text('2').width(150).height(150).backgroundColor(0xD2B48C).margin(this.secondTextMargin)
.padding(this.secondTextPadding).key('NoWrap_FlexPad_TextMarPad2');
Text('3').width(150).height(200).backgroundColor(0xF5DEB3).margin(this.thirdTextMargin)
.padding(this.thirdTextPadding).key('NoWrap_FlexPad_TextMarPad3');
}
.width(500)
.height(200)
.padding(this.flexPadding)
.backgroundColor(0xAFEEEE)
.key('FlexNoWrap_FlexPad_TextMarPad_Container01')
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMarPad_TextMarPad.test.ets
0 → 100644
浏览文件 @
9392fd2d
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import router from '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
export default function flex_NoWrap_FlexMarPad_TextMarPadTest() {
describe('Flex_NoWrap_FlexMarPad_TextMarPadTest', function () {
beforeEach(async function (done) {
console.info("Flex_NoWrap_FlexMarPad_TextMarPadTest beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMarPad_TextMarPad',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_NoWrap_FlexMarPad_TextMarPad state pages:" + JSON.stringify(pages));
if (!("Flex_NoWrap_FlexMarPad_TextMarPad" == pages.name)) {
console.info("get Flex_NoWrap_FlexMarPad_TextMarPad pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_NoWrap_FlexMarPad_TextMarPad page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_NoWrap_FlexMarPad_TextMarPad page error:" + err);
}
console.info("Flex_NoWrap_FlexMarPad_TextMarPadTest beforeEach end");
done();
});
afterEach(async function () {
globalThis.value.message.notify({name:'firstTextMargin', value:0});
globalThis.value.message.notify({name:'secondTextMargin', value:0});
globalThis.value.message.notify({name:'thirdTextMargin', value:0});
globalThis.value.message.notify({name:'firstTextPadding', value:0});
globalThis.value.message.notify({name:'secondTextPadding', value:0});
globalThis.value.message.notify({name:'thirdTextPadding', value:0});
globalThis.value.message.notify({name:'flexMargin', value:0});
globalThis.value.message.notify({name:'flexPadding', value:0});
await CommonFunc.sleep(1000);
console.info("Flex_NoWrap_FlexMarPad_TextMarPadText after each called");
});
/**
* @tc.number SUB_ACE_FLEXWRAP_NOWRAP_0500
* @tc.name testWrapNoWrapFlexMarPadTextPad
* @tc.desc The size of the parent component in the main axis direction is not enough for the layout
* of the child components when the parent components set padding and margin,and the child components set padding
*/
it('testWrapNoWrapFlexMarPadTextPad', 0, async function (done) {
console.info('[testWrapNoWrapFlexMarPadTextPad] START');
globalThis.value.message.notify({name:'firstTextPadding', value:10});
globalThis.value.message.notify({name:'secondTextPadding', value:20});
globalThis.value.message.notify({name:'thirdTextPadding', value:30});
globalThis.value.message.notify({name:'flexMargin', value:10});
globalThis.value.message.notify({name:'flexPadding', value:30});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('NoWrap_FlexMarPad_TextPad1');
let secondText = CommonFunc.getComponentRect('NoWrap_FlexMarPad_TextPad2');
let thirdText = CommonFunc.getComponentRect('NoWrap_FlexMarPad_TextPad3');
let flexContainer = CommonFunc.getComponentRect('FlexNoWrap_FlexMarPad_TextMarPad_Container01');
let columnContainer = CommonFunc.getComponentRect('Column_Container01');
let flexContainerStrJson = getInspectorByKey('FlexNoWrap_FlexMarPad_TextMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(Math.round(flexContainer.left - columnContainer.left)).assertEqual(vp2px(10));
expect(Math.round(flexContainer.top - columnContainer.top)).assertEqual(vp2px(10)); //margin = 10
expect(Math.round(firstText.left - flexContainer.left)).assertEqual(vp2px(30));
expect(Math.round(firstText.top - flexContainer.top)).assertEqual(vp2px(30)); //padding=30
expect(firstText.top).assertEqual(secondText.top);
expect(secondText.top).assertEqual(thirdText.top);
expect(firstText.right).assertEqual(secondText.left);
expect(secondText.right).assertEqual(thirdText.left);
expect(Math.round(firstText.bottom - firstText.top)).assertEqual(vp2px(100));
expect(Math.round(secondText.bottom - secondText.top)).assertEqual(vp2px(150));
expect(Math.round(thirdText.bottom - thirdText.top)).assertEqual(vp2px(200));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(vp2px(440) / 3));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(secondText.right - secondText.left));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(thirdText.right - thirdText.left));
expect(Math.round(flexContainer.right - thirdText.right)).assertEqual(vp2px(30));
expect(Math.round(thirdText.bottom - flexContainer.bottom)).assertEqual(vp2px(30));
console.info('[testWrapNoWrapFlexMarPadTextPad] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXWRAP_NOWRAP_0600
* @tc.name testWrapNoWrapFlexMarPadTextMar
* @tc.desc The size of the parent component in the main axis direction is not enough for the layout
* of the child components when the parent components set padding and margin,and the child components set margin
*/
it('testWrapNoWrapFlexMarPadTextMar', 0, async function (done) {
console.info('[testWrapNoWrapFlexMarPadTextMar] START');
globalThis.value.message.notify({name:'firstTextMargin', value:10});
globalThis.value.message.notify({name:'secondTextMargin', value:10});
globalThis.value.message.notify({name:'thirdTextMargin', value:10});
globalThis.value.message.notify({name:'flexMargin', value:10});
globalThis.value.message.notify({name:'flexPadding', value:20});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('NoWrap_FlexMarPad_TextPad1');
let secondText = CommonFunc.getComponentRect('NoWrap_FlexMarPad_TextPad2');
let thirdText = CommonFunc.getComponentRect('NoWrap_FlexMarPad_TextPad3');
let flexContainer = CommonFunc.getComponentRect('FlexNoWrap_FlexMarPad_TextMarPad_Container01');
let columnContainer = CommonFunc.getComponentRect('Column_Container01');
let flexContainerStrJson = getInspectorByKey('FlexNoWrap_FlexMarPad_TextMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(Math.round(flexContainer.top - columnContainer.top)).assertEqual(vp2px(10)); //margin = 10
expect(Math.round(flexContainer.left - columnContainer.left)).assertEqual(vp2px(10)); //margin = 10
expect(Math.round(firstText.left - flexContainer.left)).assertEqual(vp2px(30));
expect(Math.round(firstText.top - flexContainer.top)).assertEqual(vp2px(30)); //padding+margin=30
expect(firstText.top).assertEqual(secondText.top);
expect(secondText.top).assertEqual(thirdText.top);
expect(Math.round(firstText.bottom - firstText.top)).assertEqual(vp2px(100));
expect(Math.round(secondText.bottom - secondText.top)).assertEqual(vp2px(150));
expect(Math.round(thirdText.bottom - thirdText.top)).assertEqual(vp2px(200));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(vp2px(400) / 3));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(secondText.right - secondText.left));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(thirdText.right - thirdText.left));
expect(Math.round(secondText.left - firstText.right)).assertEqual(vp2px(20));
expect(Math.round(flexContainer.right - thirdText.right)).assertEqual(vp2px(30));
expect(Math.round(thirdText.bottom - flexContainer.bottom)).assertEqual(vp2px(30));
console.info('[testWrapNoWrapFlexMarPadTextMar] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXWRAP_NOWRAP_0700
* @tc.name testWrapNoWrapFlexMarPadTextMarPad
* @tc.desc The size of the parent component in the main axis direction is not enough for the layout
* of the child components when all of components set padding and margin
*/
it('testWrapNoWrapFlexMarPadTextMarPad', 0, async function (done) {
console.info('[testWrapNoWrapFlexMarPadTextMarPad] START');
globalThis.value.message.notify({name:'firstTextMargin', value:10});
globalThis.value.message.notify({name:'secondTextMargin', value:10});
globalThis.value.message.notify({name:'thirdTextMargin', value:10});
globalThis.value.message.notify({name:'firstTextPadding', value:10});
globalThis.value.message.notify({name:'secondTextPadding', value:20});
globalThis.value.message.notify({name:'thirdTextPadding', value:30});
globalThis.value.message.notify({name:'flexMargin', value:20});
globalThis.value.message.notify({name:'flexPadding', value:30});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('NoWrap_FlexMarPad_TextPad1');
let secondText = CommonFunc.getComponentRect('NoWrap_FlexMarPad_TextPad2');
let thirdText = CommonFunc.getComponentRect('NoWrap_FlexMarPad_TextPad3');
let flexContainer = CommonFunc.getComponentRect('FlexNoWrap_FlexMarPad_TextMarPad_Container01');
let columnContainer = CommonFunc.getComponentRect('Column_Container01');
let flexContainerStrJson = getInspectorByKey('FlexNoWrap_FlexMarPad_TextMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(Math.round(flexContainer.top - columnContainer.top)).assertEqual(vp2px(20));
expect(Math.round(flexContainer.left - columnContainer.left)).assertEqual(vp2px(20)); //margin = 20
expect(Math.round(firstText.left - flexContainer.left)).assertEqual(vp2px(40));
expect(Math.round(firstText.top - flexContainer.top)).assertEqual(vp2px(40)); //flex_padding + margin=40
expect(firstText.top).assertEqual(secondText.top);
expect(secondText.top).assertEqual(thirdText.top);
expect(Math.round(firstText.bottom - firstText.top)).assertEqual(vp2px(100));
expect(Math.round(secondText.bottom - secondText.top)).assertEqual(vp2px(150));
expect(Math.round(thirdText.bottom - thirdText.top)).assertEqual(vp2px(200));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(vp2px(380) / 3));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(secondText.right - secondText.left));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(thirdText.right - thirdText.left));
expect(Math.round(secondText.left - firstText.right)).assertEqual(vp2px(20));
expect(Math.round(thirdText.left - secondText.right)).assertEqual(vp2px(20));
expect(Math.round(flexContainer.right - thirdText.right)).assertEqual(vp2px(40));
expect(Math.round(thirdText.bottom - flexContainer.bottom)).assertEqual(vp2px(40));
console.info('[testWrapNoWrapFlexMarPadTextMarPad] END');
done();
});
})
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMar_TextMarPad.test.ets
0 → 100644
浏览文件 @
9392fd2d
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import router from '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
export default function flex_NoWrap_FlexMar_TextMarPadTest() {
describe('Flex_NoWrap_FlexMar_TextMarPadTest', function () {
beforeEach(async function (done) {
console.info("Flex_NoWrap_FlexMar_TextMarPadTest beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexMar_TextMarPad',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_NoWrap_FlexMar_TextMarPad state pages:" + JSON.stringify(pages));
if (!("Flex_NoWrap_FlexMar_TextMarPad" == pages.name)) {
console.info("get Flex_NoWrap_FlexMar_TextMarPad pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_NoWrap_FlexMar_TextMarPad page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_NoWrap_FlexMar_TextMarPad page error:" + err);
}
console.info("Flex_NoWrap_FlexMar_TextMarPadTest beforeEach end");
done();
});
afterEach(async function () {
globalThis.value.message.notify({name:'firstTextMargin', value:0});
globalThis.value.message.notify({name:'secondTextMargin', value:0});
globalThis.value.message.notify({name:'thirdTextMargin', value:0});
globalThis.value.message.notify({name:'firstTextPadding', value:0});
globalThis.value.message.notify({name:'secondTextPadding', value:0});
globalThis.value.message.notify({name:'thirdTextPadding', value:0});
globalThis.value.message.notify({name:'flexMargin', value:0});
await CommonFunc.sleep(1000);
console.info("Flex_NoWrap_FlexMar_TextMarPadText after each called");
});
/**
* @tc.number SUB_ACE_FLEXWRAP_NOWRAP_0200
* @tc.name testWrapNoWrapFlexMarTextPad
* @tc.desc The size of the parent component in the main axis direction meets the layout
* of the child components when the parent components set margin,and the child components set padding
*/
it('testWrapNoWrapFlexMarTextPad', 0, async function (done) {
console.info('[testWrapNoWrapFlexMarTextPad] START');
globalThis.value.message.notify({name:'firstTextPadding', value:10});
globalThis.value.message.notify({name:'secondTextPadding', value:20});
globalThis.value.message.notify({name:'thirdTextPadding', value:30});
globalThis.value.message.notify({name:'flexMargin', value:10});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('NoWrap_FlexMar_TextPad1');
let secondText = CommonFunc.getComponentRect('NoWrap_FlexMar_TextPad2');
let thirdText = CommonFunc.getComponentRect('NoWrap_FlexMar_TextPad3');
let flexContainer = CommonFunc.getComponentRect('FlexMar_TextMarPad_Container01');
let columnContainer = CommonFunc.getComponentRect('Column_FlexMar_TextMarPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexMar_TextMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(Math.round(flexContainer.top - columnContainer.top)).assertEqual(vp2px(10));
expect(Math.round(flexContainer.left - columnContainer.left)).assertEqual(vp2px(10)); //margin =10
expect(Math.round(flexContainer.top - columnContainer.top))
.assertEqual(Math.round(firstText.top - columnContainer.top));
expect(firstText.left).assertEqual(flexContainer.left);
expect(firstText.right).assertEqual(secondText.left);
expect(secondText.right).assertEqual(thirdText.left);
expect(firstText.top).assertEqual(secondText.top);
expect(secondText.top).assertEqual(thirdText.top);
expect(Math.round(firstText.bottom - firstText.top)).assertEqual(vp2px(100));
expect(Math.round(secondText.bottom - secondText.top)).assertEqual(vp2px(150));
expect(Math.round(thirdText.bottom - thirdText.top)).assertEqual(vp2px(200));
expect(Math.round(firstText.right - firstText.left)).assertEqual(vp2px(150))
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(secondText.right - secondText.left));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(thirdText.right - thirdText.left));
expect(flexContainer.bottom).assertEqual(thirdText.bottom);
expect(Math.round(flexContainer.right - thirdText.right)).assertEqual(vp2px(50));
console.info('[testWrapNoWrapFlexMarTextPad] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXWRAP_NOWRAP_0300
* @tc.name testWrapNoWrapFlexMarTextMar
* @tc.desc The size of the parent component in the main axis direction meets the layout
* of the child components when the parent components set margin,and the child components set margin
*/
it('testWrapNoWrapFlexMarTextMar', 0, async function (done) {
console.info('[testWrapNoWrapFlexMarTextMar] START');
globalThis.value.message.notify({name:'firstTextMargin', value:10});
globalThis.value.message.notify({name:'flexMargin', value:10});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('NoWrap_FlexMar_TextPad1');
let secondText = CommonFunc.getComponentRect('NoWrap_FlexMar_TextPad2');
let thirdText = CommonFunc.getComponentRect('NoWrap_FlexMar_TextPad3');
let columnContainer = CommonFunc.getComponentRect('Column_FlexMar_TextMarPad_Container01');
let flexContainer = CommonFunc.getComponentRect('FlexMar_TextMarPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexMar_TextMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(Math.round(flexContainer.top - columnContainer.top)).assertEqual(vp2px(10));
expect(Math.round(flexContainer.left - columnContainer.left)).assertEqual(vp2px(10)); //flex_margin =10
expect(Math.round(firstText.left - flexContainer.left)).assertEqual(vp2px(10));
expect(Math.round(firstText.top - flexContainer.top)).assertEqual(vp2px(10));
expect(Math.round(firstText.left - flexContainer.left)).assertEqual(Math.round(secondText.left - firstText.right));
expect(secondText.top).assertEqual(thirdText.top);
expect(secondText.right).assertEqual(thirdText.left);
expect(Math.round(firstText.bottom - firstText.top)).assertEqual(vp2px(100));
expect(Math.round(secondText.bottom - secondText.top)).assertEqual(vp2px(150));
expect(Math.round(thirdText.bottom - thirdText.top)).assertEqual(vp2px(200));
expect(Math.round(firstText.right- firstText.left)).assertEqual(vp2px(150));
expect(Math.round(firstText.right- firstText.left)).assertEqual(Math.round(secondText.right- secondText.left));
expect(Math.round(secondText.right- secondText.left)).assertEqual(Math.round(thirdText.right- thirdText.left));
expect(flexContainer.bottom).assertEqual(thirdText.bottom);
expect(Math.round(flexContainer.right - thirdText.right)).assertEqual(vp2px(30));
console.info('[testWrapNoWrapFlexMarTextMar] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXWRAP_NOWRAP_0400
* @tc.name testWrapNoWrapFlexMarTextMarPad
* @tc.desc The size of the parent component in the main axis direction is not enough the layout
* of the child components when the parent components set margin,and the child components set margin and padding
*/
it('testWrapNoWrapFlexMarTextMarPad', 0, async function (done) {
console.info('[testWrapNoWrapFlexMarTextMarPad] START');
globalThis.value.message.notify({name:'firstTextMargin', value:10});
globalThis.value.message.notify({name:'secondTextMargin', value:10});
globalThis.value.message.notify({name:'thirdTextMargin', value:10});
globalThis.value.message.notify({name:'firstTextPadding', value:20});
globalThis.value.message.notify({name:'secondTextPadding', value:20});
globalThis.value.message.notify({name:'thirdTextPadding', value:20});
globalThis.value.message.notify({name:'flexMargin', value:10});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('NoWrap_FlexMar_TextPad1');
let secondText = CommonFunc.getComponentRect('NoWrap_FlexMar_TextPad2');
let thirdText = CommonFunc.getComponentRect('NoWrap_FlexMar_TextPad3');
let flexContainer = CommonFunc.getComponentRect('FlexMar_TextMarPad_Container01');
let columnContainer = CommonFunc.getComponentRect('Column_FlexMar_TextMarPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexMar_TextMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(Math.round(flexContainer.left - columnContainer.left)).assertEqual(vp2px(10));
expect(Math.round(flexContainer.top - columnContainer.top)).assertEqual(vp2px(10));
expect(Math.round(firstText.top - flexContainer.top)).assertEqual(vp2px(10));
expect(firstText.top).assertEqual(secondText.top);
expect(secondText.top).assertEqual(thirdText.top);
expect(Math.round(firstText.bottom - firstText.top)).assertEqual(vp2px(100));
expect(Math.round(secondText.bottom - secondText.top)).assertEqual(vp2px(150));
expect(Math.round(thirdText.bottom - thirdText.top)).assertEqual(vp2px(200));
expect(Math.round(firstText.left - flexContainer.left)).assertEqual(vp2px(10));
expect(Math.round(secondText.left - firstText.right)).assertEqual(vp2px(20));
expect(Math.round(thirdText.left - secondText.right)).assertEqual(vp2px(20));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(vp2px(440) / 3));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(secondText.right - secondText.left));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(thirdText.right - thirdText.left));
expect(Math.round(flexContainer.right - thirdText.right)).assertEqual(vp2px(10));
expect(Math.round(thirdText.bottom - flexContainer.bottom)).assertEqual(vp2px(10));
console.info('[testWrapNoWrapFlexMarTextMarPad] END');
done();
});
})
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/NoWrap/Flex_NoWrap_FlexPad_TextMarPad.test.ets
0 → 100644
浏览文件 @
9392fd2d
/**
* 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 events_emitter from '@ohos.events.emitter';
import router from '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
export default function flex_NoWrap_FlexPad_TextMarPadTest() {
describe('Flex_NoWrap_FlexPad_TextMarPadTest', function () {
beforeEach(async function (done) {
console.info("Flex_NoWrap_FlexPad_TextMarPadTest beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/Wrap/NoWrap/Flex_NoWrap_FlexPad_TextMarPad',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_NoWrap_FlexPad_TextMarPad state pages:" + JSON.stringify(pages));
if (!("Flex_NoWrap_FlexPad_TextMarPad" == pages.name)) {
console.info("get Flex_NoWrap_FlexPad_TextMarPad pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_NoWrap_FlexPad_TextMarPad page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_NoWrap_FlexPad_TextMarPad page error:" + err);
}
console.info("Flex_NoWrap_FlexPad_TextMarPadTest beforeEach end");
done();
});
afterEach(async function () {
globalThis.value.message.notify({name:'firstTextMargin', value:0});
globalThis.value.message.notify({name:'secondTextMargin', value:0});
globalThis.value.message.notify({name:'thirdTextMargin', value:0});
globalThis.value.message.notify({name:'firstTextPadding', value:0});
globalThis.value.message.notify({name:'secondTextPadding', value:0});
globalThis.value.message.notify({name:'thirdTextPadding', value:0});
globalThis.value.message.notify({name:'flexPadding', value:0});
await CommonFunc.sleep(1000);
console.info("Flex_NoWrap_FlexPad_TextMarPadText after each called");
});
/**
* @tc.number SUB_ACE_FLEXWRAP_NOWRAP_0800
* @tc.name testWrapNoWrapFlexPadTextPad
* @tc.desc The size of the parent component in the main axis direction is not enough for
* the layout of the child components when all of the components set padding
*/
it('testWrapNoWrapFlexPadTextPad', 0, async function (done) {
console.info('[testWrapNoWrapFlexPadTextPad] START');
globalThis.value.message.notify({name:'firstTextPadding', value:10});
globalThis.value.message.notify({name:'secondTextPadding', value:20});
globalThis.value.message.notify({name:'thirdTextPadding', value:30});
globalThis.value.message.notify({name:'flexPadding', value:30});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('NoWrap_FlexPad_TextMarPad1');
let secondText = CommonFunc.getComponentRect('NoWrap_FlexPad_TextMarPad2');
let thirdText = CommonFunc.getComponentRect('NoWrap_FlexPad_TextMarPad3');
let flexContainer = CommonFunc.getComponentRect('FlexNoWrap_FlexPad_TextMarPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexNoWrap_FlexPad_TextMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(firstText.top - flexContainer.top).assertEqual(vp2px(30)); //padding =30
expect(firstText.top).assertEqual(secondText.top);
expect(secondText.top).assertEqual(thirdText.top);
expect(Math.round(firstText.bottom - firstText.top)).assertEqual(vp2px(100));
expect(Math.round(secondText.bottom - secondText.top)).assertEqual(vp2px(150));
expect(Math.round(thirdText.bottom - thirdText.top)).assertEqual(vp2px(200));
expect(Math.round(firstText.right- firstText.left)).assertEqual(Math.round(vp2px(440) / 3));
expect(Math.round(firstText.right- firstText.left)).assertEqual(Math.round(secondText.right- secondText.left));
expect(Math.round(secondText.right- secondText.left)).assertEqual(Math.round(thirdText.right- thirdText.left));
expect(firstText.right).assertEqual(secondText.left);
expect(secondText.right).assertEqual(thirdText.left);
expect(Math.round(flexContainer.right - thirdText.right)).assertEqual(vp2px(30));
expect(Math.round(thirdText.bottom - flexContainer.bottom)).assertEqual(vp2px(30));
console.info('[testWrapNoWrapFlexPadTextPad] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXWRAP_NOWRAP_0900
* @tc.name testWrapNoWrapFlexPadTextMargin
* @tc.desc The size of the parent component in the main axis direction is not enough for the layout
* of the child components when the parent component set padding and the child components set margin
*/
it('testWrapNoWrapFlexPadTextMargin', 0, async function (done) {
console.info('[testWrapNoWrapFlexPadTextMargin] START');
globalThis.value.message.notify({name:'firstTextMargin', value:20});
globalThis.value.message.notify({name:'flexPadding', value:20});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('NoWrap_FlexPad_TextMarPad1');
let secondText = CommonFunc.getComponentRect('NoWrap_FlexPad_TextMarPad2');
let thirdText = CommonFunc.getComponentRect('NoWrap_FlexPad_TextMarPad3');
let flexContainer = CommonFunc.getComponentRect('FlexNoWrap_FlexPad_TextMarPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexNoWrap_FlexPad_TextMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(Math.round(firstText.top - flexContainer.top)).assertEqual(vp2px(40));
expect(secondText.top).assertEqual(thirdText.top);
expect(Math.round(firstText.bottom - firstText.top)).assertEqual(vp2px(100));
expect(Math.round(secondText.bottom - secondText.top)).assertEqual(vp2px(150));
expect(Math.round(thirdText.bottom - thirdText.top)).assertEqual(vp2px(200));
expect(Math.round(firstText.left - flexContainer.left)).assertEqual(vp2px(40));
expect(Math.round(secondText.left - firstText.right)).assertEqual(vp2px(20));
expect(secondText.right).assertEqual(thirdText.left);
expect(Math.round(firstText.right - firstText.left)).assertEqual(vp2px(140)); // 420/3
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(secondText.right - secondText.left));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(thirdText.right - thirdText.left));
expect(Math.round(flexContainer.right - thirdText.right)).assertEqual(vp2px(20));
expect(Math.round(thirdText.bottom - flexContainer.bottom)).assertEqual(vp2px(20));
console.info('[testWrapNoWrapFlexPadTextMargin] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXWRAP_NOWRAP_1000
* @tc.name testWrapNoWrapFlexPadTextMarPad
* @tc.desc The size of the parent component in the main axis direction is not enough for the layout
* of the child components when all of components set padding and margin
*/
it('testWrapNoWrapFlexPadTextMarPad', 0, async function (done) {
console.info('[testWrapNoWrapFlexPadTextMarPad] START');
globalThis.value.message.notify({name:'firstTextMargin', value:10});
globalThis.value.message.notify({name:'secondTextMargin', value:10});
globalThis.value.message.notify({name:'thirdTextMargin', value:10});
globalThis.value.message.notify({name:'firstTextPadding', value:10});
globalThis.value.message.notify({name:'secondTextPadding', value:20});
globalThis.value.message.notify({name:'thirdTextPadding', value:30});
globalThis.value.message.notify({name:'flexPadding', value:30});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('NoWrap_FlexPad_TextMarPad1');
let secondText = CommonFunc.getComponentRect('NoWrap_FlexPad_TextMarPad2');
let thirdText = CommonFunc.getComponentRect('NoWrap_FlexPad_TextMarPad3');
let flexContainer = CommonFunc.getComponentRect('FlexNoWrap_FlexPad_TextMarPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexNoWrap_FlexPad_TextMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(Math.round(firstText.top - flexContainer.top)).assertEqual(vp2px(40));
expect(firstText.top).assertEqual(secondText.top);
expect(secondText.top).assertEqual(thirdText.top);
expect(Math.round(firstText.left - flexContainer.left)).assertEqual(vp2px(40));
expect(Math.round(secondText.left - firstText.right)).assertEqual(vp2px(20));
expect(Math.round(thirdText.left - secondText.right)).assertEqual(vp2px(20));
expect(Math.round(firstText.bottom - firstText.top)).assertEqual(vp2px(100));
expect(Math.round(secondText.bottom - secondText.top)).assertEqual(vp2px(150));
expect(Math.round(thirdText.bottom - thirdText.top)).assertEqual(vp2px(200));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(vp2px(380) / 3));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(secondText.right - secondText.left));
expect(Math.round(firstText.right - firstText.left)).assertEqual(Math.round(thirdText.right - thirdText.left));
expect(Math.round(flexContainer.right - thirdText.right)).assertEqual(vp2px(40));
expect(Math.round(thirdText.bottom - flexContainer.bottom)).assertEqual(vp2px(40));
console.info('[testWrapNoWrapFlexPadTextMarPad] 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录