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

!7455 add flex_justifyContent_SpaceBetween xts_acts testcase & pages

Merge pull request !7455 from 王闻天/justifyContent_SpaceBetween
/**
* 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 FlexAlign_SpaceBetween_fixedChild {
@State testHeight: number = 150
@State testWidth: number = 450
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedChild Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedChild page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'height') {
this.testHeight = message.value;
}
if (message.name == 'width') {
this.testWidth = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedChild page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween1').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween1')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween2')
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween3')
}
.key('FlexAlignSpaceBetween1')
.height(this.testHeight)
.width(this.testWidth)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd {
@State testHeight: number = 150
@State testWidth: number = 450
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'height') {
this.testHeight = message.value;
}
if (message.name == 'width') {
this.testWidth = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween8').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween22')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween23')
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween24')
}
.key('FlexAlignSpaceBetween8')
.height(this.testHeight)
.width(this.testWidth)
.align(Alignment.BottomEnd)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct FlexAlign_SpaceBetween_fixedChildParentMarPad {
@State testPadding: number = 10
@State testMargin: number = 10
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedChildParentMarPad Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedChildParentMarPad page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'padding') {
this.testPadding = message.value;
}
if (message.name == 'margin') {
this.testMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedChildParentMarPad page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween6').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween16')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween17')
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween18')
}
.key('FlexAlignSpaceBetween6')
.height(200)
.width(500)
.margin(this.testMargin)
.padding(this.testPadding)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct FlexAlign_SpaceBetween_fixedChildParentMargin {
@State testMargin: number = 0
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedChildParentMargin Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedChildParentMargin page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'margin') {
this.testMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedChildParentMargin page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween5').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween13')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween14')
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween15')
}
.key('FlexAlignSpaceBetween5')
.height(200)
.width(500)
.margin(this.testMargin)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct FlexAlign_SpaceBetween_fixedChildParentPadding {
@State testPadding: number = 0
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedChildParentPadding Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedChildParentPadding page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'padding') {
this.testPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedChildParentPadding page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween3').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween7')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween8')
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween9')
}
.key('FlexAlignSpaceBetween3')
.height(200)
.width(500)
.padding(this.testPadding)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct FlexAlign_SpaceBetween_fixedParent {
@State testOffsetX: number = 0
@State testOffsetY: number = 0
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedParent Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedParent page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'x') {
this.testOffsetX = message.value;
}
if (message.name == 'y') {
this.testOffsetY = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedParent page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween9').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween25')
.offset({ x: this.testOffsetX, y: this.testOffsetY })
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween26')
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween27')
}
.key('FlexAlignSpaceBetween9')
.height(200)
.width(500)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct FlexAlign_SpaceBetween_fixedParentChangeFirst {
@State testFirstlayoutWeight: number = 0
@State testSecondlayoutWeight: number = 0
@State testThirdlayoutWeight: number = 0
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedParentChangeFirst Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedParentChangeFirst page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'testFirstlayoutWeight') {
this.testFirstlayoutWeight = message.value;
}
if (message.name == 'testSecondlayoutWeight') {
this.testSecondlayoutWeight = message.value;
}
if (message.name == 'testThirdlayoutWeight') {
this.testThirdlayoutWeight = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedParentChangeFirst page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween12').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween34')
.layoutWeight(this.testFirstlayoutWeight)
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween35')
.layoutWeight(this.testSecondlayoutWeight)
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween36')
.layoutWeight(this.testThirdlayoutWeight)
}
.key('FlexAlignSpaceBetween12')
.height(200)
.width(500)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct FlexAlign_SpaceBetween_fixedParentChangeFirstWidth {
@State testWidth: number = 150
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedParentChangeFirstWidth Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedParentChangeFirstWidth page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'width') {
this.testWidth = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedParentChangeFirstWidth page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween13').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(this.testWidth).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween37')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween38')
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween39')
}
.key('FlexAlignSpaceBetween13')
.height(200)
.width(500)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct FlexAlign_SpaceBetween_fixedParentMarginFirst {
@State testMargin: number = 0
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedParentMarginFirst Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedParentMarginFirst page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'margin') {
this.testMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedParentMarginFirst page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween14').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween40').margin(this.testMargin)
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween41')
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween42')
}
.key('FlexAlignSpaceBetween14')
.height(200)
.width(500)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../../common/MessageManager';
@Entry
@Component
struct FlexAlign_SpaceBetween_fixedParentVisibility {
@State testVisibility: number = Visibility.Visible
messageManager:MessageManager = new MessageManager()
private content: string = "FlexAlign_SpaceBetween_fixedParentVisibility Page"
onPageShow() {
console.info('FlexAlign_SpaceBetween_fixedParentVisibility page show called');
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);
}
onBuildDone() {
console.info('FlexAlign_SpaceBetween_fixedParentVisibility page build done called');
}
build() {
Column() {
Text('justifyContent:Align_SpaceBetween9').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignSpaceBetween28')
.visibility(this.testVisibility)
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignSpaceBetween29')
Text('3').width(150).height(150).backgroundColor(0xffa500).key('AlignSpaceBetween30')
}
.key('FlexAlignSpaceBetween10')
.height(200)
.width(500)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedChild() {
describe('FlexAlign_SpaceBetween_fixedChild', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedChild beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedChild',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedChild state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedChild" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedChild state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedChild page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedChild page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedChild afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_0100
* @tc.name testAlignSpaceBetweenRowNoWrapParentWidthAndHeightOutRange
* @tc.desc The child component is fixed, and parent component is bound with width and height attributes,
* the layout space of parent is insufficient to meet the spindle layout requirements of child
*/
it('testAlignSpaceBetweenRowNoWrapParentWidthAndHeightOutRange', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapParentWidthAndHeightOutRange START');
globalThis.value.message.notify({name:'height', value:200})
globalThis.value.message.notify({name:'width', value:400})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween1');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween2');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween3');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween1');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(locationText1.top).assertEqual(locationFlex.top);
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(locationText1.left).assertEqual(locationFlex.left);
expect(locationText1.right).assertEqual(locationText2.left);
expect(locationText2.right).assertEqual(locationText3.left);
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(Math.round(vp2px(400/3)));
console.info('new testAlignSpaceBetweenRowNoWrapParentWidthAndHeightOutRange END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_0200
* @tc.name testAlignSpaceBetweenRowNoWrapParentWidthAndHeightInRange
* @tc.desc The child component is fixed, and parent component is bound with width and height attributes,
* the layout space of parent meets the spindle layout requirements of child
*/
it('testAlignSpaceBetweenRowNoWrapParentWidthAndHeightInRange', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapParentWidthAndHeightInRange START');
globalThis.value.message.notify({name:'height', value:200})
globalThis.value.message.notify({name:'width', value:500})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween1');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween2');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween3');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween1');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(locationText1.top).assertEqual(locationFlex.top);
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(locationText1.left).assertEqual(locationFlex.left);
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round(locationText2.left - locationText1.right))
.assertEqual(Math.round(locationText3.left - locationText2.right));
expect(Math.round((locationText2.left - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
console.info('new testAlignSpaceBetweenRowNoWrapParentWidthAndHeightInRange END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedChildParentItemAlignEnd() {
describe('FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedChildParentItemAlignEnd afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_0800
* @tc.name testAlignSpaceBetweenRowNoWrapAlignmentBottomEnd
* @tc.desc The child component is fixed, and the parent component is bound with Alignment.BottomEnd attributes
*/
it('testAlignSpaceBetweenRowNoWrapAlignmentBottomEnd', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapAlignmentBottomEnd START');
globalThis.value.message.notify({name:'height', value:200})
globalThis.value.message.notify({name:'width', value:500})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween8');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween22');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween23');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween24');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween8');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(0));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(locationText1.left).assertEqual(locationFlex.left);
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round(locationText2.left - locationText1.right))
.assertEqual(Math.round(locationText3.left - locationText2.right));
expect(Math.round((locationText2.left - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
console.info('new testAlignSpaceBetweenRowNoWrapAlignmentBottomEnd END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedChildParentMarPad() {
describe('FlexAlign_SpaceBetween_fixedChildParentMarPad', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedChildParentMarPad beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedChildParentMarPad',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedChildParentMarPad state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedChildParentMarPad" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedChildParentMarPad state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedChildParentMarPad page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedChildParentMarPad page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedChildParentMarPad afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_0600
* @tc.name testAlignSpaceBetweenRowNoWrapMarPadOutRange
* @tc.desc The child component is fixed, and parent component is bound with padding and margin attributes,
* the layout space of parent is insufficient to meet the spindle layout requirements of child
*/
it('testAlignSpaceBetweenRowNoWrapMarPadOutRange', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapMarPadOutRange START');
globalThis.value.message.notify({name:'margin', value:20})
globalThis.value.message.notify({name:'padding', value:50})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween6');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween16');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween17');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween18');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween6');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(50));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(locationFlex.bottom).assertEqual(locationText3.bottom);
expect(Math.round(locationText1.left - locationFlex.left)).assertEqual(vp2px(50));
expect(locationText1.right).assertEqual(locationText2.left);
expect(locationText2.right).assertEqual(locationText3.left);
expect(locationText3.right).assertEqual(Math.round(locationFlex.right - vp2px(50)));
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(Math.round(vp2px(400/3)));
console.info('new testAlignSpaceBetweenRowNoWrapMarPadOutRange END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_0700
* @tc.name testAlignSpaceBetweenRowNoWrapMarPadInRange
* @tc.desc The child component is fixed, and parent component is bound with padding and margin attributes,
* the layout space of parent component meets the spindle layout requirements of child component
*/
it('testAlignSpaceBetweenRowNoWrapMarPadInRange', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapMarPadInRange START');
globalThis.value.message.notify({name:'margin', value:20})
globalThis.value.message.notify({name:'padding', value:5})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween6');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween16');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween17');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween18');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween6');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round((locationText1.top - locationFlex.top)*10)/10).assertEqual(Math.round(vp2px(5)*10)/10);
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round((locationFlex.bottom - locationText3.bottom)*10)/10).assertEqual(Math.round(vp2px(45)*10)/10);
expect(Math.round((locationText1.left - locationFlex.left)*10)/10).assertEqual(Math.round(vp2px(5)*10)/10);
expect(Math.round((locationText3.right)*10)/10).assertEqual(Math.round((locationFlex.right - vp2px(5))*10)/10);
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round(locationText2.left - locationText1.right))
.assertEqual(Math.round(locationText3.left - locationText2.right));
expect(Math.round(locationText2.left - locationText1.right)).assertEqual(vp2px(20));
console.info('new testAlignSpaceBetweenRowNoWrapMarPadInRange END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedChildParentMargin() {
describe('FlexAlign_SpaceBetween_fixedChildParentMargin', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedChildParentMargin beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedChildParentMargin',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedChildParentMargin state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedChildParentMargin" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedChildParentMargin pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedChildParentMargin page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedChildParentMargin page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedChildParentMargin afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_0500
* @tc.name testAlignSpaceBetweenRowNoWrapMargin
* @tc.desc The child component is fixed, and the parent component is bound with margin attributes
*/
it('testAlignSpaceBetweenRowNoWrapMargin', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapMargin START');
globalThis.value.message.notify({name:'margin', value:20})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween5');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween13');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween14');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween15');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween5');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(locationText1.top).assertEqual(locationFlex.top);
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(locationText1.left).assertEqual(locationFlex.left);
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round(locationText2.left - locationText1.right))
.assertEqual(Math.round(locationText3.left - locationText2.right));
expect(Math.round((locationText2.left - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
console.info('new testAlignSpaceBetweenRowNoWrapMargin END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedChildParentPadding() {
describe('FlexAlign_SpaceBetween_fixedChildParentPadding', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedChildParentPadding beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedChildParentPadding',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedChildParentPadding state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedChildParentPadding" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedChildParentPadding pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedChildParentPadding page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedChildParentPadding page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedChildParentPadding afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_0300
* @tc.name testAlignSpaceBetweenRowNoWrapPaddingOutRange
* @tc.desc The child component is fixed, and parent component is bound with padding attributes, the layout
* space of parent component is insufficient to meet the spindle layout requirements of child component
*/
it('testAlignSpaceBetweenRowNoWrapPaddingOutRange', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapPaddingOutRange START');
globalThis.value.message.notify({name:'padding', value:50})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween3');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween7');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween8');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween9');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween3');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(50));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(locationFlex.bottom).assertEqual(locationText3.bottom);
expect(Math.round(locationText1.left - locationFlex.left)).assertEqual(vp2px(50));
expect(locationText1.right).assertEqual(locationText2.left);
expect(locationText2.right).assertEqual(locationText3.left);
expect(Math.round(locationFlex.right - locationText3.right)).assertEqual(vp2px(50));
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(Math.round(vp2px(400/3)));
console.info('new testAlignSpaceBetweenRowNoWrapPaddingOutRange END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_0400
* @tc.name testAlignSpaceBetweenRowNoWrapPaddingInRange
* @tc.desc The child component is fixed, and parent component is bound with padding attributes, the layout
* space of parent component meets the spindle layout requirements of the child component
*/
it('testAlignSpaceBetweenRowNoWrapPaddingInRange', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapPaddingInRange START');
globalThis.value.message.notify({name:'padding', value:5})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween3');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween7');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween8');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween9');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween3');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round((locationText1.top - locationFlex.top)*10)/10).assertEqual(Math.round(vp2px(5)*10)/10);
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round((locationFlex.bottom - locationText3.bottom)*10)/10).assertEqual(Math.round(vp2px(45)*10)/10);
expect(Math.round((locationText1.left - locationFlex.left)*10)/10).assertEqual(Math.round(vp2px(5)*10)/10);
expect(Math.round((locationText3.right)*10)/10).assertEqual(Math.round((locationFlex.right - vp2px(5))*10)/10);
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round(locationText2.left - locationText1.right))
.assertEqual(Math.round(locationText3.left - locationText2.right));
expect(Math.round(locationText2.left - locationText1.right)).assertEqual(vp2px(20));
console.info('new testAlignSpaceBetweenRowNoWrapPaddingInRange END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedParent() {
describe('FlexAlign_SpaceBetween_fixedParent', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedParent beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedParent',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedParent state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedParent" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedParent state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedParent page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedParent page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedParent afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_0900
* @tc.name testAlignSpaceBetweenRowNoWrapOffset
* @tc.desc Parent component fixed, child component binding offset properties
*/
it('testAlignSpaceBetweenRowNoWrapOffset', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapOffset START');
globalThis.value.message.notify({name:'x', value:15})
globalThis.value.message.notify({name:'y', value:30})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween9');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let strJson2 = getInspectorByKey('AlignSpaceBetween25');
let obj2 = JSON.parse(strJson2);
expect(obj2.$attrs.visibility).assertEqual('Visibility.Visible');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween25');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween26');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween27');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween9');
expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(30))
expect(Math.round((locationText1.left - locationFlex.left)*10)/10).assertEqual(Math.round(vp2px(15)*10)/10)
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText3.top - locationFlex.top)).assertEqual(vp2px(0));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round((locationText2.left - locationText1.right + vp2px(15))*10)/10)
.assertEqual(Math.round((locationText3.left - locationText2.right)*10)/10);
expect(Math.round((locationText3.left - locationText2.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
console.info('new testAlignSpaceBetweenRowNoWrapOffset END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedParentChangeFirst() {
describe('FlexAlign_SpaceBetween_fixedParentChangeFirst', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedParentChangeFirst beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedParentChangeFirst',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedParentChangeFirst state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedParentChangeFirst" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedParentChangeFirst state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedParentChangeFirst page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedParentChangeFirst page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedParentChangeFirst afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_1200
* @tc.name testAlignSpaceBetweenRowNoWrapChangeFirstLayoutWeight122
* @tc.desc Parent component fixed, child component binding layoutWeight first1 second2 third2 properties
*/
it('testAlignSpaceBetweenRowNoWrapChangeFirstLayoutWeight122', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapChangeFirstLayoutWeight122 START');
globalThis.value.message.notify({name:'testFirstlayoutWeight', value:1})
globalThis.value.message.notify({name:'testSecondlayoutWeight', value:2})
globalThis.value.message.notify({name:'testThirdlayoutWeight', value:2})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween12');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween34');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween35');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween36');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween12');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(0));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(Math.round(locationText1.left - locationFlex.left)).assertEqual(vp2px(0));
expect(locationText1.right).assertEqual(locationText2.left);
expect(locationText2.right).assertEqual(locationText3.left);
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(100));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(200));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(200));
console.info('new testAlignSpaceBetweenRowNoWrapChangeFirstLayoutWeight122 END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_1600
* @tc.name testAlignSpaceBetweenRowNoWrapChangeFirstLayoutWeight120
* @tc.desc Parent component fixed, child component binding layoutWeight first1 second2 third0 properties
*/
it('testAlignSpaceBetweenRowNoWrapChangeFirstLayoutWeight120', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapChangeFirstLayoutWeight120 START');
globalThis.value.message.notify({name:'testFirstlayoutWeight', value:1})
globalThis.value.message.notify({name:'testSecondlayoutWeight', value:2})
globalThis.value.message.notify({name:'testThirdlayoutWeight', value:0})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween12');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween34');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween35');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween36');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween12');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(0));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(Math.round(locationText1.left - locationFlex.left)).assertEqual(vp2px(0));
expect(locationText1.right).assertEqual(locationText2.left);
expect(locationText2.right).assertEqual(locationText3.left);
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round((locationText1.right - locationText1.left)*10)/10).assertEqual(Math.round(vp2px(350/3)*10)/10);
expect(Math.round((locationText2.right - locationText2.left)*10)/10).assertEqual(Math.round(vp2px(700/3)*10)/10);
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(150));
console.info('new testAlignSpaceBetweenRowNoWrapChangeFirstLayoutWeight120 END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedParentChangeFirstWidth() {
describe('FlexAlign_SpaceBetween_fixedParentChangeFirstWidth', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedParentChangeFirstWidth beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedParentChangeFirstWidth',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedParentChangeFirstWidth state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedParentChangeFirstWidth" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedParentChangeFirstWidth pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedParentChangeFirstWidth page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedParentChangeFirstWidth page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedParentChangeFirstWidth afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_1300
* @tc.name testAlignSpaceBetweenRowNoWrapChangeFirstWidth
* @tc.desc Parent component fixed, child component binding width properties
*/
it('testAlignSpaceBetweenRowNoWrapChangeFirstWidth', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapChangeFirstWidth START');
globalThis.value.message.notify({name:'width', value:175})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween13');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween37');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween38');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween39');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween13');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(0));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(Math.round(locationText1.left - locationFlex.left)).assertEqual(vp2px(0));
expect(Math.round(locationText2.left - locationText1.right))
.assertEqual(Math.round(locationText3.left - locationText2.right));
expect(Math.round((locationText2.left - locationText1.right)*100)/100)
.assertEqual(Math.round((vp2px(12.5))*100)/100);
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round((locationText1.right - locationText1.left)*10)/10).assertEqual(Math.round(vp2px(175)*10)/10);
console.info('new testAlignSpaceBetweenRowNoWrapChangeFirstWidth END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedParentMarginFirst() {
describe('FlexAlign_SpaceBetween_fixedParentMarginFirst', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedParentMarginFirst beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedParentMarginFirst',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedParentMarginFirst state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedParentMarginFirst" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedParentMarginFirst state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedParentMarginFirst page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedParentMarginFirst page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedParentMarginFirst afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_1400
* @tc.name testAlignSpaceBetweenRowNoWrapMarginFirstInRange
* @tc.desc Parent component fixed, child component binding margin properties, the layout space of the parent
* component meets the spindle layout requirements of the child component
*/
it('testAlignSpaceBetweenRowNoWrapMarginFirstInRange', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapMarginFirstInRange START');
globalThis.value.message.notify({name:'margin', value:20})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween14');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween40');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween41');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween42');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween14');
expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(20))
expect(Math.round(locationText1.left - locationFlex.left)).assertEqual(vp2px(20))
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText3.top - locationFlex.top)).assertEqual(vp2px(0));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round((locationText2.left - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round((locationText3.left - locationText2.right)*10)/10).assertEqual(Math.round(vp2px(5)*10)/10);
console.info('new testAlignSpaceBetweenRowNoWrapMarginFirstInRange END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_1500
* @tc.name testAlignSpaceBetweenRowNoWrapMarginFirstOutRange
* @tc.desc Parent component fixed, child component binding margin properties, the layout space of the parent
* component is insufficient to meet the spindle layout requirements of the child component
*/
it('testAlignSpaceBetweenRowNoWrapMarginFirstOutRange', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapMarginFirstOutRange START');
globalThis.value.message.notify({name:'margin', value:50})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween14');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween40');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween41');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween42');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween14');
expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(Math.round(vp2px(50)));
expect(Math.round(locationText1.left - locationFlex.left)).assertEqual(Math.round(vp2px(50)));
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText3.top - locationFlex.top)).assertEqual(vp2px(0));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(locationText2.right).assertEqual(locationText3.left);
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(Math.round(vp2px(400/3)));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(Math.round(vp2px(400/3)));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(Math.round(vp2px(400/3)));
expect(Math.round(locationText2.left - locationText1.right)).assertEqual(Math.round(vp2px(50)));
console.info('new testAlignSpaceBetweenRowNoWrapMarginFirstOutRange END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../../MainAbility/common/MessageManager';
export default function flexAlign_SpaceBetween_fixedParentVisibility() {
describe('FlexAlign_SpaceBetween_fixedParentVisibility', function () {
beforeEach(async function (done) {
console.info("FlexAlign_SpaceBetween_fixedParentVisibility beforeEach called");
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/SpaceBetween/FlexAlign_SpaceBetween_fixedParentVisibility',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get FlexAlign_SpaceBetween_fixedParentVisibility state pages:" + JSON.stringify(pages));
if (!("FlexAlign_SpaceBetween_fixedParentVisibility" == pages.name)) {
console.info("get FlexAlign_SpaceBetween_fixedParentVisibility state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push FlexAlign_SpaceBetween_fixedParentVisibility page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push FlexAlign_SpaceBetween_fixedParentVisibility page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("FlexAlign_SpaceBetween_fixedParentVisibility afterEach called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_1000
* @tc.name testAlignSpaceBetweenRowNoWrapVisibilityNone
* @tc.desc Parent component fixed, child component binding visibility none properties
*/
it('testAlignSpaceBetweenRowNoWrapVisibilityNone', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapVisibilityNone START');
globalThis.value.message.notify({name:'visibility', value:Visibility.None})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween10');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let strJson2 = getInspectorByKey('AlignSpaceBetween28');
let obj2 = JSON.parse(strJson2);
expect(obj2.$attrs.visibility).assertEqual('Visibility.None');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween28');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween29');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween30');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween10');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(Math.round(locationText2.top - locationFlex.top)).assertEqual(vp2px(0));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(0));
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round(locationText3.left - locationText2.right)).assertEqual(vp2px(200));
console.info('new testAlignSpaceBetweenRowNoWrapVisibilityNone END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEBETWEEN_TEST_1100
* @tc.name testAlignSpaceBetweenRowNoWrapVisibilityHidden
* @tc.desc Parent component fixed, child component binding visibility hidden properties
*/
it('testAlignSpaceBetweenRowNoWrapVisibilityHidden', 0, async function (done) {
console.info('new testAlignSpaceBetweenRowNoWrapVisibilityHidden START');
globalThis.value.message.notify({name:'visibility', value:Visibility.Hidden})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('FlexAlignSpaceBetween10');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
let strJson2 = getInspectorByKey('AlignSpaceBetween28');
let obj2 = JSON.parse(strJson2);
expect(obj2.$attrs.visibility).assertEqual('Visibility.Hidden');
let locationText1 = CommonFunc.getComponentRect('AlignSpaceBetween28');
let locationText2 = CommonFunc.getComponentRect('AlignSpaceBetween29');
let locationText3 = CommonFunc.getComponentRect('AlignSpaceBetween30');
let locationFlex = CommonFunc.getComponentRect('FlexAlignSpaceBetween10');
expect(locationText1.top).assertEqual(locationText2.top);
expect(locationText2.top).assertEqual(locationText3.top);
expect(locationText1.top).assertEqual(locationFlex.top);
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50));
expect(locationText1.left).assertEqual(locationFlex.left);
expect(locationText3.right).assertEqual(locationFlex.right);
expect(Math.round(locationText1.right - locationText1.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText3.right - locationText3.left))
.assertEqual(Math.round(locationText2.right - locationText2.left));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150));
expect(Math.round(locationText2.left - locationText1.right))
.assertEqual(Math.round(locationText3.left - locationText2.right));
expect(Math.round((locationText2.left - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
console.info('new testAlignSpaceBetweenRowNoWrapVisibilityHidden 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.
先完成此消息的编辑!
想要评论请 注册