提交 a8893972 编写于 作者: E e

添加flex_Start用例

Signed-off-by: Ne <qianwangdq@isoftstone.com>
上级 00bec899
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_AddAlign {
@State DadAddAlign: number = Alignment.TopStart
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_NoSpace onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'DadAddAlign') {
this.DadAddAlign = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('justifyContent:FlexAlign.Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("Start_AddAlign_011")
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_AddAlign_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_AddAlign_013")
}
.key("Start_AddAlign_01")
.width(500)
.height(200)
.backgroundColor(0xAFEEEE)
.align(this.DadAddAlign)
}
.width("100%")
.backgroundColor(0xAFEEE)
}
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_AddAllSpace {
@State DadAllSpace: number = 10
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_AddAllSpace onPageShow');
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'DadAllSpace') {
this.DadAllSpace = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('justifyContent:FlexAlign.Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("Start_AddAllSpace_011")
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_AddAllSpace_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_AddAllSpace_013")
}
.key("Start_AddAllSpace_01")
.width(500)
.height(200)
.padding(this.DadAllSpace)
.margin(10)
.backgroundColor(0xAFEEEE)
}
.key("Start_AddAllSpace_01_Box")
.width("100%")
.height(200)
.backgroundColor(0xAFEEE)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_AddLayoutWeight {
@State OneLayoutWeight: number = 2
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_NoSpace onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'OneLayoutWeight') {
this.OneLayoutWeight = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('justifyContent:FlexAlign.Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) {
Text('1')
.width(150)
.height(50)
.backgroundColor(0xF5DEB3)
.key("Start_AddLayoutWeight_011")
.layoutWeight(this.OneLayoutWeight)
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_AddLayoutWeight_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_AddLayoutWeight_013")
}
.key("Start_AddLayoutWeight_01")
.width(500)
.height(200)
.backgroundColor(0xAFEEEE)
}
}
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_AddMargin {
@State DadMargin: number = 10
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_AddMargin onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'DadMargin') {
this.DadMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('justifyContent:FlexAlign.Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("Start_AddMargin_011")
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_AddMargin_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_AddMargin_013")
}
.key("Start_AddMargin_01")
.width(500)
.height(200)
.margin(this.DadMargin)
.backgroundColor(0xAFEEEE)
}
.key("Start_AddMargin_01_Box")
.width("100%")
.height(200)
.backgroundColor(0xAFEEE)
}
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_AddOffset {
@State OneOffset: any = { x: 0, y: 0 }
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_AddOffset onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'OneOffset') {
this.OneOffset = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('justifyContent:FlexAlign.Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("Start_AddOffset_011")
.offset(this.OneOffset)
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_AddOffset_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_AddOffset_013")
}
.key("Start_AddOffset_01")
.width(500)
.height(200)
.backgroundColor(0xAFEEEE)
}
}
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_AddOneMargin {
@State OneMargin: number = 10
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_AddOneMargin onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'OneMargin') {
this.OneMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('justifyContent:FlexAlign.Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) {
Text('1')
.width(150)
.height(50)
.backgroundColor(0xF5DEB3)
.key("Start_AddOneMargin_011")
.margin(this.OneMargin)
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_AddOneMargin_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_AddOneMargin_013")
}
.key("Start_AddOneMargin_01")
.width(500)
.height(200)
.backgroundColor(0xAFEEEE)
}
}
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_AddOneWidth {
@State OneWidth: number = 100
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_NoSpace onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'OneWidth') {
this.OneWidth = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('justifyContent:FlexAlign.Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) {
Text('1').width(this.OneWidth).height(50).backgroundColor(0xF5DEB3).key("Start_AddOneWidth_011")
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_AddOneWidth_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_AddOneWidth_013")
}
.key("Start_AddOneWidth_01")
.width(500)
.height(200)
.backgroundColor(0xAFEEEE)
}
}
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_AddPadding {
@State DadPadding: number = 10
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_AddPadding onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'DadPadding') {
this.DadPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('alignContent:Start').fontSize(9).fontColor(0xCCCCCC).width('100%')
Flex({ justifyContent: this.justifyContent, direction:FlexDirection.Row }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("Start_AddPadding_011")
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_AddPadding_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_AddPadding_013")
}.key("Start_AddPadding_01")
.width(500)
.height(200)
.padding(this.DadPadding)
.backgroundColor(0xAFEEEE)
}
}
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_AddVisibility {
@State OneVisibility: number = Visibility.None
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_AddVisibility onPageShow');
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'OneVisibility') {
this.OneVisibility = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('justifyContent:FlexAlign.Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) {
Text('1')
.width(150)
.height(50)
.backgroundColor(0xF5DEB3)
.key("Start_AddVisibility_011")
.visibility(this.OneVisibility)
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_AddVisibility_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_AddVisibility_013")
}
.key("Start_AddVisibility_01")
.width(500)
.height(200)
.backgroundColor(0xAFEEEE)
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {MessageManager,Callback} from './../../../../common/MessageManager';
@Entry
@Component
struct AlignStart_NoSpace {
@State DadWidth: number = 200
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('AlignSpaceEvenly_NoSpace onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'DadWidth') {
this.DadWidth = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@State justifyContent: FlexAlign = FlexAlign.Start
build() {
Column() {
Text('justifyContent:FlexAlign.Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) {
Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("Start_NoSpace_011")
Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("Start_NoSpace_012")
Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("Start_NoSpace_013")
}
.key("Start_NoSpace_01")
.width(this.DadWidth)
.height(200)
.backgroundColor(0xAFEEEE)
}
}
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { 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 AlignStart_AddAlign() {
describe('AlignStart_AddAlign', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_AddAlign'
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_AddAlign state success " + JSON.stringify(pages));
if (!("AlignStart_AddAlign" == pages.name)) {
console.info("get AlignStart_AddAlign state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_AddAlign page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_AddAlign page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_AddAlign after each called")
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0800
* @tc.name Align_Start_Row_AddAlign
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0800', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0800] START');
globalThis.value.message.notify({name:'DadAlign', value:Alignment.BottomEnd});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddAlign_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddAlign_011 = CommonFunc.getComponentRect('Start_AddAlign_011');
let Start_AddAlign_012 = CommonFunc.getComponentRect('Start_AddAlign_012');
let Start_AddAlign_013 = CommonFunc.getComponentRect('Start_AddAlign_013');
let Start_AddAlign_01 = CommonFunc.getComponentRect('Start_AddAlign_01');
expect(Start_AddAlign_011.top).assertEqual(Start_AddAlign_012.top);
expect(Start_AddAlign_012.top).assertEqual(Start_AddAlign_013.top);
expect(Start_AddAlign_011.top).assertEqual(Start_AddAlign_01.top);
expect(Start_AddAlign_012.left).assertEqual(Start_AddAlign_011.right);
expect(Start_AddAlign_013.left).assertEqual(Start_AddAlign_012.right);
expect(Start_AddAlign_01.left).assertEqual(Start_AddAlign_011.left);
expect(Start_AddAlign_011.right - Start_AddAlign_011.left).assertEqual(vp2px(150));
expect(Start_AddAlign_012.right - Start_AddAlign_012.left).assertEqual(vp2px(150));
expect(Start_AddAlign_013.right - Start_AddAlign_013.left).assertEqual(vp2px(150));
expect(Start_AddAlign_011.bottom - Start_AddAlign_011.top).assertEqual(vp2px(50));
expect(Start_AddAlign_012.bottom - Start_AddAlign_012.top).assertEqual(vp2px(100));
expect(Start_AddAlign_013.bottom - Start_AddAlign_013.top).assertEqual(vp2px(150));
expect(Start_AddAlign_01.right - Start_AddAlign_013.right).assertEqual(vp2px(50));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0800] END');
done()
});
})
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "./../../../../MainAbility/common/Common"
import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager';
export default function AlignStart_AddAllSpace() {
describe('AlignStart_AddAllSpace', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_AddAllSpace'
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_AddAllSpace state success " + JSON.stringify(pages));
if (!("AlignStart_AddAllSpace" == pages.name)) {
console.info("get AlignStart_AddAllSpace state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_AddAllSpace page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_AddAllSpace page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_AddAllSpace after each called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0600
* @tc.name Align_Start_Row_AddAllSpace
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0600', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0600] START');
globalThis.value.message.notify({name:'DadAllSpace', value:30});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddAllSpace_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddAllSpace_011 = CommonFunc.getComponentRect('Start_AddAllSpace_011');
let Start_AddAllSpace_012 = CommonFunc.getComponentRect('Start_AddAllSpace_012');
let Start_AddAllSpace_013 = CommonFunc.getComponentRect('Start_AddAllSpace_013');
let Start_AddAllSpace_01 = CommonFunc.getComponentRect('Start_AddAllSpace_01');
let Start_AddAllSpace_01_Box = CommonFunc.getComponentRect('Start_AddAllSpace_01_Box');
expect( Start_AddAllSpace_011.top ).assertEqual(Start_AddAllSpace_012.top);
expect( Start_AddAllSpace_012.top ).assertEqual(Start_AddAllSpace_013.top);
expect( Start_AddAllSpace_012.left ).assertEqual(Start_AddAllSpace_011.right);
expect( Start_AddAllSpace_013.left ).assertEqual(Start_AddAllSpace_012.right);
expect( Start_AddAllSpace_011.top - Start_AddAllSpace_01.top ).assertEqual(vp2px(30));
expect( Start_AddAllSpace_011.left - Start_AddAllSpace_01.left ).assertEqual(vp2px(30));
expect( Start_AddAllSpace_01.right - Start_AddAllSpace_013.right ).assertEqual(vp2px(30));
expect( Start_AddAllSpace_01.top - Start_AddAllSpace_01_Box.top ).assertEqual(vp2px(10));
expect( Start_AddAllSpace_01.left - Start_AddAllSpace_01_Box.left ).assertEqual(vp2px(10));
expect(Start_AddAllSpace_011.bottom - Start_AddAllSpace_011.top).assertEqual(vp2px(50));
expect(Start_AddAllSpace_012.bottom - Start_AddAllSpace_012.top).assertEqual(vp2px(100));
expect(Start_AddAllSpace_013.bottom - Start_AddAllSpace_013.top).assertEqual(vp2px(150));
expect(Start_AddAllSpace_011.right - Start_AddAllSpace_011.left).assertEqual(vp2px(440/3));
expect(Start_AddAllSpace_012.right - Start_AddAllSpace_012.left).assertEqual(vp2px(440/3));
expect(Start_AddAllSpace_013.right - Start_AddAllSpace_013.left).assertEqual(vp2px(440/3));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0600] END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0700
* @tc.name Align_Start_Row_AddAllSpace
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0700', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0700] START');
globalThis.value.message.notify({name:'DadAllSpace', value:20});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddAllSpace_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddAllSpace_011 = CommonFunc.getComponentRect('Start_AddAllSpace_011');
let Start_AddAllSpace_012 = CommonFunc.getComponentRect('Start_AddAllSpace_012');
let Start_AddAllSpace_013 = CommonFunc.getComponentRect('Start_AddAllSpace_013');
let Start_AddAllSpace_01 = CommonFunc.getComponentRect('Start_AddAllSpace_01');
let Start_AddAllSpace_01_Box = CommonFunc.getComponentRect('Start_AddAllSpace_01_Box');
expect(Start_AddAllSpace_011.top).assertEqual(Start_AddAllSpace_012.top);
expect(Start_AddAllSpace_012.top).assertEqual(Start_AddAllSpace_013.top);
expect(Start_AddAllSpace_012.left).assertEqual(Start_AddAllSpace_011.right);
expect(Start_AddAllSpace_013.left).assertEqual(Start_AddAllSpace_012.right);
expect( Start_AddAllSpace_011.left - Start_AddAllSpace_01.left ).assertEqual(vp2px(20));
expect( Start_AddAllSpace_01.right - Start_AddAllSpace_013.right ).assertEqual(vp2px(30));
expect( Start_AddAllSpace_011.top - Start_AddAllSpace_01.top ).assertEqual(vp2px(20));
expect( Start_AddAllSpace_01.left - Start_AddAllSpace_01_Box.left ).assertEqual(vp2px(10));
expect( Start_AddAllSpace_01.top - Start_AddAllSpace_01_Box.top ).assertEqual(vp2px(10));
expect(Start_AddAllSpace_011.right - Start_AddAllSpace_011.left).assertEqual(vp2px(150));
expect(Start_AddAllSpace_012.right - Start_AddAllSpace_012.left).assertEqual(vp2px(150));
expect(Start_AddAllSpace_013.right - Start_AddAllSpace_013.left).assertEqual(vp2px(150));
expect(Start_AddAllSpace_011.bottom - Start_AddAllSpace_011.top).assertEqual(vp2px(50));
expect(Start_AddAllSpace_012.bottom - Start_AddAllSpace_012.top).assertEqual(vp2px(100));
expect(Start_AddAllSpace_013.bottom - Start_AddAllSpace_013.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0700] END');
done();
});
})
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "./../../../../MainAbility/common/Common";
import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager';
export default function AlignStart_AddLayoutWeight() {
describe('AlignStart_AddLayoutWeight', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_AddLayoutWeight'
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_AddLayoutWeight state success " + JSON.stringify(pages));
if (!("AlignStart_AddLayoutWeight" == pages.name)) {
console.info("get AlignStart_AddLayoutWeight state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_AddLayoutWeight page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_AddLayoutWeight page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_AddLayoutWeight after each called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1200
* @tc.name Align_Start_Row_AddLayoutWeight
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1200', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1200] START');
globalThis.value.message.notify({name:'OneLayoutWeight', value:1});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddLayoutWeight_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddLayoutWeight_011 = CommonFunc.getComponentRect('Start_AddLayoutWeight_011');
let Start_AddLayoutWeight_012 = CommonFunc.getComponentRect('Start_AddLayoutWeight_012');
let Start_AddLayoutWeight_013 = CommonFunc.getComponentRect('Start_AddLayoutWeight_013');
let Start_AddLayoutWeight_01 = CommonFunc.getComponentRect('Start_AddLayoutWeight_01');
expect(Start_AddLayoutWeight_011.top).assertEqual(Start_AddLayoutWeight_012.top);
expect(Start_AddLayoutWeight_013.top).assertEqual(Start_AddLayoutWeight_012.top);
expect(Start_AddLayoutWeight_011.top).assertEqual(Start_AddLayoutWeight_01.top);
expect(Start_AddLayoutWeight_011.right).assertEqual(Start_AddLayoutWeight_012.left);
expect(Start_AddLayoutWeight_012.right).assertEqual(Start_AddLayoutWeight_013.left);
expect(Start_AddLayoutWeight_01.left).assertEqual(Start_AddLayoutWeight_011.left);
expect(Start_AddLayoutWeight_013.right).assertEqual(Start_AddLayoutWeight_01.right);
expect(Start_AddLayoutWeight_011.right - Start_AddLayoutWeight_011.left).assertEqual(vp2px(200));
expect(Start_AddLayoutWeight_012.right - Start_AddLayoutWeight_012.left).assertEqual(vp2px(150));
expect(Start_AddLayoutWeight_013.right - Start_AddLayoutWeight_013.left).assertEqual(vp2px(150));
expect(Start_AddLayoutWeight_011.bottom - Start_AddLayoutWeight_011.top).assertEqual(vp2px(50));
expect(Start_AddLayoutWeight_012.bottom - Start_AddLayoutWeight_012.top).assertEqual(vp2px(100));
expect(Start_AddLayoutWeight_013.bottom - Start_AddLayoutWeight_013.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1200] END');
done();
});
})
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "./../../../../MainAbility/common/Common"
import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager';
export default function AlignStart_AddMargin() {
describe('AlignStart_AddMargin', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_AddMargin'
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_AddMargin state success " + JSON.stringify(pages));
if (!("AlignStart_AddMargin" == pages.name)) {
console.info("get AlignStart_AddMargin state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_AddMargin page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_AddMargin page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_AddMargin after each called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0500
* @tc.name Align_Start_Row_AddMargin
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0500', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0500] START');
globalThis.value.message.notify({name:'DadMargin', value:20});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddMargin_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddMargin_011 = CommonFunc.getComponentRect('Start_AddMargin_011');
let Start_AddMargin_012 = CommonFunc.getComponentRect('Start_AddMargin_012');
let Start_AddMargin_013 = CommonFunc.getComponentRect('Start_AddMargin_013');
let Start_AddMargin_01 = CommonFunc.getComponentRect('Start_AddMargin_01');
let Start_AddMargin_01_Box = CommonFunc.getComponentRect('Start_AddMargin_01_Box');
expect(Start_AddMargin_011.top).assertEqual(Start_AddMargin_012.top);
expect(Start_AddMargin_013.top).assertEqual(Start_AddMargin_012.top);
expect(Start_AddMargin_011.top).assertEqual(Start_AddMargin_01.top);
expect(Start_AddMargin_012.left).assertEqual(Start_AddMargin_011.right);
expect(Start_AddMargin_013.left).assertEqual(Start_AddMargin_012.right);
expect(Start_AddMargin_011.left).assertEqual(Start_AddMargin_01.left);
expect(Start_AddMargin_01.top - Start_AddMargin_01_Box.top).assertEqual(vp2px(20));
expect(Start_AddMargin_01.left - Start_AddMargin_01_Box.left).assertEqual(vp2px(20));
expect(Start_AddMargin_011.bottom - Start_AddMargin_011.top).assertEqual(vp2px(50));
expect(Start_AddMargin_012.bottom - Start_AddMargin_012.top).assertEqual(vp2px(100));
expect(Start_AddMargin_013.bottom - Start_AddMargin_013.top).assertEqual(vp2px(150));
expect(Start_AddMargin_011.right - Start_AddMargin_011.left).assertEqual(vp2px(150));
expect(Start_AddMargin_012.right - Start_AddMargin_012.left).assertEqual(vp2px(150));
expect(Start_AddMargin_013.right - Start_AddMargin_013.left).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0500] END');
done();
});
})
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "./../../../../MainAbility/common/Common"
import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager';
export default function AlignStart_AddOffset() {
describe('AlignStart_AddOffset', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_AddOffset'
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_AddOffset state success " + JSON.stringify(pages));
if (!("AlignStart_AddOffset" == pages.name)) {
console.info("get AlignStart_AddOffset state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_AddOffset page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_AddOffset page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_AddOffset after each called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0900
* @tc.name Align_Start_Row_AddOffset
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0900', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0900] START');
globalThis.value.message.notify({name:'OneOffset', value:{ x: 10, y: 15 }});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddOffset_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddOffset_011 = CommonFunc.getComponentRect('Start_AddOffset_011');
let Start_AddOffset_012 = CommonFunc.getComponentRect('Start_AddOffset_012');
let Start_AddOffset_013 = CommonFunc.getComponentRect('Start_AddOffset_013');
let Start_AddOffset_01 = CommonFunc.getComponentRect('Start_AddOffset_01');
expect(Start_AddOffset_011.top - Start_AddOffset_01.top).assertEqual(vp2px(15));
expect(Start_AddOffset_011.left - Start_AddOffset_01.left).assertEqual(vp2px(10));
expect(Start_AddOffset_012.top).assertEqual(Start_AddOffset_013.top);
expect(Start_AddOffset_013.left).assertEqual(Start_AddOffset_012.right);
expect(Start_AddOffset_01.right - Start_AddOffset_013.right).assertEqual(vp2px(50));
expect(Start_AddOffset_011.right - Start_AddOffset_011.left).assertEqual(vp2px(150));
expect(Start_AddOffset_012.right - Start_AddOffset_012.left).assertEqual(vp2px(150));
expect(Start_AddOffset_013.right - Start_AddOffset_013.left).assertEqual(vp2px(150));
expect(Start_AddOffset_011.bottom - Start_AddOffset_011.top).assertEqual(vp2px(50));
expect(Start_AddOffset_012.bottom - Start_AddOffset_012.top).assertEqual(vp2px(100));
expect(Start_AddOffset_013.bottom - Start_AddOffset_013.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0900] END');
done();
});
})
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "./../../../../MainAbility/common/Common"
import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager';
export default function AlignStart_AddOneMargin() {
describe('AlignStart_AddOneMargin', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_AddOneMargin',
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_AddOneMargin state success " + JSON.stringify(pages));
if (!("AlignStart_AddOneMargin" == pages.name)) {
console.info("get AlignStart_AddOneMargin state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_AddOneMargin page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_AddOneMargin page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_AddOneMargin after each called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1400
* @tc.name Align_Start_Row_AddOneMargin
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1400', 0, async function (done) {
//await CommonFunc.sleep(2000);
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1400] START');
globalThis.value.message.notify({name:'OneMargin', value:20});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddOneMargin_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddOneMargin_011 = CommonFunc.getComponentRect('Start_AddOneMargin_011');
let Start_AddOneMargin_012 = CommonFunc.getComponentRect('Start_AddOneMargin_012');
let Start_AddOneMargin_013 = CommonFunc.getComponentRect('Start_AddOneMargin_013');
let Start_AddOneMargin_01 = CommonFunc.getComponentRect('Start_AddOneMargin_01');
expect(Start_AddOneMargin_013.top).assertEqual(Start_AddOneMargin_012.top);
expect(Start_AddOneMargin_01.top).assertEqual(Start_AddOneMargin_012.top);
expect(Start_AddOneMargin_013.left).assertEqual(Start_AddOneMargin_012.right);
expect(Start_AddOneMargin_012.left - Start_AddOneMargin_011.right).assertEqual(vp2px(20));
expect(Start_AddOneMargin_011.top - Start_AddOneMargin_01.top).assertEqual(vp2px(20));
expect(Start_AddOneMargin_011.left - Start_AddOneMargin_01.left).assertEqual(vp2px(20));
expect(Start_AddOneMargin_011.right - Start_AddOneMargin_011.left).assertEqual(vp2px(150));
expect(Start_AddOneMargin_012.right - Start_AddOneMargin_012.left).assertEqual(vp2px(150));
expect(Start_AddOneMargin_013.right - Start_AddOneMargin_013.left).assertEqual(vp2px(150));
expect(Start_AddOneMargin_011.bottom - Start_AddOneMargin_011.top).assertEqual(vp2px(50));
expect(Start_AddOneMargin_012.bottom - Start_AddOneMargin_012.top).assertEqual(vp2px(100));
expect(Start_AddOneMargin_013.bottom - Start_AddOneMargin_013.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1400] END');
done();
})
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1500
* @tc.name Align_Start_Row_AddOneMargin
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1500', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1500] START');
globalThis.value.message.notify({name:'OneMargin', value:30});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddOneMargin_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddOneMargin_011 = CommonFunc.getComponentRect('Start_AddOneMargin_011');
let Start_AddOneMargin_012 = CommonFunc.getComponentRect('Start_AddOneMargin_012');
let Start_AddOneMargin_013 = CommonFunc.getComponentRect('Start_AddOneMargin_013');
let Start_AddOneMargin_01 = CommonFunc.getComponentRect('Start_AddOneMargin_01');
expect(Start_AddOneMargin_012.top).assertEqual(Start_AddOneMargin_013.top);
expect(Start_AddOneMargin_01.top).assertEqual(Start_AddOneMargin_012.top);
expect(Start_AddOneMargin_013.left).assertEqual(Start_AddOneMargin_012.right);
expect(Start_AddOneMargin_013.right).assertEqual(Start_AddOneMargin_01.right);
expect(Start_AddOneMargin_012.left - Start_AddOneMargin_011.right).assertEqual(vp2px(30));
expect(Start_AddOneMargin_011.top - Start_AddOneMargin_01.top).assertEqual(vp2px(30));
expect(Start_AddOneMargin_011.left - Start_AddOneMargin_01.left).assertEqual(vp2px(30));
expect(Start_AddOneMargin_011.right - Start_AddOneMargin_011.left).assertEqual(vp2px(440/3));
expect(Start_AddOneMargin_012.right - Start_AddOneMargin_012.left).assertEqual(vp2px(440/3));
expect(Start_AddOneMargin_013.right - Start_AddOneMargin_013.left).assertEqual(vp2px(440/3));
// expect(Start_AddOneMargin_011.bottom - Start_AddOneMargin_011.top).assertEqual(vp2px(50));
// expect(Start_AddOneMargin_012.bottom - Start_AddOneMargin_012.top).assertEqual(vp2px(100));
// expect(Start_AddOneMargin_013.bottom - Start_AddOneMargin_013.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1500] END');
done();
})
})
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "./../../../../MainAbility/common/Common"
import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager';
export default function AlignStart_AddOneWidth() {
describe('AlignStart_AddOneWidth', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_AddOneWidth',
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_AddOneWidth state success " + JSON.stringify(pages));
if (!("AlignStart_AddOneWidth" == pages.name)) {
console.info("get AlignStart_AddOneWidth state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_AddOneWidth page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_AddOneWidth page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_AddOneWidth after each called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1300
* @tc.name Align_Start_Row_ChangeOneWidth
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1300', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1300] START');
globalThis.value.message.notify({name:'OneWidth', value:160});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddOneWidth_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddOneWidth_011 = CommonFunc.getComponentRect('Start_AddOneWidth_011');
let Start_AddOneWidth_012 = CommonFunc.getComponentRect('Start_AddOneWidth_012');
let Start_AddOneWidth_013 = CommonFunc.getComponentRect('Start_AddOneWidth_013');
let Start_AddOneWidth_01 = CommonFunc.getComponentRect('Start_AddOneWidth_01');
expect(Start_AddOneWidth_011.top).assertEqual(Start_AddOneWidth_012.top);
expect(Start_AddOneWidth_013.top).assertEqual(Start_AddOneWidth_012.top);
expect(Start_AddOneWidth_011.top).assertEqual(Start_AddOneWidth_01.top);
expect(Start_AddOneWidth_01.left).assertEqual(Start_AddOneWidth_011.left);
expect(Start_AddOneWidth_012.left).assertEqual(Start_AddOneWidth_011.right);
expect(Start_AddOneWidth_013.left).assertEqual(Start_AddOneWidth_012.right);
expect(Start_AddOneWidth_011.right - Start_AddOneWidth_011.left).assertEqual(vp2px(160));
expect(Start_AddOneWidth_012.right - Start_AddOneWidth_012.left).assertEqual(vp2px(150));
expect(Start_AddOneWidth_013.right - Start_AddOneWidth_013.left).assertEqual(vp2px(150));
expect(Start_AddOneWidth_011.bottom - Start_AddOneWidth_011.top).assertEqual(vp2px(50));
expect(Start_AddOneWidth_012.bottom - Start_AddOneWidth_012.top).assertEqual(vp2px(100));
expect(Start_AddOneWidth_013.bottom - Start_AddOneWidth_013.top).assertEqual(vp2px(150));
expect(Start_AddOneWidth_01.right - Start_AddOneWidth_013.right).assertEqual(vp2px(40));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1300] END');
done();
});
})
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "./../../../../MainAbility/common/Common"
import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager';
export default function AlignStart_AddPadding() {
describe('AlignStart_AddPadding', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_AddPadding',
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_AddPadding state success " + JSON.stringify(pages));
if (!("AlignStart_AddPadding" == pages.name)) {
console.info("get AlignStart_AddPadding state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_AddPadding page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_AddPadding page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_AddPadding after each called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0300
* @tc.name Align_Start_Row_AddPadding
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0300', 0, async function (done) {
//await CommonFunc.sleep(2000);
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0300] START');
globalThis.value.message.notify({name:'DadPadding', value:30});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddPadding_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddPadding_011 = CommonFunc.getComponentRect('Start_AddPadding_011');
let Start_AddPadding_012 = CommonFunc.getComponentRect('Start_AddPadding_012');
let Start_AddPadding_013 = CommonFunc.getComponentRect('Start_AddPadding_013');
let Start_AddPadding_01 = CommonFunc.getComponentRect('Start_AddPadding_01');
expect(Start_AddPadding_011.top).assertEqual(Start_AddPadding_012.top);
expect(Start_AddPadding_012.top).assertEqual(Start_AddPadding_013.top);
expect(Start_AddPadding_012.left).assertEqual(Start_AddPadding_011.right);
expect(Start_AddPadding_013.left).assertEqual(Start_AddPadding_012.right);
expect(Start_AddPadding_011.left - Start_AddPadding_01.left).assertEqual(vp2px(30));
expect(Start_AddPadding_01.right - Start_AddPadding_013.right).assertEqual(vp2px(30));
expect(Start_AddPadding_011.top - Start_AddPadding_01.top).assertEqual(vp2px(30));
expect(Start_AddPadding_011.right - Start_AddPadding_011.left).assertEqual(vp2px(440/3));
expect(Start_AddPadding_012.right - Start_AddPadding_012.left).assertEqual(vp2px(440/3));
expect(Start_AddPadding_013.right - Start_AddPadding_013.left).assertEqual(vp2px(440/3));
expect(Start_AddPadding_011.bottom - Start_AddPadding_011.top).assertEqual(vp2px(50));
expect(Start_AddPadding_012.bottom - Start_AddPadding_012.top).assertEqual(vp2px(100));
expect(Start_AddPadding_013.bottom - Start_AddPadding_013.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0300] END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0400
* @tc.name Align_Start_Row_AddPadding
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0400', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0400] START');
globalThis.value.message.notify({name:'DadPadding', value:20});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddPadding_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_AddPadding_011 = CommonFunc.getComponentRect('Start_AddPadding_011')
let Start_AddPadding_012 = CommonFunc.getComponentRect('Start_AddPadding_012')
let Start_AddPadding_013 = CommonFunc.getComponentRect('Start_AddPadding_013')
let Start_AddPadding_01 = CommonFunc.getComponentRect('Start_AddPadding_01')
expect(Start_AddPadding_011.top).assertEqual(Start_AddPadding_012.top)
expect(Start_AddPadding_012.top).assertEqual(Start_AddPadding_013.top)
expect( Start_AddPadding_012.left ).assertEqual(Start_AddPadding_011.right)
expect( Start_AddPadding_013.left ).assertEqual(Start_AddPadding_012.right)
expect(Start_AddPadding_011.left - Start_AddPadding_01.left).assertEqual(vp2px(20));
expect(Start_AddPadding_01.right - Start_AddPadding_013.right).assertEqual(vp2px(30));
expect(Start_AddPadding_011.top - Start_AddPadding_01.top).assertEqual(vp2px(20));
expect(Start_AddPadding_011.right - Start_AddPadding_011.left).assertEqual(vp2px(150));
expect(Start_AddPadding_012.right - Start_AddPadding_012.left).assertEqual(vp2px(150));
expect(Start_AddPadding_013.right - Start_AddPadding_013.left).assertEqual(vp2px(150));
expect(Start_AddPadding_011.bottom - Start_AddPadding_011.top).assertEqual(vp2px(50));
expect(Start_AddPadding_012.bottom - Start_AddPadding_012.top).assertEqual(vp2px(100));
expect(Start_AddPadding_013.bottom - Start_AddPadding_013.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0400] END');
done();
});
})
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "./../../../../MainAbility/common/Common"
import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager';
export default function AlignStart_AddVisibility() {
describe('AlignStart_AddVisibility', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_AddVisibility',
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_AddVisibility state success " + JSON.stringify(pages));
if (!("AlignStart_AddVisibility" == pages.name)) {
console.info("get AlignStart_AddVisibility state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_AddVisibility success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_AddVisibility page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_AddVisibility after each called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1000
* @tc.name Align_Start_Row_AddVisibility
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1000', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1000] START');
globalThis.value.message.notify({name:'OneVisibility', value:Visibility.None});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddVisibility_01');
let obj = JSON.parse(strJson);
let strJson2 = getInspectorByKey('Start_AddVisibility_011');
let obj2 = JSON.parse(strJson2);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
expect(obj2.$attrs.visibility).assertEqual("Visibility.None");
let Start_AddVisibility_012 = CommonFunc.getComponentRect('Start_AddVisibility_012');
let Start_AddVisibility_013 = CommonFunc.getComponentRect('Start_AddVisibility_013');
let Start_AddVisibility_01 = CommonFunc.getComponentRect('Start_AddVisibility_01');
expect(Start_AddVisibility_012.top).assertEqual(Start_AddVisibility_013.top);
expect(Start_AddVisibility_012.top).assertEqual(Start_AddVisibility_01.top);
expect(Start_AddVisibility_012.left).assertEqual(Start_AddVisibility_01.left);
expect(Start_AddVisibility_012.right).assertEqual(Start_AddVisibility_013.left);
expect(Start_AddVisibility_012.right - Start_AddVisibility_012.left).assertEqual(vp2px(150));
expect(Start_AddVisibility_013.right - Start_AddVisibility_013.left).assertEqual(vp2px(150));
expect(Start_AddVisibility_012.bottom - Start_AddVisibility_012.top).assertEqual(vp2px(100));
expect(Start_AddVisibility_013.bottom - Start_AddVisibility_013.top).assertEqual(vp2px(150));
expect(Start_AddVisibility_01.right - Start_AddVisibility_013.right).assertEqual(vp2px(200));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1000] END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1100
* @tc.name Align_Start_Row_AddVisibility
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1100', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1100] START');
globalThis.value.message.notify({name:'OneVisibility', value:Visibility.Hidden});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_AddVisibility_01');
let obj = JSON.parse(strJson);
let strJson2 = getInspectorByKey('Start_AddVisibility_011');
let obj2 = JSON.parse(strJson2);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
expect(obj2.$attrs.visibility).assertEqual("Visibility.Hidden");
let Start_AddVisibility_011 = CommonFunc.getComponentRect('Start_AddVisibility_011');
let Start_AddVisibility_012 = CommonFunc.getComponentRect('Start_AddVisibility_012');
let Start_AddVisibility_013 = CommonFunc.getComponentRect('Start_AddVisibility_013');
let Start_AddVisibility_01 = CommonFunc.getComponentRect('Start_AddVisibility_01');
expect(Start_AddVisibility_012.top).assertEqual(Start_AddVisibility_011.top);
expect(Start_AddVisibility_012.top).assertEqual(Start_AddVisibility_013.top);
expect(Start_AddVisibility_012.top).assertEqual(Start_AddVisibility_01.top);
expect(Start_AddVisibility_012.left).assertEqual(Start_AddVisibility_011.right);
expect(Start_AddVisibility_013.left).assertEqual(Start_AddVisibility_012.right);
expect(Start_AddVisibility_01.left).assertEqual(Start_AddVisibility_011.left);
expect(Start_AddVisibility_011.right - Start_AddVisibility_011.left).assertEqual(vp2px(150));
expect(Start_AddVisibility_012.right - Start_AddVisibility_012.left).assertEqual(vp2px(150));
expect(Start_AddVisibility_013.right - Start_AddVisibility_013.left).assertEqual(vp2px(150));
expect(Start_AddVisibility_011.bottom - Start_AddVisibility_011.top).assertEqual(vp2px(50));
expect(Start_AddVisibility_012.bottom - Start_AddVisibility_012.top).assertEqual(vp2px(100));
expect(Start_AddVisibility_013.bottom - Start_AddVisibility_013.top).assertEqual(vp2px(150));
expect(Start_AddVisibility_012.left - Start_AddVisibility_01.left).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_1100] END');
done();
});
})
}
/*
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "./../../../../MainAbility/common/Common"
import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager';
export default function AlignStart_NoSpace() {
describe('AlignStart_NoSpace', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Flex/justifyContent/Start/AlignStart_NoSpace'
}
try {
router.clear();
let pages = router.getState();
console.info("get AlignStart_NoSpace state success " + JSON.stringify(pages));
if (!("AlignStart_NoSpace" == pages.name)) {
console.info("get AlignStart_NoSpace state pages.name " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push AlignStart_NoSpace success " + JSON.stringify(result));
}
} catch (err) {
console.error("push AlignStart_NoSpace page error " + JSON.stringify(err));
expect().assertFail();
}
done()
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("AlignStart_NoSpace after each called");
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0100
* @tc.name Align_Start_Row_ChangeWidth
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0100', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0100] START');
globalThis.value.message.notify({name:'DadWidth', value:400});
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Start_NoSpace_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_NoSpace_011 = CommonFunc.getComponentRect('Start_NoSpace_011');
let Start_NoSpace_012 = CommonFunc.getComponentRect('Start_NoSpace_012');
let Start_NoSpace_013 = CommonFunc.getComponentRect('Start_NoSpace_013');
let Start_NoSpace_01 = CommonFunc.getComponentRect('Start_NoSpace_01');
expect(Start_NoSpace_011.top).assertEqual(Start_NoSpace_012.top);
expect(Start_NoSpace_012.top).assertEqual(Start_NoSpace_013.top);
expect(Start_NoSpace_011.top).assertEqual(Start_NoSpace_01.top);
expect(Start_NoSpace_012.left).assertEqual(Start_NoSpace_011.right);
expect(Start_NoSpace_013.left).assertEqual(Start_NoSpace_012.right);
expect(Start_NoSpace_01.left).assertEqual(Start_NoSpace_011.left);
expect(Start_NoSpace_01.right).assertEqual(Start_NoSpace_013.right);
expect(Start_NoSpace_011.right - Start_NoSpace_011.left).assertEqual(vp2px(400/3));
expect(Start_NoSpace_012.right - Start_NoSpace_012.left).assertEqual(vp2px(400/3));
expect(Start_NoSpace_013.right - Start_NoSpace_013.left).assertEqual(vp2px(400/3));
expect(Start_NoSpace_011.bottom - Start_NoSpace_011.top).assertEqual(vp2px(50));
expect(Start_NoSpace_012.bottom - Start_NoSpace_012.top).assertEqual(vp2px(100));
expect(Start_NoSpace_013.bottom - Start_NoSpace_013.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0100] END');
done();
});
/**
* @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0200
* @tc.name Align_Start_Row_ChangeWidth
* @tc.desc aceFlexAlignStartTest
*/
it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0200', 0, async function (done) {
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0200] START');
let strJson = getInspectorByKey('Start_NoSpace_01');
globalThis.value.message.notify({name:'DadWidth', value:500})
await CommonFunc.sleep(3000);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Flex');
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
let Start_NoSpace_011 = CommonFunc.getComponentRect('Start_NoSpace_011');
let Start_NoSpace_012 = CommonFunc.getComponentRect('Start_NoSpace_012');
let Start_NoSpace_013 = CommonFunc.getComponentRect('Start_NoSpace_013');
let Start_NoSpace_01 = CommonFunc.getComponentRect('Start_NoSpace_01');
expect(Start_NoSpace_011.top).assertEqual(Start_NoSpace_012.top);
expect(Start_NoSpace_012.top).assertEqual(Start_NoSpace_013.top);
expect(Start_NoSpace_011.top).assertEqual(Start_NoSpace_01.top);
expect(Start_NoSpace_01.left).assertEqual(Start_NoSpace_011.left);
expect(Start_NoSpace_012.left).assertEqual(Start_NoSpace_011.right);
expect(Start_NoSpace_013.left).assertEqual(Start_NoSpace_012.right);
expect(Start_NoSpace_01.right - Start_NoSpace_013.right).assertEqual(vp2px(50));
expect(Start_NoSpace_011.right - Start_NoSpace_011.left).assertEqual(vp2px(150));
expect(Start_NoSpace_012.right - Start_NoSpace_012.left).assertEqual(vp2px(150));
expect(Start_NoSpace_013.right - Start_NoSpace_013.left).assertEqual(vp2px(150));
expect(Start_NoSpace_011.bottom - Start_NoSpace_011.top).assertEqual(vp2px(50));
expect(Start_NoSpace_012.bottom - Start_NoSpace_012.top).assertEqual(vp2px(100));
expect(Start_NoSpace_013.bottom - Start_NoSpace_013.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_START_TEST_0200] END');
done();
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册