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

!7471 test:add flex_alignContent_End xts_act testcase

Merge pull request !7471 from zmshij/flexEnd
/*
* 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 AlignContentFlex_End {
@State flexHeight: number = 300;
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignContentFlex 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.flexHeight = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column() {
Text('AlignContentFlex_End').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
alignContent: FlexAlign.End,
alignItems: ItemAlign.Start
}) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContentFlexEnd_flex001_1')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContentFlexEnd_flex001_2')
Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContentFlexEnd_flex001_3')
Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContentFlexEnd_flex001_4')
}
.key('AlignContentFlexEnd_flex001')
.width(400)
.height(this.flexHeight)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
/*
* 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 AlignContent_End_FlexP_Fixed_Margin {
@State textMargin: number = 5;
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignContentFlex 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.textMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column() {
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
alignContent: FlexAlign.End,
alignItems: ItemAlign.Start
}) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContent_End_FlexP_Fixed_Margin_1')
.margin(this.textMargin)
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContent_End_FlexP_Fixed_Margin_2')
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key('AlignContent_End_FlexP_Fixed_Margin_3')
Text('4').width(150).height(200).backgroundColor(0xD2B48C).key('AlignContent_End_FlexP_Fixed_Margin_4')
}
.key('AlignContent_End_FlexP_Fixed_Margin_flex001')
.width(500)
.height(400)
.backgroundColor(0xAFEEEE)
}
.width('100%')
.alignItems(HorizontalAlign.Start)
}
}
/*
* 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.
*/
@Entry
@Component
struct AlignContent_End_FlexP_Fixed_Offset {
alignContent: number
build() {
Column() {
Text('AlignContent_End_FlexP_Fixed_Offset').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
alignContent: FlexAlign.End,
alignItems: ItemAlign.Start
}) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContent_End_FlexP_Fixed_Offset_1')
.offset({ x: 15, y: 30 })
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContent_End_FlexP_Fixed_Offset_2')
Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContent_End_FlexP_Fixed_Offset_3')
Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContent_End_FlexP_Fixed_Offset_4')
}
.key('AlignContent_End_FlexP_Fixed_Offset_flex001')
.width(500)
.height(400)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
/*
* 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 AlignContent_End_FlexP_Fixed_Visibility {
@State textVisibility : number = Visibility.Visible;
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('AlignContentFlex 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.textVisibility = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column() {
Text('AlignContent_End_FlexP_Fixed_Visibility').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
alignContent: FlexAlign.End,
alignItems: ItemAlign.Start
}) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContent_End_FlexP_Fixed_Visibility_1')
.visibility(this.textVisibility)
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContent_End_FlexP_Fixed_Visibility_2')
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key('AlignContent_End_FlexP_Fixed_Visibility_3')
Text('4').width(150).height(200).backgroundColor(0xD2B48C).key('AlignContent_End_FlexP_Fixed_Visibility_4')
}
.key('AlignContent_End_FlexP_Fixed_Visibility_flex001')
.width(500)
.height(400)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
/*
* 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 AlignContent_End_FlexP_fixed {
@State textHeight: number = 50;
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignContentFlex 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.textHeight = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column() {
Text('AlignContent_End_FlexP_fixed').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
alignContent: FlexAlign.End,
alignItems: ItemAlign.Start
}) {
Text('1').width(150).height(this.textHeight).backgroundColor(0xF5DEB3).key('AlignContentFlexEndP_fixed_1')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContentFlexEndP_fixed_2')
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key('AlignContentFlexEndP_fixed_3')
Text('4').width(150).height(200).backgroundColor(0xD2B48C).key('AlignContentFlexEndP_fixed_4')
}
.key('AlignContentFlexEndP_fixed_flex001')
.width(500)
.height(400)
.backgroundColor(0xAFEEEE)
}.width('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct AlignContent_FlexAlign_End_Margin {
build() {
Column() {
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
alignContent: FlexAlign.End,
alignItems: ItemAlign.Start
}) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContentFlexEndMargin_flex_1')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContentFlexEndMargin_flex_2')
Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContentFlexEndMargin_flex_3')
Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContentFlexEndMargin_flex_4')
}
.key('AlignContentFlexEndMargin_flex')
.size({ width: 400, height: 360 })
.backgroundColor(0xAFEEEE)
.margin(15)
}
.width('100%')
.alignItems(HorizontalAlign.Start)
.key('AlignContentFlexEndMargin_Column')
}
}
/*
* 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 AlignContent_FlexAlign_End_Margin_padding {
@State flexPadding: number = 10;
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignContentFlex 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.flexPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column() {
Column(){
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
alignContent: FlexAlign.End,
alignItems: ItemAlign.Start
}) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3)
.key('AlignContentFlexEndMargin&padding_flex001_1')
Text('2').width(150).height(100).backgroundColor(0xD2B48C)
.key('AlignContentFlexEndMargin&padding_flex001_2')
Text('3').width(150).height(150).backgroundColor(0xD2B48C)
.key('AlignContentFlexEndMargin&padding_flex001_3')
Text('4').width(150).height(200).backgroundColor(0xF5DEB3)
.key('AlignContentFlexEndMargin&padding_flex001_4')
}
.key('AlignContentFlexEndMargin&padding_flex001')
.width(400)
.height(360)
.backgroundColor(0xAFEEEE)
.margin(10)
.padding(this.flexPadding)
}.key('AlignContentFlexEndMargin&padding_Column_1')
}
.width('100%')
.alignItems(HorizontalAlign.Start)
.key('AlignContentFlexEndMargin&padding_Column')
}
}
/*
* 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 AlignContent_FlexAlign_End_padding {
@State flexPadding: number = 10;
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignContentFlex 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.flexPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column() {
Text('AlignContent_FlexAlign_End_padding').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
alignContent: FlexAlign.End,
alignItems: ItemAlign.Start
}) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContentFlexEndPadding_flex001_1')
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContentFlexEndPadding_flex001_2')
Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContentFlexEndPadding_flex001_3')
Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContentFlexEndPadding_flex001_4')
}
.key('AlignContentFlexEndPadding_flex001')
.width(400)
.height(360)
.backgroundColor(0xAFEEEE)
.padding(this.flexPadding)
}.width('100%')
}
}
/*
* 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 AlignContentFlex_End() {
describe('AlignContentFlex_End', function () {
beforeEach(async function (done) {
console.info("AlignContentFlex_End beforeEach start");
let options = {
uri: 'MainAbility/pages/Flex/alignContent/End/AlignContentFlex_End',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get AlignContentFlex_End state success " + JSON.stringify(pages));
if (!("AlignContentFlex_End" == pages.name)) {
console.info("get AlignContentFlex_End state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push AlignContentFlex_End page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignContentFlex_End page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000)
console.info("AlignContentFlex_End beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000)
console.info("AlignContentFlex_End after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_0100
* @tc.name testAlignContentEndFlexHeightSatisfy
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End to set the height of the
* Flex component to meet the height requirements of the subcomponent.
*/
it('testAlignContentEndFlexHeightSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexHeightSatisfy START');
globalThis.value.message.notify({ name:'height', value:360 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContentFlexEnd_flex001');
let obj = JSON.parse(strJson);
console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj));
console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor));
let AlignContentFlexEnd_flex001 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001_4');
console.log('AlignContentFlexEnd_flex001 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex001));
console.log('AlignContentFlexEnd_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEnd_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(AlignContentFlexEnd_flex001.bottom ).assertEqual(AlignContentFlexEnd_4.bottom);
expect(Math.round(AlignContentFlexEnd_2.top - AlignContentFlexEnd_flex001.top )).assertEqual(vp2px(60));
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_2.bottom);
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
console.info('testAlignContentEndFlexHeightSatisfy END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_0200
* @tc.name testAlignContentEndFlexHeightNoSatisfy
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End to set the height of the Flex
* component to meet the height requirements of the subcomponent.
*/
it('testAlignContentEndFlexHeightNoSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexHeightNoSatisfy START');
globalThis.value.message.notify({ name:'height', value:250 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContentFlexEnd_flex001');
let obj = JSON.parse(strJson);
console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj));
console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor));
let AlignContentFlexEnd_flex002 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContentFlexEnd_flex001_4');
console.log('AlignContentFlexEnd_flex002 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex002))
console.log('AlignContentFlexEnd_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEnd_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(AlignContentFlexEnd_1.top).assertEqual(AlignContentFlexEnd_flex002.top);
expect(AlignContentFlexEnd_4.bottom).assertLarger(AlignContentFlexEnd_flex002.bottom);
expect(AlignContentFlexEnd_2.bottom).assertEqual(AlignContentFlexEnd_4.top);
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
console.info('testAlignContentEndFlexHeightNoSatisfy END');
done();
});
})
}
/*
* 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 AlignContent_End_FlexP_Fixed_Margin() {
describe('AlignContent_End_FlexP_Fixed_Margin', function () {
beforeEach(async function (done) {
console.info("AlignContent_End_FlexP_Fixed_Margin beforeEach start");
let options = {
uri: 'MainAbility/pages/Flex/alignContent/End/AlignContent_End_FlexP_Fixed_Margin',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get AlignContent_End_FlexP_Fixed_Margin state success " + JSON.stringify(pages));
if (!("AlignContent_End_FlexP_Fixed_Margin" == pages.name)) {
console.info("get AlignContent_End_FlexP_Fixed_Margin state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push AlignContent_End_FlexP_Fixed_Margin page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignContent_End_FlexP_Fixed_Margin page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000)
console.info("AlignContent_End_FlexP_Fixed_Margin beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000)
console.info("AlignContent_End_FlexP_Fixed_Margin after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_1100
* @tc.name testAlignContentEndFlexFixedMarginSatisfy
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End, and set the sub component
* margin to meet the flex size requirements.
*/
it('testAlignContentEndFlexFixedMarginSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexFixedMarginSatisfy START');
globalThis.value.message.notify({ name:'margin', value:10 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContent_End_FlexP_Fixed_Margin_flex001');
let obj = JSON.parse(strJson);
console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj));
console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor));
let AlignContentFlexEnd_flex001 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_4');
console.log('AlignContent_End_FlexP_Fixed_Margin_flex001 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex001));
console.log('AlignContentFlexEnd_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEnd_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
expect(Math.round(AlignContentFlexEnd_3.top - AlignContentFlexEnd_flex001.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_1.top - AlignContentFlexEnd_2.top)).assertEqual(vp2px(10));
expect(Math.round(AlignContentFlexEnd_2.left - AlignContentFlexEnd_1.right)).assertEqual(vp2px(10));
expect(AlignContentFlexEnd_flex001.bottom).assertEqual(AlignContentFlexEnd_4.bottom);
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_3.bottom);
console.info('testAlignContentEndFlexFixedMarginSatisfy END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_1200
* @tc.name testAlignContentEndFlexFixedMarginNoSatisfy
* @tc.desc The Flex component alignContent property is set to FlexAlign.End, and the sub component margin is
* set, which does not meet the flex size requirements.
*/
it('testAlignContentEndFlexFixedMarginNoSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexFixedMarginNoSatisfy START');
globalThis.value.message.notify({ name:'margin', value:100 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContent_End_FlexP_Fixed_Margin_flex001');
let obj = JSON.parse(strJson);
let AlignContentFlexEnd_flex002 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Margin_4');
console.log('AlignContent_End_FlexP_Fixed_Margin_flex002 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex002))
console.log('AlignContentFlexEnd_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEnd_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
expect(Math.round(AlignContentFlexEnd_1.top - AlignContentFlexEnd_flex002.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_1.left - AlignContentFlexEnd_flex002.left)).assertEqual(vp2px(100));
expect(AlignContentFlexEnd_4.bottom).assertLarger(AlignContentFlexEnd_flex002.bottom);
expect(Math.round(AlignContentFlexEnd_3.top - AlignContentFlexEnd_1.bottom)).assertEqual(vp2px(100));
console.info('testAlignContentEndFlexFixedMarginNoSatisfy END');
done();
});
})
}
/*
* 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'
export default function AlignContent_End_FlexP_Fixed_Offset() {
describe('AlignContent_End_FlexP_Fixed_Offset', function () {
beforeEach(async function (done) {
console.info("AlignContent_End_FlexP_Fixed_Offset beforeEach start");
let options = {
uri: 'MainAbility/pages/Flex/alignContent/End/AlignContent_End_FlexP_Fixed_Offset',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get AlignContent_End_FlexP_Fixed_Offset state success " + JSON.stringify(pages));
if (!("AlignContent_End_FlexP_Fixed_Offset" == pages.name)) {
console.info("get AlignContent_End_FlexP_Fixed_Offset state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push AlignContent_End_FlexP_Fixed_Offset page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignContent_End_FlexP_Fixed_Offset page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000)
console.info("AlignContent_End_FlexP_Fixed_Offset beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000)
console.info("AlignContent_End_FlexP_Fixed_Offset after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_End_1000
* @tc.name testAlignContentEndFlexPfixedOffset
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End, and set the offsize
* property of the sub component.
*/
it('testAlignContentEndFlexPfixedOffset', 0, async function (done) {
console.info('testAlignContentEndFlexPfixedOffset START');
let strJson = getInspectorByKey('AlignContent_End_FlexP_Fixed_Offset_flex001');
let obj = JSON.parse(strJson);
console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj));
console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor));
let AlignContentFlexEnd_flex001 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Offset_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Offset_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Offset_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Offset_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Offset_4');
console.log('AlignContent_End_FlexP_Fixed_Offset_flex001 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex001));
console.log('AlignContentFlexEnd_1 rect_value is:'+ JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEnd_2 rect_value is:'+ JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+ JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+ JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
expect(Math.round(AlignContentFlexEnd_2.left - AlignContentFlexEnd_flex001.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.top - AlignContentFlexEnd_flex001.top)).assertEqual(vp2px(200));
expect(Math.round((AlignContentFlexEnd_1.right - AlignContentFlexEnd_2.left)*10)/10).assertEqual(vp2px(15));
expect(Math.round(AlignContentFlexEnd_1.top - AlignContentFlexEnd_2.top)).assertEqual(vp2px(30));
expect(AlignContentFlexEnd_flex001.bottom ).assertEqual(AlignContentFlexEnd_4.bottom);
expect(Math.round(AlignContentFlexEnd_3.top - AlignContentFlexEnd_flex001.top)).assertEqual(vp2px(50));
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_3.bottom)
console.info('testAlignContentEndFlexPfixedOffset END');
done();
});
})
}
/*
* 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 AlignContent_End_FlexP_Fixed_Visibility() {
describe('AlignContent_End_FlexP_Fixed_Visibility', function () {
beforeEach(async function (done) {
console.info("AlignContent_End_FlexP_Fixed_Visibility beforeEach start");
let options = {
uri: 'MainAbility/pages/Flex/alignContent/End/AlignContent_End_FlexP_Fixed_Visibility',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get AlignContent_End_FlexP_Fixed_Visibility state success " + JSON.stringify(pages));
if (!("AlignContent_End_FlexP_Fixed_Visibility" == pages.name)) {
console.info("get AlignContent_End_FlexP_Fixed_Visibility state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push AlignContent_End_FlexP_Fixed_Visibility page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignContent_End_FlexP_Fixed_Visibility page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000)
console.info("AlignContent_End_FlexP_Fixed_Visibility beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000)
console.info("AlignContent_End_FlexP_Fixed_Visibility after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_1300
* @tc.name testAlignContentEndFlexfixedVisibilityHidden
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End, and set the Visibility
* property of the subcomponent to Hidden.
*/
it('testAlignContentEndFlexfixedVisibilityHidden', 0, async function (done) {
console.info('testAlignContentEndFlexfixedVisibilityHidden START');
globalThis.value.message.notify({ name:'visibility', value:Visibility.Hidden })
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('AlignContent_End_FlexP_Fixed_Visibility_flex001');
let obj = JSON.parse(strJson);
let strJsonText1 = getInspectorByKey('AlignContent_End_FlexP_Fixed_Visibility_1');
let objText1 = JSON.parse(strJsonText1);
console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj));
console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor));
let AlignContentFlexEnd_flex001 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Visibility_flex001');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Visibility_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Visibility_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Visibility_4');
console.log('AlignContent_End_FlexP_Fixed_Visibility_flex001 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex001));
console.log('AlignContentFlexEnd_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
expect(objText1.$attrs.visibility).assertEqual("Visibility.Hidden");
expect(AlignContentFlexEnd_flex001.bottom).assertEqual(AlignContentFlexEnd_4.bottom);
expect(Math.round(AlignContentFlexEnd_3.top - AlignContentFlexEnd_flex001.top)).assertEqual(vp2px(50));
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_3.bottom);
expect(Math.round(AlignContentFlexEnd_2.left - AlignContentFlexEnd_flex001.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_flex001.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
console.info('testAlignContentEndFlexfixedVisibilityHidden END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_1400
* @tc.name testAlignContentEndFlexfixedVisibilityNone
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End, and set the Visibility
* property of the subcomponent to None.
*/
it('testAlignContentEndFlexfixedVisibilityNone', 0, async function (done) {
console.info('testAlignContentEndFlexfixedVisibilityNone START');
globalThis.value.message.notify({ name:'visibility', value:Visibility.None })
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('AlignContent_End_FlexP_Fixed_Visibility_flex001');
let obj = JSON.parse(strJson);
let strJsonText1 = getInspectorByKey('AlignContent_End_FlexP_Fixed_Visibility_1');
let objText1 = JSON.parse(strJsonText1);
let AlignContentFlexEnd_flex002 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Visibility_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Visibility_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Visibility_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Visibility_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContent_End_FlexP_Fixed_Visibility_4');
console.log('AlignContent_End_FlexP_Fixed_Visibility_flex001 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex002))
console.log('AlignContentFlexEnd_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEnd_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
expect(objText1.$attrs.visibility).assertEqual("Visibility.None");
expect(AlignContentFlexEnd_flex002.bottom).assertEqual(AlignContentFlexEnd_4.bottom);
expect(AlignContentFlexEnd_2.top).assertEqual(AlignContentFlexEnd_3.top);
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_3.top);
expect(AlignContentFlexEnd_2.left).assertEqual(AlignContentFlexEnd_flex002.left);
console.info('testAlignContentEndFlexfixedVisibilityNone END');
done();
});
})
}
/*
* 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 AlignContent_End_FlexP_fixed() {
describe('AlignContent_End_FlexP_fixed', function () {
beforeEach(async function (done) {
console.info("AlignContent_End_FlexP_fixed beforeEach start");
let options = {
uri: 'MainAbility/pages/Flex/alignContent/End/AlignContent_End_FlexP_fixed',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get AlignContent_End_FlexP_fixed state success " + JSON.stringify(pages));
if (!("AlignContent_End_FlexP_fixed" == pages.name)) {
console.info("get AlignContent_End_FlexP_fixed state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push AlignContent_End_FlexP_fixed page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignContent_End_FlexP_fixed page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000)
console.info("AlignContent_End_FlexP_fixed beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000)
console.info("AlignContent_End_FlexP_fixed after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_0800
* @tc.name testAlignContentEndFlexFixedSatisfy
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End, and set the height of the
* subcomponent to meet the height requirements of the subcomponent in the container.
*/
it('testAlignContentEndFlexFixedSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexFixedSatisfy START');
globalThis.value.message.notify({ name:'height', value:80 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContentFlexEndP_fixed_flex001');
let obj = JSON.parse(strJson);
console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj));
console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor));
let AlignContentFlexEnd_flex001 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_4');
console.log('AlignContentFlexEnd_flex001 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex001));
console.log('AlignContentFlexEnd_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEnd_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(80));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
expect(AlignContentFlexEnd_flex001.bottom).assertEqual(AlignContentFlexEnd_4.bottom);
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_3.bottom);
expect(Math.round(AlignContentFlexEnd_2.top - AlignContentFlexEnd_flex001.top)).assertEqual(vp2px(50));
console.info('testAlignContentEndFlexFixedSatisfy END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_0900
* @tc.name testAlignContentEndFlexFixedNoSatisfy
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End, and set the height of the
* subcomponent to meet the height requirements of the subcomponent in the container.
*/
it('testAlignContentEndFlexFixedNoSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexFixedNoSatisfy START');
globalThis.value.message.notify({ name:'height', value:300 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContentFlexEndP_fixed_flex001');
let obj = JSON.parse(strJson);
let AlignContentFlexEnd_flex002 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContentFlexEndP_fixed_4');
console.log('AlignContentFlexEndP_fixed_flex002 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex002))
console.log('AlignContentFlexEnd_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEnd_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(300));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End")
expect(AlignContentFlexEnd_1.top).assertEqual(AlignContentFlexEnd_flex002.top);
expect(AlignContentFlexEnd_4.bottom).assertLarger(AlignContentFlexEnd_flex002.bottom);
expect(AlignContentFlexEnd_1.bottom).assertEqual(AlignContentFlexEnd_4.top);
console.info('testAlignContentEndFlexFixedNoSatisfy END');
done();
});
})
}
/*
* 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'
export default function AlignContent_FlexAlign_End_Margin() {
describe('AlignContent_FlexAlign_End_Margin', function () {
beforeEach(async function (done) {
console.info("AlignContent_FlexAlign_End_Margin beforeEach start");
let options = {
uri: 'MainAbility/pages/Flex/alignContent/End/AlignContent_FlexAlign_End_Margin',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get AlignContent_FlexAlign_End_Margin state success " + JSON.stringify(pages));
if (!("AlignContent_FlexAlign_End_Margin" == pages.name)) {
console.info("get AlignContent_FlexAlign_End_Margin state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push AlignContent_FlexAlign_End_Margin page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignContent_FlexAlign_End_Margin page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000)
console.info("AlignContent_FlexAlign_End_Margin beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000)
console.info("AlignContent_FlexAlign_End_Margin after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_0500
* @tc.name testAlignContentEndFlexMarginSatisfy
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End and
* set the margin for the Flex component.
*/
it('testAlignContentEndFlexMarginSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexMarginSatisfy START');
let strJson = getInspectorByKey('AlignContentFlexEndMargin_flex');
let obj = JSON.parse(strJson);
let End_Margin_Column = CommonFunc.getComponentRect('AlignContentFlexEndMargin_Column');
let AlignContentFlexEnd_flex001 = CommonFunc.getComponentRect('AlignContentFlexEndMargin_flex');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContentFlexEndMargin_flex_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContentFlexEndMargin_flex_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContentFlexEndMargin_flex_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContentFlexEndMargin_flex_4');
console.log('AlignContentFlexEndMargin_flex rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex001));
console.log('AlignContentFlexEndMargin_flex_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEndMargin_flex_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEndMargin_flex_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEndMargin_flex_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
expect(Math.round((AlignContentFlexEnd_flex001.top - End_Margin_Column.top)*10)/10).assertEqual(vp2px(15));
expect(Math.round((End_Margin_Column.bottom - AlignContentFlexEnd_4.bottom)*10)/10).assertEqual(vp2px(15));
expect(AlignContentFlexEnd_flex001.bottom).assertEqual(AlignContentFlexEnd_4.bottom);
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_2.bottom);
expect(Math.round(AlignContentFlexEnd_2.top - AlignContentFlexEnd_flex001.top)).assertEqual(vp2px(60));
console.info('testAlignContentEndFlexMarginSatisfy END');
done();
});
})
}
/*
* 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 AlignContent_FlexAlign_End_Margin_padding() {
describe('AlignContent_FlexAlign_End_Margin_padding', function () {
beforeEach(async function (done) {
console.info("AlignContent_FlexAlign_End_Margin_padding beforeEach start");
let options = {
uri: 'MainAbility/pages/Flex/alignContent/End/AlignContent_FlexAlign_End_Margin_padding',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get AlignContent_FlexAlign_End_Margin_padding state success " + JSON.stringify(pages));
if (!("AlignContent_FlexAlign_End_Margin_padding" == pages.name)) {
console.info("get AlignContent_FlexAlign_End_Margin_padding state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push AlignContent_FlexAlign_End_Margin_padding page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignContent_FlexAlign_End_Margin_padding page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000)
console.info("AlignContent_FlexAlign_End_Margin_padding beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000)
console.info("AlignContent_FlexAlign_End_Margin_padding after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_0600
* @tc.name testAlignContentEndFlexMargin&PaddingNOSatisfy
* @tc.desc The AlignContent property of the Flex component is set to FlexAlign.End, and setting the margin
* and padding for the Flex component does not meet the height requirements of the subcomponent.
*/
it('testAlignContentEndFlexMargin&PaddingNOSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexMargin&PaddingNOSatisfy START');
globalThis.value.message.notify({ name:'padding', value:40 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContentFlexEndMargin&padding_flex001');
let obj = JSON.parse(strJson);
let End_Margin_Column_1 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_Column_1');
let AlignContentFlexEnd_flex001 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001_4');
console.log('AlignContentFlexEndMargin&padding_flex001 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_flex001));
console.log('AlignContentFlexEndMargin&padding_flex001_1 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEndMargin&padding_flex001_2 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEndMargin&padding_flex001_3 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEndMargin&padding_flex001_4 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
expect(Math.round(AlignContentFlexEnd_flex001.top - End_Margin_Column_1.top)).assertEqual(vp2px(10))
expect(Math.round(End_Margin_Column_1.bottom - AlignContentFlexEnd_4.bottom)).assertEqual(vp2px(30))
expect(Math.round(AlignContentFlexEnd_1.top - AlignContentFlexEnd_flex001.top)).assertEqual(vp2px(40));
expect(AlignContentFlexEnd_flex001.bottom - AlignContentFlexEnd_4.bottom).assertEqual(vp2px(20));
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_2.bottom);
console.info('testAlignContentEndFlexMargin&PaddingNOSatisfy END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_0700
* @tc.name testAlignContentEndFlexMargin&PaddingSatisfy
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End, and set the margin and
* padding for the Flex component to meet the height requirements of the subcomponent.
*/
it('testAlignContentEndFlexMargin&PaddingSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexMargin&PaddingSatisfy START');
globalThis.value.message.notify({ name:'padding', value:15 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContentFlexEndMargin&padding_flex001');
let obj = JSON.parse(strJson);
let End_Margin_Column_2 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_Column_1');
let AlignContentFlexEnd_flex002 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContentFlexEndMargin&padding_flex001_4');
console.log('AlignContentFlexEndMargin&padding_flex001 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_flex002));
console.log('AlignContentFlexEndMargin&padding_flex001_1 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEndMargin&padding_flex001_2 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEndMargin&padding_flex001_3 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEndMargin&padding_flex001_4 rect_value is:' +
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
expect(Math.round(AlignContentFlexEnd_flex002.top - End_Margin_Column_2.top)).assertEqual(vp2px(10))
expect(Math.round((End_Margin_Column_2.bottom - AlignContentFlexEnd_4.bottom)*10)/10).assertEqual(vp2px(25))
expect(Math.round((AlignContentFlexEnd_flex002.bottom - AlignContentFlexEnd_4.bottom)*10)/10)
.assertEqual(vp2px(15));
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_2.bottom);
expect(Math.round((AlignContentFlexEnd_2.top - AlignContentFlexEnd_flex002.top)*10)/10).assertEqual(vp2px(45));
console.info('testAlignContentEndFlexMargin&PaddingSatisfy END')
done();
});
})
}
/*
* 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 AlignContent_FlexAlign_End_padding() {
describe('AlignContent_FlexAlign_End_padding', function () {
beforeEach(async function (done) {
console.info("AlignContent_FlexAlign_End_padding beforeEach start");
let options = {
uri: 'MainAbility/pages/Flex/alignContent/End/AlignContent_FlexAlign_End_padding',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get AlignContent_FlexAlign_End_padding state success " + JSON.stringify(pages));
if (!("AlignContent_FlexAlign_End_padding" == pages.name)) {
console.info("get AlignContent_FlexAlign_End_padding state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push AlignContent_FlexAlign_End_padding page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignContent_FlexAlign_End_padding page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000)
console.info("AlignContent_FlexAlign_End_padding beforeEach end");
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000)
console.info("AlignContent_FlexAlign_End_padding after each called");
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_0300
* @tc.name testAlignContentEndFlexPaddingNoSatisfy
* @tc.desc The AlignContent property of the Flex component is set to FlexAlign.End, and the padding setting
* for the Flex component does not meet the height requirements of the subcomponent.
*/
it('testAlignContentEndFlexPaddingNoSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexPaddingNoSatisfy START');
globalThis.value.message.notify({ name:'padding', value:40 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContentFlexEndPadding_flex001');
let obj = JSON.parse(strJson);
let AlignContentFlexEnd_flex001 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001_4');
console.log('AlignContentFlexEndPadding_flex001 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_flex001));
console.log('AlignContentFlexEndPadding_flex001_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEndPadding_flex001_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEndPadding_flex001_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEndPadding_flex001_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_1.top - AlignContentFlexEnd_flex001.top)).assertEqual(vp2px(40));
expect(AlignContentFlexEnd_flex001.bottom - AlignContentFlexEnd_4.bottom).assertLess(vp2px(40));
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_2.bottom);
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
console.info('testAlignContentEndFlexPaddingNoSatisfy END');
done();
});
/**
* @tc.number SUB_ACE_FLEXALIGNCONTENT_END_0400
* @tc.name testAlignContentEndFlexPaddingSatisfy
* @tc.desc Set the AlignContent property of the Flex component to FlexAlign.End, and set padding for the
* Flex component to meet the height requirements of the subcomponen.
*/
it('testAlignContentEndFlexPaddingSatisfy', 0, async function (done) {
console.info('testAlignContentEndFlexPaddingSatisfy START');
globalThis.value.message.notify({ name:'padding', value:15 })
await CommonFunc.sleep(3000)
let strJson = getInspectorByKey('AlignContentFlexEndPadding_flex001');
let obj = JSON.parse(strJson);
let AlignContentFlexEndPadding_flex002 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001');
let AlignContentFlexEnd_1 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001_1');
let AlignContentFlexEnd_2 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001_2');
let AlignContentFlexEnd_3 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001_3');
let AlignContentFlexEnd_4 = CommonFunc.getComponentRect('AlignContentFlexEndPadding_flex001_4');
console.log('AlignContentFlexEndPadding_flex002 rect_value is:'+
JSON.stringify(AlignContentFlexEndPadding_flex002))
console.log('AlignContentFlexEnd_1 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_1));
console.log('AlignContentFlexEnd_2 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_2));
console.log('AlignContentFlexEnd_3 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_3));
console.log('AlignContentFlexEnd_4 rect_value is:'+
JSON.stringify(AlignContentFlexEnd_4));
expect(Math.round(AlignContentFlexEnd_1.bottom - AlignContentFlexEnd_1.top)).assertEqual(vp2px(50));
expect(Math.round(AlignContentFlexEnd_2.bottom - AlignContentFlexEnd_2.top)).assertEqual(vp2px(100));
expect(Math.round(AlignContentFlexEnd_3.bottom - AlignContentFlexEnd_3.top)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.bottom - AlignContentFlexEnd_4.top)).assertEqual(vp2px(200));
expect(Math.round(AlignContentFlexEnd_1.right - AlignContentFlexEnd_1.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_2.right - AlignContentFlexEnd_2.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_3.right - AlignContentFlexEnd_3.left)).assertEqual(vp2px(150));
expect(Math.round(AlignContentFlexEnd_4.right - AlignContentFlexEnd_4.left)).assertEqual(vp2px(150));
expect(AlignContentFlexEnd_4.top).assertEqual(AlignContentFlexEnd_2.bottom);
expect(Math.round((AlignContentFlexEnd_1.top - AlignContentFlexEndPadding_flex002.top)*10)/10).assertEqual(vp2px(45));
expect(Math.round((AlignContentFlexEndPadding_flex002.bottom - AlignContentFlexEnd_4.bottom)*10)/10).assertEqual(vp2px(15));
expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row");
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
console.info('testAlignContentEndFlexPaddingSatisfy END');
done();
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册