Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2f0ca7d9
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,发现更多精彩内容 >>
未验证
提交
2f0ca7d9
编写于
3月 01, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7467 test:add flex_alignContent_SpaceBetween xts_acts testcase
Merge pull request !7467 from 李伟明/flex_aligncontent
上级
e9f91acf
f0668844
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
1371 addition
and
0 deletion
+1371
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexMar.ets
...t/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexMar.ets
+53
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexMarPad.ets
...paceBetween/Flex_AlignContent_SpaceBetween_FlexMarPad.ets
+57
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexPad.ets
...t/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexPad.ets
+52
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexSize.ets
.../SpaceBetween/Flex_AlignContent_SpaceBetween_FlexSize.ets
+55
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextMar.ets
...t/SpaceBetween/Flex_AlignContent_SpaceBetween_TextMar.ets
+56
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextOffset.ets
...paceBetween/Flex_AlignContent_SpaceBetween_TextOffset.ets
+56
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextSize.ets
.../SpaceBetween/Flex_AlignContent_SpaceBetween_TextSize.ets
+55
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextVisibility.ets
...Between/Flex_AlignContent_SpaceBetween_TextVisibility.ets
+56
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexMar.test.ets
...ceBeTween/Flex_AlignContent_SpaceBetween_FlexMar.test.ets
+88
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexMarPad.test.ets
...eTween/Flex_AlignContent_SpaceBetween_FlexMarPad.test.ets
+131
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexPad.test.ets
...ceBeTween/Flex_AlignContent_SpaceBetween_FlexPad.test.ets
+123
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexSize.test.ets
...eBeTween/Flex_AlignContent_SpaceBetween_FlexSize.test.ets
+127
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextMar.test.ets
...ceBeTween/Flex_AlignContent_SpaceBetween_TextMar.test.ets
+124
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextOffset.test.ets
...eTween/Flex_AlignContent_SpaceBetween_TextOffset.test.ets
+89
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextSize.test.ets
...eBeTween/Flex_AlignContent_SpaceBetween_TextSize.test.ets
+125
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextVisibility.test.ets
...en/Flex_AlignContent_SpaceBetween_TextVisibility.test.ets
+124
-0
未找到文件。
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexMar.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 FlexAlignContent_SpaceBetween_04{
@State testMargin: number = 0
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('FlexAlignContent_SpaceBetween_01 onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'margin') {
this.testMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween}){
Text('1').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_FlexMar01')
Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_FlexMar02')
Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_FlexMar03')
Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_FlexMar04')
}
.width(200)
.height(540)
.margin(this.testMargin)
.backgroundColor(0xAFEEEE)
.key('FlexAlign_SpaceBetween_FlexMar_Container01')
}
.width('100%')
.height('100%')
.key('Column_Align_SpaceBetween_FlexMar_Container01')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexMarPad.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 FlexAlignContent_SpaceBetween_03{
@State testPadding: number = 0;
@State testMargin: number = 0;
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('FlexAlignContent_SpaceBetween_01 onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'padding') {
this.testPadding = message.value;
}
if (message.name == 'margin') {
this.testMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween}){
Text('1').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_FlexMarPad01')
Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_FlexMarPad02')
Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_FlexMarPad03')
Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_FlexMarPad04')
}
.width(200)
.height(540)
.padding(this.testPadding)
.margin(this.testMargin)
.backgroundColor(0xAFEEEE)
.key('FlexAlign_SpaceBetween_FlexMarPad_Container01')
}
.width('100%')
.height('100%')
.key('Column_Align_SpaceBetween_FlexMarPad_Container01')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexPad.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 FlexAlignContent_SpaceBetween_02{
@State testPadding: number = 0
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('FlexAlignContent_SpaceBetween_01 onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'padding') {
this.testPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween}){
Text('1').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_FlexPad01')
Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_FlexPad02')
Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_FlexPad03')
Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_FlexPad04')
}
.width(200)
.height(540)
.padding(this.testPadding)
.backgroundColor(0xAFEEEE)
.key('FlexAlign_SpaceBetween_FlexPad_Container01')
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexSize.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 FlexAlignContent_SpaceBetween_01{
@State testWidth: number = 400
@State testHeight: number = 100
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('FlexAlignContent_SpaceBetween_01 onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'width') {
this.testWidth = message.value;
}
if (message.name == 'height') {
this.testHeight = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween}){
Text('1').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_FlexSize01')
Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_FlexSize02')
Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_FlexSize03')
Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_FlexSize04')
}
.width(this.testWidth)
.height(this.testHeight)
.backgroundColor(0xAFEEEE)
.key('FlexAlign_SpaceBetween_FlexSize_Container01')
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextMar.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 FlexAlignContent_SpaceBetween_04{
@State testMargin: number = 0
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('FlexAlignContent_SpaceBetween_01 onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'margin') {
this.testMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween}){
Text('1')
.width(150)
.height(50)
.backgroundColor(0xD2B48C)
.margin(this.testMargin)
.key('AlignContent_SpaceBetween_TextMar01')
Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_TextMar02')
Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_TextMar03')
Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_TextMar04')
}
.width(200)
.height(400)
.backgroundColor(0xAFEEEE)
.key('FlexAlign_SpaceBetween_TextMar_Container01')
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextOffset.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 FlexAlignContent_SpaceBetween_05{
@State testOffset: object = {x:0, y:0}
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('FlexAlignContent_SpaceBetween_01 onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'offset') {
this.testOffset = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween}){
Text('1')
.width(150)
.height(50)
.backgroundColor(0xD2B48C)
.offset(this.testOffset)
.key('AlignContent_SpaceBetween_TextOffset01')
Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_TextOffset02')
Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_TextOffset03')
Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_TextOffset04')
}
.width(200)
.height(400)
.backgroundColor(0xAFEEEE)
.key('FlexAlign_SpaceBetween_TextOffset_Container01')
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextSize.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 FlexAlignContent_SpaceBetween_06{
@State testHeight: number = 50
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('FlexAlignContent_SpaceBetween_01 onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'height') {
this.testHeight = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween}){
Text('1')
.width(150)
.height(this.testHeight)
.backgroundColor(0xD2B48C)
.key('AlignContent_SpaceBetween_TextSize01')
Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_TextSize02')
Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_TextSize03')
Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_TextSize04')
}
.width(200)
.height(400)
.backgroundColor(0xAFEEEE)
.key('FlexAlign_SpaceBetween_TextSize_Container01')
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextVisibility.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 FlexAlignContent_SpaceBetween_07{
@State testVisibility: number = Visibility.Visible
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('FlexAlignContent_SpaceBetween_01 onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'visibility') {
this.testVisibility = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build(){
Column({space:30}){
Flex({wrap:FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween}){
Text('1')
.width(150)
.height(50)
.backgroundColor(0xD2B48C)
.key('AlignContent_SpaceBetween_TextVisibility01')
.visibility(this.testVisibility)
Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_TextVisibility02')
Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceBetween_TextVisibility03')
Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceBetween_TextVisibility04')
}
.width(200)
.height(400)
.backgroundColor(0xAFEEEE)
.key('FlexAlign_SpaceBetween_TextVisibility_Container01')
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexMar.test.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 flex_AlignContent_SpaceBetween_FlexMarTest() {
describe('Flex_AlignContent_SpaceBetween_FlexMarTest', function () {
beforeEach(async function (done) {
console.info("Flex_AlignContent_SpaceBetween_FlexMar beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexMar',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_AlignContent_SpaceBetween_FlexMar state pages:" + JSON.stringify(pages));
if (!("Flex_AlignContent_SpaceBetween_FlexMar" == pages.name)) {
console.info("get Flex_AlignContent_SpaceBetween_FlexMar state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_AlignContent_SpaceBetween_FlexMar page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_AlignContent_SpaceBetween_FlexMar page error:" + err);
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Flex_AlignContent_SpaceBetween_FlexMarTest after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0100
* @tc.name alignContent_SpaceAround_FlexMargin
* @tc.desc The size of the parent component in the cross direction meets the layout
* of the child components when the height and width of parent component changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0100', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0100] START');
globalThis.value.message.notify({name:'margin', value:10})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMar01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMar02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMar03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMar04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_FlexMar_Container01');
let columnContainer = CommonFunc.getComponentRect('Column_Align_SpaceBetween_FlexMar_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_FlexMar_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(150));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(200)); //四个子组件的高度分别为50、100、150、200
expect(flexContainer.top - columnContainer.top).assertEqual(vp2px(10)); //margin =10
expect(firstText.left).assertEqual(flexContainer.left);
expect(firstText.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(fourthText.left).assertEqual(flexContainer.left);
expect(firstText.top).assertEqual(flexContainer.top);
expect(fourthText.bottom).assertEqual(flexContainer.bottom); //行首行尾贴边
expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom);
expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0100] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexMarPad.test.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 flex_AlignContent_SpaceBetween_FlexMarPadTest() {
describe('Flex_AlignContent_SpaceBetween_FlexMarPadTest', function () {
beforeEach(async function (done) {
console.info("Flex_AlignContent_SpaceBetween_FlexMarPad beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexMarPad',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_AlignContent_SpaceBetween_FlexMarPad state pages:" + JSON.stringify(pages));
if (!("Flex_AlignContent_SpaceBetween_FlexMarPad" == pages.name)) {
console.info("get Flex_AlignContent_SpaceBetween_FlexMarPad state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_AlignContent_SpaceBetween_FlexMarPad page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_AlignContent_SpaceBetween_FlexMarPad page error:" + err);
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Flex_AlignContent_SpaceBetween_FlexMarPadTest after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0200
* @tc.name alignContent_SpaceAround_FlexMarPad
* @tc.desc The size of the parent component in the cross direction is not enough for the layout
* of the child components when the padding and margin of parent component was changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0200', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0200] START');
globalThis.value.message.notify({name:'padding', value:50});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMarPad01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMarPad02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMarPad03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMarPad04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_FlexMarPad_Container01');
let columnContainer = CommonFunc.getComponentRect('Column_Align_SpaceBetween_FlexMarPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_FlexMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(150));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(200)); //四个子组件的高度分别为50、100、150、200
expect(flexContainer.top - columnContainer.left).assertEqual(vp2px(20)); //margin =20
expect(firstText.top - flexContainer.top).assertEqual(vp2px(50));
expect(firstText.left - flexContainer.left).assertEqual(vp2px(50)); //padding =50
expect(firstText.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(firstText.bottom).assertEqual(secondText.top);
expect(secondText.bottom).assertEqual(thirdText.top);
expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距
expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(10)); //行首贴边行尾溢出
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0200] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0300
* @tc.name alignContent_SpaceAround_FlexMarPad
* @tc.desc The size of the parent component in the cross direction meets the layout
* of the child components when the padding and margin of parent component was changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0300', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0300] START');
globalThis.value.message.notify({name:'margin', value:30})
globalThis.value.message.notify({name:'padding', value:10})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMarPad01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMarPad02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMarPad03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexMarPad04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_FlexMarPad_Container01');
let columnContainer = CommonFunc.getComponentRect('Column_Align_SpaceBetween_FlexMarPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_FlexMarPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(150));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(200)); //四个子组件的高度分别为50、100、150、200
expect(firstText.top - flexContainer.top).assertEqual(vp2px(10));
expect(firstText.left - flexContainer.left).assertEqual(vp2px(10)); //padding =10
expect(flexContainer.top - columnContainer.left).assertEqual(vp2px(30)); //margin =30
expect(firstText.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(flexContainer.bottom - fourthText.bottom).assertEqual(vp2px(10));
expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom);
expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0300] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexPad.test.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 flex_AlignContent_SpaceBetween_FlexPadTest() {
describe('Flex_AlignContent_SpaceBetween_FlexPadTest', function () {
beforeEach(async function (done) {
console.info("Flex_AlignContent_SpaceBetween_FlexPad beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexPad',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_AlignContent_SpaceBetween_FlexPad state pages:" + JSON.stringify(pages));
if (!("Flex_AlignContent_SpaceBetween_FlexPad" == pages.name)) {
console.info("get Flex_AlignContent_SpaceBetween_FlexPad state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_AlignContent_SpaceBetween_FlexPad page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_AlignContent_SpaceBetween_FlexPad page error:" + err);
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Flex_AlignContent_SpaceBetween_FlexPadTest after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0400
* @tc.name alignContent_SpaceAround_FlexPadding
* @tc.desc The size of the parent component in the cross direction is not enough for the layout
* of the child components when the padding and margin of parent component was changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0400', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0400] START');
globalThis.value.message.notify({name:'padding', value:50})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexPad01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexPad02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexPad03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexPad04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_FlexPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_FlexPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(150));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(200)); //四个子组件的高度分别为50、100、150、200
expect(firstText.top - flexContainer.top).assertEqual(vp2px(50)); //padding =50
expect(firstText.left - flexContainer.left).assertEqual(vp2px(50)); //padding =50
expect(firstText.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(firstText.bottom).assertEqual(secondText.top);
expect(secondText.bottom).assertEqual(thirdText.top);
expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距
expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(10)); //行首贴边行尾溢出
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0400] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0500
* @tc.name alignContent_SpaceAround_FlexPadding
* @tc.desc The size of the parent component in the cross direction meets the layout
* of the child components when the padding of parent component was changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0500', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0500] START');
globalThis.value.message.notify({name:'padding', value:10})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexPad01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexPad02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexPad03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexPad04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_FlexPad_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_FlexPad_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(150));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(200)); //四个子组件的高度分别为50、100、150、200
expect(firstText.left - flexContainer.left).assertEqual(vp2px(10)); //padding =10
expect(firstText.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(firstText.top - flexContainer.top).assertEqual(vp2px(10));
expect(flexContainer.bottom - fourthText.bottom).assertEqual(vp2px(10)); //行首偏移行尾未溢出
expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom);
expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0500] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexSize.test.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 flex_AlignContent_SpaceBetween_FlexSizeTest() {
describe('Flex_AlignContent_SpaceBetween_FlexSizeTest', function () {
beforeEach(async function (done) {
console.info("Flex_AlignContent_SpaceBetween_FlexSize beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexSize',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_AlignContent_SpaceBetween_FlexSize state pages:" + JSON.stringify(pages));
if (!("Flex_AlignContent_SpaceBetween_FlexSize" == pages.name)) {
console.info("get Flex_AlignContent_SpaceBetween_FlexSize state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_AlignContent_SpaceBetween_FlexSize page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_AlignContent_SpaceBetween_FlexSize page error:" + err);
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Flex_AlignContent_SpaceBetween_FlexSizeTest after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0600
* @tc.name alignContent_SpaceAround_FlexSize
* @tc.desc The size of the parent component in the cross direction meets the layout
* of the child components when the height and width of parent component changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0600', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0600] START');
globalThis.value.message.notify({name:'width', value:200})
globalThis.value.message.notify({name:'height', value:400})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexSize01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexSize02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexSize03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexSize04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_FlexSize_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_FlexSize_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100
expect(firstText.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(fourthText.left).assertEqual(flexContainer.left);
expect(firstText.top).assertEqual(flexContainer.top);
expect(fourthText.bottom).assertEqual(flexContainer.bottom); //行首行尾贴边
expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom);
expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0600] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0700
* @tc.name alignContent_SpaceAround_FlexSize
* @tc.desc The size of the parent component in the cross direction is not enough for the layout
* of the child components when the height and width of parent component changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0700', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0700] START');
globalThis.value.message.notify({name:'width', value:200})
globalThis.value.message.notify({name:'height', value:250})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexSize01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexSize02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexSize03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_FlexSize04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_FlexSize_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_FlexSize_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100
expect(firstText.top).assertEqual(flexContainer.top);
expect(firstText.bottom).assertEqual(secondText.top);
expect(secondText.bottom).assertEqual(thirdText.top);
expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距
expect(firstText.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(fourthText.left).assertEqual(flexContainer.left);
expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(50)); //行首贴边行尾溢出
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0700] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextMar.test.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 flex_AlignContent_SpaceBetween_TextMarTest() {
describe('Flex_AlignContent_SpaceBetween_TextMarTest', function () {
beforeEach(async function (done) {
console.info("Flex_AlignContent_SpaceBetween_TextMar beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextMar',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_AlignContent_SpaceBetween_TextMar state pages:" + JSON.stringify(pages));
if (!("Flex_AlignContent_SpaceBetween_TextMar" == pages.name)) {
console.info("get Flex_AlignContent_SpaceBetween_TextMar state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_AlignContent_SpaceBetween_TextMar page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_AlignContent_SpaceBetween_TextMar page error:" + err);
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Flex_AlignContent_SpaceBetween_TextMarTest after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0800
* @tc.name alignContent_SpaceAround_TextMargin
* @tc.desc The size of the parent component in the cross direction is not enough for the layout
* of the child components when the padding and margin of parent component was changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0800', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0800] START');
globalThis.value.message.notify({name:'margin', value:65})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextMar01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextMar02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextMar03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextMar04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_TextMar_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_TextMar_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100
expect(firstText.top - flexContainer.top).assertEqual(vp2px(65)); //margin =65
expect(firstText.left - flexContainer.left).assertEqual(vp2px(65)); //margin =65
expect(flexContainer.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(secondText.top - firstText.bottom).assertEqual(vp2px(65));
expect(secondText.bottom).assertEqual(thirdText.top);
expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距
expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(30)); //行首贴边行尾溢出
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0800] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0900
* @tc.name alignContent_SpaceAround_TextMargin
* @tc.desc The size of the parent component in the cross direction meets the layout
* of the child components when the padding of parent component was changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0900', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0900] START');
globalThis.value.message.notify({name:'margin', value:10})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextMar01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextMar02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextMar03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextMar04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_TextMar_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_TextMar_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100
expect(firstText.left - flexContainer.left).assertEqual(vp2px(10)); //margin =10
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(fourthText.left).assertEqual(flexContainer.left);
expect(firstText.top - flexContainer.top).assertEqual(vp2px(10));
expect(flexContainer.bottom).assertEqual(fourthText.bottom); //行首偏移行尾未溢出
expect(secondText.top - firstText.bottom - vp2px(10)).assertEqual(thirdText.top - secondText.bottom);
expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_0900] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextOffset.test.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 flex_AlignContent_SpaceBetween_TextOffsetTest() {
describe('Flex_AlignContent_SpaceBetween_TextOffsetTest', function () {
beforeEach(async function (done) {
console.info("Flex_AlignContent_SpaceBetween_TextOffset beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextOffset',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_AlignContent_SpaceBetween_TextOffset state pages:" + JSON.stringify(pages));
if (!("Flex_AlignContent_SpaceBetween_TextOffset" == pages.name)) {
console.info("get Flex_AlignContent_SpaceBetween_TextOffset state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_AlignContent_SpaceBetween_TextOffset page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_AlignContent_SpaceBetween_TextOffset page error:" + err);
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Flex_AlignContent_SpaceBetween_TextOffsetTest after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1000
* @tc.name alignContent_SpaceAround_TextOffset
* @tc.desc The size of the parent component in the cross direction is not enough for the layout
* of the child components when the padding and margin of parent component was changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1000', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1000] START');
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextOffset01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextOffset02');
let distanceBefore = secondText.top - firstText.bottom;
let secondTextTop = secondText.top - firstText.top;
globalThis.value.message.notify({name:'offset', value:{x:10, y:10}})
await CommonFunc.sleep(3000);
firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextOffset01');
secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextOffset02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextOffset03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextOffset04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_TextOffset_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_TextOffset_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(50));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100
expect(firstText.top - flexContainer.top).assertEqual(vp2px(10));
expect(firstText.left - flexContainer.left).assertEqual(vp2px(10)); //offset =10
expect(flexContainer.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(fourthText.bottom).assertEqual(flexContainer.bottom); //行首贴边行尾溢出
expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom);
expect(thirdText.top - secondText.bottom).assertEqual(distanceBefore);
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1000] END');//其余组件行间距相等,未改变
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextSize.test.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 flex_AlignContent_SpaceBetween_TextSizeTest() {
describe('Flex_AlignContent_SpaceBetween_TextSizeTest', function () {
beforeEach(async function (done) {
console.info("Flex_AlignContent_SpaceBetween_TextSize beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextSize',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_AlignContent_SpaceBetween_TextSize state pages:" + JSON.stringify(pages));
if (!("Flex_AlignContent_SpaceBetween_TextSize" == pages.name)) {
console.info("get Flex_AlignContent_SpaceBetween_TextSize state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_AlignContent_SpaceBetween_TextSize page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_AlignContent_SpaceBetween_TextSize page error:" + err);
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Flex_AlignContent_SpaceBetween_TextSizeTest after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1100
* @tc.name alignContent_SpaceAround_TextSize
* @tc.desc The size of the parent component in the cross direction meets the layout
* of the child components when the height and width of parent component changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1100', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1100] START');
globalThis.value.message.notify({name:'height', value:70})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextSize01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextSize02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextSize03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextSize04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_TextSize_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_TextSize_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(70));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为70、100、50、100
expect(firstText.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(fourthText.left).assertEqual(flexContainer.left);
expect(firstText.top).assertEqual(flexContainer.top);
expect(fourthText.bottom).assertEqual(flexContainer.bottom); //行首行尾贴边
expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom);
expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1100] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1200
* @tc.name alignContent_SpaceAround_TextSize
* @tc.desc The size of the parent component in the cross direction is not enough for the layout
* of the child components when the height and width of parent component changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1200', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1200] START');
globalThis.value.message.notify({name:'height', value:200})
await CommonFunc.sleep(3000);
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextSize01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextSize02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextSize03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextSize04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_TextSize_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_TextSize_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(firstText.bottom - firstText.top).assertEqual(vp2px(200));
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为200、100、50、100
expect(firstText.bottom).assertEqual(secondText.top);
expect(secondText.bottom).assertEqual(thirdText.top);
expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距
expect(firstText.left).assertEqual(secondText.left);
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(fourthText.left).assertEqual(flexContainer.left);
expect(firstText.top).assertEqual(flexContainer.top);
expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(50)); //行首贴边行尾溢出
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1200] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextVisibility.test.ets
0 → 100644
浏览文件 @
2f0ca7d9
/**
* 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 flex_AlignContent_SpaceBetween_TextVisibilityTest() {
describe('Flex_AlignContent_SpaceBetween_TextVisibilityTest', function () {
beforeEach(async function (done) {
console.info("Flex_AlignContent_SpaceBetween_TextVisibility beforeEach start");
let options = {
url: 'MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextVisibility',
}
try {
router.clear();
let pages = router.getState();
console.info("get Flex_AlignContent_SpaceBetween_TextVisibility state pages:" + JSON.stringify(pages));
if (!("Flex_AlignContent_SpaceBetween_TextVisibility" == pages.name)) {
console.info("get Flex_AlignContent_SpaceBetween_TextVisibility state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Flex_AlignContent_SpaceBetween_TextVisibility page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Flex_AlignContent_SpaceBetween_TextVisibility page error:" + err);
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'visibility', value:Visibility.Visible});
console.info("Flex_AlignContent_SpaceBetween_TextVisibilityTest after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1300
* @tc.name alignContent_SpaceAround_TextVisibility
* @tc.desc The size of the parent component in the cross direction meets the layout
* of the child components when the visibility of parent component was changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1300', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1300] START');
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility02');
let distanceBefore = secondText.top - firstText.bottom;
globalThis.value.message.notify({name:'visibility', value:Visibility.Hidden});
await CommonFunc.sleep(3000);
secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_TextVisibility_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_TextVisibility_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //三个子组件的高度分别为100、50、100
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(fourthText.left).assertEqual(flexContainer.left);
expect(secondText.top - flexContainer.top).assertEqual(distanceBefore + vp2px(50)); //text1占位
expect(fourthText.bottom).assertEqual(flexContainer.bottom); //行首行尾贴边
expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //剩余子组件行间距相等
expect(thirdText.top - secondText.bottom).assertEqual(distanceBefore);
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1300] END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1400
* @tc.name alignContent_SpaceAround_TextVisibility
* @tc.desc The size of the parent component in the cross direction meets the layout
* of the child components when the visibility of parent component was changed
*/
it('SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1400', 0, async function (done) {
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1400] START');
let firstText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility01');
let secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility02');
let distanceBefore = secondText.top - firstText.bottom;
globalThis.value.message.notify({name:'visibility', value:Visibility.None})
await CommonFunc.sleep(3000);
secondText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility02');
let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility03');
let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceBetween_TextVisibility04');
let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceBetween_TextVisibility_Container01');
let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceBetween_TextVisibility_Container01');
let flexContainerObj = JSON.parse(flexContainerStrJson);
expect(flexContainerObj.$type).assertEqual('Flex');
expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap');
expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceBetween');
expect(secondText.bottom - secondText.top).assertEqual(vp2px(100));
expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50));
expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //三个子组件的高度分别为100、50、100
expect(secondText.left).assertEqual(thirdText.left);
expect(thirdText.left).assertEqual(fourthText.left);
expect(fourthText.left).assertEqual(flexContainer.left);
expect(secondText.top).assertEqual(flexContainer.top); //text1不参与占位
expect(fourthText.bottom).assertEqual(flexContainer.bottom); //行首行尾贴边
expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //剩余子组件行间距相等
expect(thirdText.top - secondText.bottom).assertLarger(distanceBefore); //行距大于设置前
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1400] END');
done();
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录