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

!7460 add Column_Space_ParentComponentChanged xts_acts testcase

Merge pull request !7460 from 王闻天/Column_Space
/**
* 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 Column_AlignItems_ChangeParent {
@State testAlignItems: number = HorizontalAlign.Center
messageManager:MessageManager = new MessageManager()
private content: string = "Column_AlignItems_ChangeParent Page"
onPageShow() {
console.info('Column_AlignItems_ChangeParent page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'alignItems') {
this.testAlignItems = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Column_AlignItems_ChangeParent page build done called');
}
build() {
Column({space:30}) {
Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('AlignItems_Test1')
Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('AlignItems_Test2')
Column(){Text('3')}.width(300).height(150).backgroundColor(0xffa500).key('AlignItems_Test3')
}.key('ColumnAlignItemsChange1').width(350).height(400).backgroundColor(0xAFEEEE).alignItems(this.testAlignItems)
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../common/MessageManager';
@Entry
@Component
struct Column_JustifyContent_ChangeParent {
@State testJustifyContent: number = FlexAlign.Start
messageManager:MessageManager = new MessageManager()
private content: string = "Column_JustifyContent_ChangeParent Page"
onPageShow() {
console.info('Column_JustifyContent_ChangeParent page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'justifyContent') {
this.testJustifyContent = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Column_JustifyContent_ChangeParent page build done called');
}
build() {
Column({space:30}) {
Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('JustifyContent_Test1')
Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('JustifyContent_Test2')
Column(){Text('3')}.width(300).height(150).backgroundColor(0xffa500).key('JustifyContent_Test3')
}.key('ColumnJustifyContentChange1').width(350).height(400).backgroundColor(0xAFEEEE).justifyContent(this.testJustifyContent)
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../common/MessageManager';
@Entry
@Component
struct Column_MarPad_ChangeParent {
@State testMargin: number = 0
@State testPadding: number = 0
messageManager:MessageManager = new MessageManager()
private content: string = "Column_MarPad_ChangeParent Page"
onPageShow() {
console.info('Column_MarPad_ChangeParent page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'margin') {
this.testMargin = message.value;
}
if (message.name == 'padding') {
this.testPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Column_MarPad_ChangeParent page build done called');
}
build() {
Column({space:30}) {
Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('MarPad_Test1')
Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('MarPad_Test2')
Column(){Text('3')}.width(300).height(150).backgroundColor(0xffa500).key('MarPad_Test3')
}.key('ColumnMarPadChange1').width(350).height(400).backgroundColor(0xAFEEEE).margin(this.testMargin).padding(this.testPadding)
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../common/MessageManager';
@Entry
@Component
struct Column_Margin_ChangeParent {
@State testMargin: number = 0
messageManager:MessageManager = new MessageManager()
private content: string = "Column_Margin_ChangeParent Page"
onPageShow() {
console.info('Column_Margin_ChangeParent page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'margin') {
this.testMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Column_Margin_ChangeParent page build done called');
}
build() {
Column({space:30}) {
Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('Margin_Test1')
Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('Margin_Test2')
Column(){Text('3')}.width(300).height(150).backgroundColor(0xffa500).key('Margin_Test3')
}.key('ColumnMarginChange1').width(350).height(400).backgroundColor(0xAFEEEE).margin(this.testMargin)
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../common/MessageManager';
@Entry
@Component
struct Column_Padding_ChangeParent {
@State testPadding: number = 0
messageManager:MessageManager = new MessageManager()
private content: string = "Column_Padding_ChangeParent Page"
onPageShow() {
console.info('Column_Padding_ChangeParent page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'padding') {
this.testPadding = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Column_Padding_ChangeParent page build done called');
}
build() {
Column({space:30}) {
Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('Padding_Test1')
Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('Padding_Test2')
Column(){Text('3')}.width(300).height(150).backgroundColor(0xffa500).key('Padding_Test3')
}.key('ColumnPaddingChange1').width(350).height(400).backgroundColor(0xAFEEEE).padding(this.testPadding)
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../common/MessageManager';
@Entry
@Component
struct Column_WidthHeight_ChangeParent {
@State testHeight: number = 150
@State testWidth: number = 450
messageManager:MessageManager = new MessageManager()
private content: string = "Column_WidthHeight_ChangeParent Page"
onPageShow() {
console.info('Column_WidthHeight_ChangeParent page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'height') {
this.testHeight = message.value;
}
if (message.name == 'width') {
this.testWidth = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Column_WidthHeight_ChangeParent page build done called');
}
build() {
Column({space:30}) {
Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('WidthHeight_Test1')
Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('WidthHeight_Test2')
Column(){Text('3')}.width(300).height(150).backgroundColor(0xffa500).key('WidthHeight_Test3')
}.key('ColumnWidthHeightChange1').width(this.testWidth).height(this.testHeight).backgroundColor(0xAFEEEE)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../MainAbility/common/MessageManager';
export default function column_AlignItems_ChangeParent() {
describe('Column_AlignItems_ChangeParentTest', function () {
beforeEach(async function (done) {
console.info("Column_AlignItems_ChangeParent beforeEach called");
let options = {
uri: 'MainAbility/pages/Column/ParentComponentChanged/Column_AlignItems_ChangeParent',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get Column_AlignItems_ChangeParent state pages:" + JSON.stringify(pages));
if (!("Column_AlignItems_ChangeParent" == pages.name)) {
console.info("get Column_AlignItems_ChangeParent state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push Column_AlignItems_ChangeParent page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Column_AlignItems_ChangeParent page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Column_AlignItems_ChangeParent afterEach called");
});
/**
* @tc.number SUB_ACE_COLUMN_ALIGNITEMS_CHANGEPARENT_TEST_0100
* @tc.name testColumnAlignItemsChangeParentHorizontalAlignStart
* @tc.desc The parent component is bound to alignItems property HorizontalAlign.Start. Other parameters are default
*/
it('testColumnAlignItemsChangeParentHorizontalAlignStart', 0, async function (done) {
console.info('new testColumnAlignItemsChangeParentHorizontalAlignStart START');
globalThis.value.message.notify({name:'alignItems', value:HorizontalAlign.Start})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnAlignItemsChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('AlignItems_Test1');
let locationText2 = CommonFunc.getComponentRect('AlignItems_Test2');
let locationText3 = CommonFunc.getComponentRect('AlignItems_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnAlignItemsChange1');
expect(locationText1.left).assertEqual(locationColumn.left);
expect(locationText1.left).assertEqual(locationText2.left);
expect(locationText2.left).assertEqual(locationText3.left);
expect(Math.round(locationColumn.right - locationText1.right)).assertEqual(vp2px(50));
expect(locationText1.top).assertEqual(locationColumn.top);
expect(Math.round(locationColumn.bottom - locationText3.bottom)).assertEqual(vp2px(40));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnAlignItemsChangeParentHorizontalAlignStart END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_ALIGNITEMS_CHANGEPARENT_TEST_0200
* @tc.name testColumnAlignItemsChangeParentHorizontalAlignEnd
* @tc.desc The parent component is bound to alignItems property HorizontalAlign.End. Other parameters are default
*/
it('testColumnAlignItemsChangeParentHorizontalAlignEnd', 0, async function (done) {
console.info('new testColumnAlignItemsChangeParentHorizontalAlignEnd START');
globalThis.value.message.notify({name:'alignItems', value:HorizontalAlign.End})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnAlignItemsChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('AlignItems_Test1');
let locationText2 = CommonFunc.getComponentRect('AlignItems_Test2');
let locationText3 = CommonFunc.getComponentRect('AlignItems_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnAlignItemsChange1');
expect(locationText1.right).assertEqual(locationColumn.right);
expect(locationText1.right).assertEqual(locationText2.right);
expect(locationText2.right).assertEqual(locationText3.right);
expect(Math.round(locationText1.left - locationColumn.left)).assertEqual(vp2px(50));
expect(locationText1.top).assertEqual(locationColumn.top);
expect(Math.round(locationColumn.bottom - locationText3.bottom)).assertEqual(vp2px(40));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnAlignItemsChangeParentHorizontalAlignEnd END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../MainAbility/common/MessageManager';
export default function column_JustifyContent_ChangeParent() {
describe('Column_JustifyContent_ChangeParentTest', function () {
beforeEach(async function (done) {
console.info("Column_JustifyContent_ChangeParent beforeEach called");
let options = {
uri: 'MainAbility/pages/Column/ParentComponentChanged/Column_JustifyContent_ChangeParent',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get Column_JustifyContent_ChangeParent state pages:" + JSON.stringify(pages));
if (!("Column_JustifyContent_ChangeParent" == pages.name)) {
console.info("get Column_JustifyContent_ChangeParent state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push Column_JustifyContent_ChangeParent page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Column_JustifyContent_ChangeParent page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Column_JustifyContent_ChangeParent afterEach called");
});
/**
* @tc.number SUB_ACE_COLUMN_JUSTIFYCONTENT_CHANGEPARENT_TEST_0100
* @tc.name testColumnJustifyContentChangeParentFlexAlignCenter
* @tc.desc The parent component is bound to justifyContent property FlexAlign.Center. Other parameters are default
*/
it('testColumnJustifyContentChangeParentFlexAlignCenter', 0, async function (done) {
console.info('new testColumnJustifyContentChangeParentFlexAlignCenter START');
globalThis.value.message.notify({name:'justifyContent', value:FlexAlign.Center})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnJustifyContentChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('JustifyContent_Test1');
let locationText2 = CommonFunc.getComponentRect('JustifyContent_Test2');
let locationText3 = CommonFunc.getComponentRect('JustifyContent_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnJustifyContentChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.top - locationColumn.top)).assertEqual(vp2px(20));
expect(Math.round(locationColumn.bottom - locationText3.bottom)).assertEqual(vp2px(20));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnJustifyContentChangeParentFlexAlignCenter END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_JUSTIFYCONTENT_CHANGEPARENT_TEST_0200
* @tc.name testColumnJustifyContentChangeParentFlexAlignEnd
* @tc.desc The parent component is bound to justifyContent property FlexAlign.End. Other parameters are default
*/
it('testColumnJustifyContentChangeParentFlexAlignEnd', 0, async function (done) {
console.info('new testColumnJustifyContentChangeParentFlexAlignEnd START');
globalThis.value.message.notify({name:'justifyContent', value:FlexAlign.End})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnJustifyContentChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('JustifyContent_Test1');
let locationText2 = CommonFunc.getComponentRect('JustifyContent_Test2');
let locationText3 = CommonFunc.getComponentRect('JustifyContent_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnJustifyContentChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.top - locationColumn.top)).assertEqual(vp2px(40));
expect(locationText3.bottom).assertEqual(locationColumn.bottom);
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnJustifyContentChangeParentFlexAlignEnd END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_JUSTIFYCONTENT_CHANGEPARENT_TEST_0300
* @tc.name testColumnJustifyContentChangeParentFlexAlignSpaceBetween
* @tc.desc The parent component is bound to justifyContent property FlexAlign.SpaceBetween. Other parameters are default
*/
it('testColumnJustifyContentChangeParentFlexAlignSpaceBetween', 0, async function (done) {
console.info('new testColumnJustifyContentChangeParentFlexAlignSpaceBetween START');
globalThis.value.message.notify({name:'justifyContent', value:FlexAlign.SpaceBetween})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnJustifyContentChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('JustifyContent_Test1');
let locationText2 = CommonFunc.getComponentRect('JustifyContent_Test2');
let locationText3 = CommonFunc.getComponentRect('JustifyContent_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnJustifyContentChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(locationText1.top).assertEqual(locationColumn.top);
expect(locationText3.bottom).assertEqual(locationColumn.bottom);
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(50));
//Known issues with use case notes
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnJustifyContentChangeParentFlexAlignSpaceBetween END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_JUSTIFYCONTENT_CHANGEPARENT_TEST_0400
* @tc.name testColumnJustifyContentChangeParentFlexAlignSpaceAround
* @tc.desc The parent component is bound to justifyContent property FlexAlign.SpaceAround. Other parameters are default
*/
it('testColumnJustifyContentChangeParentFlexAlignSpaceAround', 0, async function (done) {
console.info('new testColumnJustifyContentChangeParentFlexAlignSpaceAround START');
globalThis.value.message.notify({name:'justifyContent', value:FlexAlign.SpaceAround})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnJustifyContentChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('JustifyContent_Test1');
let locationText2 = CommonFunc.getComponentRect('JustifyContent_Test2');
let locationText3 = CommonFunc.getComponentRect('JustifyContent_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnJustifyContentChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(vp2px(100/3)));//Known issues with use case notes
expect(Math.round(locationText1.top - locationColumn.top))
.assertEqual(Math.round(locationColumn.bottom - locationText3.bottom));
expect(Math.round(locationText1.top - locationColumn.top)).assertEqual(Math.round(vp2px(50/3)));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnJustifyContentChangeParentFlexAlignSpaceAround END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_JUSTIFYCONTENT_CHANGEPARENT_TEST_0500
* @tc.name testColumnJustifyContentChangeParentFlexAlignSpaceEvenly
* @tc.desc The parent component is bound to justifyContent property FlexAlign.SpaceEvenly. Other parameters are default
*/
it('testColumnJustifyContentChangeParentFlexAlignSpaceEvenly', 0, async function (done) {
console.info('new testColumnJustifyContentChangeParentFlexAlignSpaceEvenly START');
globalThis.value.message.notify({name:'justifyContent', value:FlexAlign.SpaceEvenly})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnJustifyContentChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('JustifyContent_Test1');
let locationText2 = CommonFunc.getComponentRect('JustifyContent_Test2');
let locationText3 = CommonFunc.getComponentRect('JustifyContent_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnJustifyContentChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText1.top - locationColumn.top))
.assertEqual(Math.round(locationColumn.bottom - locationText3.bottom));
expect(Math.round(locationText1.top - locationColumn.top))
.assertEqual(Math.round(locationText2.top - locationText1.bottom));//Known issues with use case notes
expect(Math.round((locationText1.top - locationColumn.top)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnJustifyContentChangeParentFlexAlignSpaceEvenly END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../MainAbility/common/MessageManager';
export default function column_MarPad_ChangeParent() {
describe('Column_MarPad_ChangeParentTest', function () {
beforeEach(async function (done) {
console.info("text beforeEach start");
let options = {
uri: 'MainAbility/pages/Column/ParentComponentChanged/Column_MarPad_ChangeParent',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get Column_MarPad_ChangeParent state pages:" + JSON.stringify(pages));
if (!("Column_MarPad_ChangeParent" == pages.name)) {
console.info("get Column_MarPad_ChangeParent state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push Column_MarPad_ChangeParent page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Column_MarPad_ChangeParent page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Column_MarPad_ChangeParent after each called");
});
/**
* @tc.number SUB_ACE_COLUMN_MARPAD_CHANGEPARENT_TEST_0100
* @tc.name testColumnMarPadChangeParentInRange
* @tc.desc The parent component is bound with the margin and padding attributes. Other parameters are default,
* the remaining space of the parent component meets the layout of the child components
*/
it('testColumnMarPadChangeParentInRange', 0, async function (done) {
console.info('new testColumnMarPadChangeParentInRange START');
globalThis.value.message.notify({name:'margin', value:5})
globalThis.value.message.notify({name:'padding', value:20})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnMarPadChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('MarPad_Test1');
let locationText2 = CommonFunc.getComponentRect('MarPad_Test2');
let locationText3 = CommonFunc.getComponentRect('MarPad_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnMarPadChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.top - locationColumn.top)).assertEqual(vp2px(20));
expect(Math.round(locationColumn.bottom - locationText3.bottom)).assertEqual(vp2px(20));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnMarPadChangeParentInRange END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_MARPAD_CHANGEPARENT_TEST_0200
* @tc.name testColumnMarPadChangeParentOutRange
* @tc.desc The parent component is bound with the margin and padding attributes. Other parameters are default,
* the remaining space of the parent component does not meet the layout of the child components
*/
it('testColumnMarPadChangeParentOutRange', 0, async function (done) {
console.info('new testColumnMarPadChangeParentOutRange START');
globalThis.value.message.notify({name:'margin', value:5})
globalThis.value.message.notify({name:'padding', value:50})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnMarPadChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('MarPad_Test1');
let locationText2 = CommonFunc.getComponentRect('MarPad_Test2');
let locationText3 = CommonFunc.getComponentRect('MarPad_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnMarPadChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.top - locationColumn.top)).assertEqual(vp2px(50));
expect(Math.round(locationText3.bottom - locationColumn.bottom)).assertEqual(vp2px(10));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnMarPadChangeParentOutRange END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../MainAbility/common/MessageManager';
export default function column_Margin_ChangeParent() {
describe('Column_Margin_ChangeParentTest', function () {
beforeEach(async function (done) {
console.info("text beforeEach start");
let options = {
uri: 'MainAbility/pages/Column/ParentComponentChanged/Column_Margin_ChangeParent',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get Column_Margin_ChangeParent state pages:" + JSON.stringify(pages));
if (!("Column_Margin_ChangeParent" == pages.name)) {
console.info("get Column_Margin_ChangeParent state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push Column_Margin_ChangeParent page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Column_Margin_ChangeParent page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Column_Margin_ChangeParent after each called");
});
/**
* @tc.number SUB_ACE_COLUMN_MARGIN_CHANGEPARENT_TEST_0100
* @tc.name testColumnMarginChangeParent
* @tc.desc The parent component is bound with the margin attributes. Other parameters are default
*/
it('testColumnMarginChangeParent', 0, async function (done) {
console.info('new testColumnMarginChangeParent START');
globalThis.value.message.notify({name:'margin', value:10})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnMarginChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('Margin_Test1');
let locationText2 = CommonFunc.getComponentRect('Margin_Test2');
let locationText3 = CommonFunc.getComponentRect('Margin_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnMarginChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.top - locationColumn.top)).assertEqual(vp2px(0));
expect(Math.round(locationColumn.bottom - locationText3.bottom)).assertEqual(vp2px(40));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnMarginChangeParent END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../MainAbility/common/MessageManager';
export default function column_Padding_ChangeParent() {
describe('Column_Padding_ChangeParentTest', function () {
beforeEach(async function (done) {
console.info("Column_Padding_ChangeParent beforeEach called");
let options = {
uri: 'MainAbility/pages/Column/ParentComponentChanged/Column_Padding_ChangeParent',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get Column_Padding_ChangeParent state pages:" + JSON.stringify(pages));
if (!("Column_Padding_ChangeParent" == pages.name)) {
console.info("get Column_Padding_ChangeParent state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push Column_Padding_ChangeParent page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Column_Padding_ChangeParent page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Column_Padding_ChangeParent afterEach called");
});
/**
* @tc.number SUB_ACE_COLUMN_PADDING_CHANGEPARENT_TEST_0100
* @tc.name testColumnPaddingChangeParentInRange
* @tc.desc The parent component is bound with the padding attributes. Other parameters are default,
* the remaining space of the parent component meets the layout of the child components
*/
it('testColumnPaddingChangeParentInRange', 0, async function (done) {
console.info('new testColumnPaddingChangeParentInRange START');
globalThis.value.message.notify({name:'padding', value:20})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnPaddingChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('Padding_Test1');
let locationText2 = CommonFunc.getComponentRect('Padding_Test2');
let locationText3 = CommonFunc.getComponentRect('Padding_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnPaddingChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.top - locationColumn.top)).assertEqual(vp2px(20));
expect(Math.round(locationColumn.bottom - locationText3.bottom)).assertEqual(vp2px(20));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnPaddingChangeParentInRange END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_PADDING_CHANGEPARENT_TEST_0200
* @tc.name testColumnPaddingChangeParentOutRange
* @tc.desc The parent component is bound with the padding attributes. Other parameters are default,
* the remaining space of the parent component does not meet the layout of the child components
*/
it('testColumnPaddingChangeParentOutRange', 0, async function (done) {
console.info('new testColumnPaddingChangeParentOutRange START');
globalThis.value.message.notify({name:'padding', value:50})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnPaddingChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('Padding_Test1');
let locationText2 = CommonFunc.getComponentRect('Padding_Test2');
let locationText3 = CommonFunc.getComponentRect('Padding_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnPaddingChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.top - locationColumn.top)).assertEqual(vp2px(50));
expect(Math.round(locationText3.bottom - locationColumn.bottom)).assertEqual(vp2px(10));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnPaddingChangeParentOutRange END');
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import router from '@system.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { MessageManager, Callback } from '../../../MainAbility/common/MessageManager';
export default function column_WidthHeight_ChangeParent() {
describe('Column_WidthHeight_ChangeParentTest', function () {
beforeEach(async function (done) {
console.info("Column_WidthHeight_ChangeParent beforeEach called");
let options = {
uri: 'MainAbility/pages/Column/ParentComponentChanged/Column_WidthHeight_ChangeParent',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get Column_WidthHeight_ChangeParent state pages:" + JSON.stringify(pages));
if (!("Column_WidthHeight_ChangeParent" == pages.name)) {
console.info("get Column_WidthHeight_ChangeParent state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push Column_WidthHeight_ChangeParent page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Column_WidthHeight_ChangeParent page error:" + JSON.stringify(err));
}
await CommonFunc.sleep(2000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("Column_WidthHeight_ChangeParent afterEach called");
});
/**
* @tc.number SUB_ACE_COLUMN_WIDTHHEIGHT_CHANGEPARENT_TEST_0100
* @tc.name testColumnWidthHeightChangeParentHeightInRange
* @tc.desc The parent component changes the width 350 and height 400 attributes, Other parameters default
*/
it('testColumnWidthHeightChangeParentHeightInRange', 0, async function (done) {
console.info('new testColumnWidthHeightChangeParentHeightInRange START');
globalThis.value.message.notify({name:'height', value:400})
globalThis.value.message.notify({name:'width', value:350})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnWidthHeightChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('WidthHeight_Test1');
let locationText2 = CommonFunc.getComponentRect('WidthHeight_Test2');
let locationText3 = CommonFunc.getComponentRect('WidthHeight_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnWidthHeightChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(locationText1.top).assertEqual(locationColumn.top);
expect(Math.round(locationColumn.bottom - locationText3.bottom)).assertEqual(vp2px(40));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnWidthHeightChangeParentHeightInRange END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_WIDTHHEIGHT_CHANGEPARENT_TEST_0200
* @tc.name testColumnWidthHeightChangeParentHeightOutRange
* @tc.desc The parent component changes the width 350 and height 300 attributes,Other parameters default
*/
it('testColumnWidthHeightChangeParentHeightOutRange', 0, async function (done) {
console.info('new testColumnWidthHeightChangeParentHeightOutRange START');
globalThis.value.message.notify({name:'height', value:300})
globalThis.value.message.notify({name:'width', value:350})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnWidthHeightChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('WidthHeight_Test1');
let locationText2 = CommonFunc.getComponentRect('WidthHeight_Test2');
let locationText3 = CommonFunc.getComponentRect('WidthHeight_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnWidthHeightChange1');
expect(Math.round((locationText1.left - locationColumn.left)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(Math.round(locationText1.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText1.right));
expect(Math.round(locationText2.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText2.right));
expect(Math.round(locationText3.left - locationColumn.left))
.assertEqual(Math.round(locationColumn.right - locationText3.right));
expect(Math.round((locationColumn.right - locationText1.right)*10)/10).assertEqual(Math.round(vp2px(25)*10)/10);
expect(locationText1.top).assertEqual(locationColumn.top);
expect(Math.round(locationText3.bottom - locationColumn.bottom)).assertEqual(vp2px(60));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnWidthHeightChangeParentHeightOutRange END');
done();
});
/**
* @tc.number SUB_ACE_COLUMN_WIDTHHEIGHT_CHANGEPARENT_TEST_0300
* @tc.name testColumnWidthHeightChangeParentWidthOutRange
* @tc.desc The parent component changes the width 200 and height 400 attributes,Other parameters default
*/
it('testColumnWidthHeightChangeParentWidthOutRange', 0, async function (done) {
console.info('new testColumnWidthHeightChangeParentWidthOutRange START');
globalThis.value.message.notify({name:'height', value:400})
globalThis.value.message.notify({name:'width', value:200})
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('ColumnWidthHeightChange1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Column');
let locationText1 = CommonFunc.getComponentRect('WidthHeight_Test1');
let locationText2 = CommonFunc.getComponentRect('WidthHeight_Test2');
let locationText3 = CommonFunc.getComponentRect('WidthHeight_Test3');
let locationColumn = CommonFunc.getComponentRect('ColumnWidthHeightChange1');
expect(Math.round(locationColumn.left - locationText1.left)).assertEqual(vp2px(50));
expect(Math.round(locationColumn.left - locationText1.left))
.assertEqual(Math.round(locationText1.right - locationColumn.right));
expect(Math.round(locationColumn.left - locationText2.left))
.assertEqual(Math.round(locationText2.right - locationColumn.right));
expect(Math.round(locationColumn.left - locationText3.left))
.assertEqual(Math.round(locationText3.right - locationColumn.right));
expect(Math.round(locationText1.right - locationColumn.right)).assertEqual(vp2px(50));
expect(locationText1.top).assertEqual(locationColumn.top);
expect(Math.round(locationColumn.bottom - locationText3.bottom)).assertEqual(vp2px(40));
expect(Math.round(locationText2.top - locationText1.bottom))
.assertEqual(Math.round(locationText3.top - locationText2.bottom));
expect(Math.round(locationText2.top - locationText1.bottom)).assertEqual(vp2px(30));
expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(300));
expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(300));
expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300));
expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50));
expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100));
expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150));
console.info('new testColumnWidthHeightChangeParentWidthOutRange END');
done();
});
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册