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

!7867 XTS Arkui Stack组件 代码提交

Merge pull request !7867 from 张海霖/zhl_08
/**
* 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 stackMarginChange {
@State testMargin: number = 0
@State testAlignContentValue: number = Alignment.Center
messageManager:MessageManager = new MessageManager()
private content: string = "stackMarginChange Page";
onPageShow() {
console.info('stackMarginChange onPageShow');
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 == 'alignContent') {
this.testAlignContentValue = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('StackSizeChange page build done called');
}
build() {
Column(){
Stack({alignContent: this.testAlignContentValue}) {
Text('1').width(200).height(200).backgroundColor(0xF5DEB3).key('stackMarginKey01')
}.width(300).height(300).backgroundColor(0xAFEEEE).key('stackMarginKey').margin(this.testMargin)
}.alignItems(HorizontalAlign.Start)
}
}
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager,Callback } from '../../../common/MessageManager';
@Entry
@Component
struct StackNoneSettingWidthHeight {
@State testAlignContentValue: number = Alignment.Center
messageManager:MessageManager = new MessageManager()
private content: string = "StackNoneSettingWidthHeight Page";
onPageShow() {
console.info('StackNoneSettingWidthHeight onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'alignContent') {
this.testAlignContentValue = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('StackNoneSettingWidthHeight page build done called');
}
build() {
Column(){
Stack({alignContent: this.testAlignContentValue}) {
Text('1').width(200).height(200).backgroundColor(0xF5DEB3).key('stackSizeDefaultKey01')
}.backgroundColor(0xAFEEEE).key('stackSizeDefaultKey')
}.alignItems(HorizontalAlign.Start)
}
}
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager,Callback } from '../../../common/MessageManager';
@Entry
@Component
struct StackPaddingChange {
@State testPadding: number = 0
@State testAlignContentValue: number = Alignment.Center
messageManager:MessageManager = new MessageManager()
private content: string = "StackPaddingChange Page";
onPageShow() {
console.info('StackPaddingChange onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'padding') {
this.testPadding = message.value;
}
if (message.name == 'alignContent') {
this.testAlignContentValue = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('StackPaddingChange page build done called');
}
build() {
Column(){
Stack({alignContent: this.testAlignContentValue}) {
Text('1').width(250).height(250).backgroundColor(0xF5DEB3).key('stackPaddingKey01')
}.width(300).height(300).backgroundColor(0xAFEEEE).key('stackPaddingKey').padding(this.testPadding)
}.alignItems(HorizontalAlign.Start)
}
}
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager,Callback } from '../../../common/MessageManager';
@Entry
@Component
struct StackSizeChange {
@State testHeight: number = 500
@State testWidth: number = 500
@State testAlignContentValue: number = Alignment.Center
messageManager:MessageManager = new MessageManager()
private content: string = "StackSizeChange Page";
onPageShow() {
console.info('StackSizeChange onPageShow');
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;
}
if (message.name == 'alignContent') {
this.testAlignContentValue = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('StackSizeChange page build done called');
}
build() {
Column(){
Column(){
Stack({alignContent: this.testAlignContentValue}) {
Text('1').width(200).height(200).backgroundColor(0xF5DEB3).key('stackSizeKey01')
}.width(this.testWidth).height(this.testHeight).backgroundColor(0xAFEEEE).key('stackSizeKey')
}.alignItems(HorizontalAlign.Start)
}.width(500).height(500).backgroundColor(0xc1cbac)
}
}
/**
* 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 stackMarginChange() {
describe('stackMarginChangeTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Stack/Stack_change/stackMarginChange',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get stackMarginChange state success " + JSON.stringify(pages));
if (!("stackMarginChange" == pages.name)) {
console.info("get stackMarginChange state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push stackMarginChange page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push stackMarginChange page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("stackMarginChange after each called");
});
/**
* @tc.number SUB_ACE_STACK_ALIGNMARGINCHANGED_0100
* @tc.name testStackMarginAlignContentTopStart
* @tc.desc Set stack's margin 20 and alignContent mode 'TopStart'.
*/
it('testStackMarginAlignContentTopStart', 0, async function (done) {
console.info('new testStackMarginAlignContentTopStart START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.TopStart});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackMarginKey');
let obj = JSON.parse(strJson);
let stackMarginKey = CommonFunc.getComponentRect('stackMarginKey');
let stackMarginKey01 = CommonFunc.getComponentRect('stackMarginKey01');
expect(stackMarginKey01.left) .assertEqual (stackMarginKey.left)
expect(stackMarginKey01.top) .assertEqual (stackMarginKey.top)
expect(Math.round(stackMarginKey.right - stackMarginKey01.right)).assertEqual(vp2px(100))
expect(Math.round(stackMarginKey.bottom - stackMarginKey01.bottom)).assertEqual(vp2px(100))
expect(Math.round(stackMarginKey01.right - stackMarginKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.TopStart')
console.info('new testStackMarginAlignContentTopStart END');
done();
});
/**
* @tc.number SUB_ACE_STACK_ALIGNMARGINCHANGED_0200
* @tc.name testStackMarginAlignContentTop
* @tc.desc Set stack's margin 20 and alignContent mode 'Top'.
*/
it('testStackMarginAlignContentTop', 0, async function (done) {
console.info('new testStackMarginAlignContentTop START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.Top});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackMarginKey');
let obj = JSON.parse(strJson);
let stackMarginKey = CommonFunc.getComponentRect('stackMarginKey');
let stackMarginKey01 = CommonFunc.getComponentRect('stackMarginKey01');
expect(Math.round(stackMarginKey01.left - stackMarginKey.left)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey.right - stackMarginKey01.right)).assertEqual(vp2px(50))
expect(stackMarginKey01.top) .assertEqual (stackMarginKey.top)
expect(Math.round(stackMarginKey.bottom - stackMarginKey01.bottom)).assertEqual(vp2px(100))
expect(Math.round(stackMarginKey01.right - stackMarginKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.Top')
console.info('new testStackMarginAlignContentTop END');
done();
});
/**
* @tc.number SUB_ACE_STACK_ALIGNMARGINCHANGED_0300
* @tc.name testStackMarginAlignContentTopEnd
* @tc.desc Set stack's margin 20 and alignContent mode 'TopEnd'.
*/
it('testStackMarginAlignContentTopEnd', 0, async function (done) {
console.info('new testStackMarginAlignContentTopEnd START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.TopEnd});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackMarginKey');
let obj = JSON.parse(strJson);
let stackMarginKey = CommonFunc.getComponentRect('stackMarginKey');
let stackMarginKey01 = CommonFunc.getComponentRect('stackMarginKey01');
expect(Math.round(stackMarginKey01.left - stackMarginKey.left)).assertEqual(vp2px(100))
expect(stackMarginKey01.right) .assertEqual (stackMarginKey.right)
expect(stackMarginKey01.top) .assertEqual (stackMarginKey.top)
expect(Math.round(stackMarginKey.bottom - stackMarginKey01.bottom)).assertEqual(vp2px(100))
expect(Math.round(stackMarginKey01.right - stackMarginKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.TopEnd')
console.info('new testStackMarginAlignContentTopEnd END');
done();
});
/**
* @tc.number SUB_ACE_STACK_ALIGNMARGINCHANGED_0400
* @tc.name testStackMarginAlignContentStart
* @tc.desc Set stack's margin 20 and alignContent mode 'START'.
*/
it('testStackMarginAlignContentStart', 0, async function (done) {
console.info('new testStackMarginAlignContentStart START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.Start});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackMarginKey');
let obj = JSON.parse(strJson);
let stackMarginKey = CommonFunc.getComponentRect('stackMarginKey');
let stackMarginKey01 = CommonFunc.getComponentRect('stackMarginKey01');
expect(stackMarginKey01.left) .assertEqual (stackMarginKey.left)
expect(Math.round(stackMarginKey.right - stackMarginKey01.right)).assertEqual(vp2px(100))
expect(Math.round(stackMarginKey01.top - stackMarginKey.top)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey.bottom - stackMarginKey01.bottom)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey01.right - stackMarginKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.Start')
console.info('new testStackMarginAlignContentStart END');
done();
});
/**
* @tc.number SUB_ACE_STACK_ALIGNMARGINCHANGED_0500
* @tc.name testStackMarginAlignContentCenter
* @tc.desc Set stack's margin 20 and alignContent mode 'Center'.
*/
it('testStackMarginAlignContentCenter', 0, async function (done) {
console.info('new testStackMarginAlignContentCenter START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.Center});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackMarginKey');
let obj = JSON.parse(strJson);
let stackMarginKey = CommonFunc.getComponentRect('stackMarginKey');
let stackMarginKey01 = CommonFunc.getComponentRect('stackMarginKey01');
expect(Math.round(stackMarginKey01.left - stackMarginKey.left)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey.right - stackMarginKey01.right)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey01.top - stackMarginKey.top)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey.bottom - stackMarginKey01.bottom)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey01.right - stackMarginKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.Center')
console.info('new testStackMarginAlignContentCenter END');
done();
});
/**
* @tc.number SUB_ACE_STACK_ALIGNMARGINCHANGED_0600
* @tc.name testStackMarginAlignContentEnd
* @tc.desc Set stack's margin 20 and alignContent mode 'End'.
*/
it('testStackMarginAlignContentEnd', 0, async function (done) {
console.info('new testStackMarginAlignContentEnd START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.End});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackMarginKey');
let obj = JSON.parse(strJson);
let stackMarginKey = CommonFunc.getComponentRect('stackMarginKey');
let stackMarginKey01 = CommonFunc.getComponentRect('stackMarginKey01');
expect(Math.round(stackMarginKey01.left - stackMarginKey.left)).assertEqual(vp2px(100))
expect(stackMarginKey01.right) .assertEqual (stackMarginKey.right)
expect(Math.round(stackMarginKey01.top - stackMarginKey.top)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey.bottom - stackMarginKey01.bottom)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey01.right - stackMarginKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.End')
console.info('new testStackMarginAlignContentEnd END');
done();
});
/**
* @tc.number SUB_ACE_STACK_ALIGNMARGINCHANGED_0700
* @tc.name testStackMarginAlignContentBottomStart
* @tc.desc Set stack's margin 20 and alignContent mode 'BottomStart'.
*/
it('testStackMarginAlignContentBottomStart', 0, async function (done) {
console.info('new testStackMarginAlignContentBottomStart START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.BottomStart});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackMarginKey');
let obj = JSON.parse(strJson);
let stackMarginKey = CommonFunc.getComponentRect('stackMarginKey');
let stackMarginKey01 = CommonFunc.getComponentRect('stackMarginKey01');
expect(stackMarginKey01.left) .assertEqual (stackMarginKey.left)
expect(Math.round(stackMarginKey.right - stackMarginKey01.right)).assertEqual(vp2px(100))
expect(Math.round(stackMarginKey01.top - stackMarginKey.top)).assertEqual(vp2px(100))
expect(stackMarginKey01.bottom) .assertEqual (stackMarginKey.bottom)
expect(Math.round(stackMarginKey01.right - stackMarginKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.BottomStart')
console.info('new testStackMarginAlignContentBottomStart END');
done();
});
/**
* @tc.number SUB_ACE_STACK_ALIGNMARGINCHANGED_0800
* @tc.name testStackMarginAlignContentBottom
* @tc.desc Set stack's margin 20 and alignContent mode 'Bottom'.
*/
it('testStackMarginAlignContentBottom', 0, async function (done) {
console.info('new testStackMarginAlignContentBottom START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.Bottom});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackMarginKey');
let obj = JSON.parse(strJson);
let stackMarginKey = CommonFunc.getComponentRect('stackMarginKey');
let stackMarginKey01 = CommonFunc.getComponentRect('stackMarginKey01');
expect(Math.round(stackMarginKey01.left - stackMarginKey.left)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey.right - stackMarginKey01.right)).assertEqual(vp2px(50))
expect(Math.round(stackMarginKey01.top - stackMarginKey.top)).assertEqual(vp2px(100))
expect(stackMarginKey01.bottom) .assertEqual (stackMarginKey.bottom)
expect(Math.round(stackMarginKey01.right - stackMarginKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.Bottom')
console.info('new testStackMarginAlignContentBottom END');
done();
});
/**
* @tc.number SUB_ACE_STACK_ALIGNMARGINCHANGED_0900
* @tc.name testStackMarginAlignContentBottomEnd
* @tc.desc Set stack's margin 20 and alignContent mode 'BottomEnd'.
*/
it('testStackMarginAlignContentBottomEnd', 0, async function (done) {
console.info('new testStackMarginAlignContentBottomEnd START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.BottomEnd});
globalThis.value.message.notify({name:'margin', value:20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackMarginKey');
let obj = JSON.parse(strJson);
let stackMarginKey = CommonFunc.getComponentRect('stackMarginKey');
let stackMarginKey01 = CommonFunc.getComponentRect('stackMarginKey01');
expect(Math.round(stackMarginKey01.left - stackMarginKey.left)).assertEqual(vp2px(100))
expect(stackMarginKey01.right) .assertEqual (stackMarginKey.right)
expect(Math.round(stackMarginKey01.top - stackMarginKey.top)).assertEqual(vp2px(100))
expect(stackMarginKey01.bottom) .assertEqual (stackMarginKey.bottom)
expect(Math.round(stackMarginKey01.right - stackMarginKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.BottomEnd')
console.info('new testStackMarginAlignContentBottomEnd 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 stackNoneSettingWidthHeight() {
describe('stackNoneSettingWidthHeightTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Stack/Stack_change/stackNoneSettingWidthHeight',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get stackNoneSettingWidthHeight state success " + JSON.stringify(pages));
if (!("stackNoneSettingWidthHeight" == pages.name)) {
console.info("get stackNoneSettingWidthHeight state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push stackNoneSettingWidthHeight page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push stackNoneSettingWidthHeight page error " + JSON.stringify(err));
}
await CommonFunc.sleep(1000);
done()
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("stackNoneSettingWidthHeight after each called");
});
/**
* @tc.number SUB_ACE_STACK_DEFAULTHEIGHTWIDTH_0100
* @tc.name testStackDefaultSizeAlignContentTopStart
* @tc.desc Set stack's default height and width ,set alignContent mode 'TopStart'.
*/
it('testStackDefaultSizeAlignContentTopStart', 0, async function (done) {
console.info('new testStackDefaultSizeAlignContentTopStart START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.TopStart});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackSizeDefaultKey');
let obj = JSON.parse(strJson);
let stackSizeDefaultKey = CommonFunc.getComponentRect('stackSizeDefaultKey');
let stackSizeDefaultKey01 = CommonFunc.getComponentRect('stackSizeDefaultKey01');
expect(stackSizeDefaultKey.left).assertEqual(stackSizeDefaultKey01.left)
expect(stackSizeDefaultKey.right).assertEqual(stackSizeDefaultKey01.right)
expect(stackSizeDefaultKey.top).assertEqual(stackSizeDefaultKey01.top)
expect(stackSizeDefaultKey.bottom).assertEqual(stackSizeDefaultKey01.bottom)
expect(Math.round(stackSizeDefaultKey01.right - stackSizeDefaultKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.TopStart')
console.info('new testStackDefaultSizeAlignContentTopStart END');
done();
});
/**
* @tc.number SUB_ACE_STACK_DEFAULTHEIGHTWIDTH_0200
* @tc.name testStackDefaultSizeAlignContentTop
* @tc.desc Set stack's default height and width ,set alignContent mode 'Top'.
*/
it('testStackDefaultSizeAlignContentTop', 0, async function (done) {
console.info('new testStackDefaultSizeAlignContentTop START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.Top});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackSizeDefaultKey');
let obj = JSON.parse(strJson);
let stackSizeDefaultKey = CommonFunc.getComponentRect('stackSizeDefaultKey');
let stackSizeDefaultKey01 = CommonFunc.getComponentRect('stackSizeDefaultKey01');
expect(stackSizeDefaultKey.left).assertEqual(stackSizeDefaultKey01.left)
expect(stackSizeDefaultKey.right).assertEqual(stackSizeDefaultKey01.right)
expect(stackSizeDefaultKey.top).assertEqual(stackSizeDefaultKey01.top)
expect(stackSizeDefaultKey.bottom).assertEqual(stackSizeDefaultKey01.bottom)
expect(Math.round(stackSizeDefaultKey01.right - stackSizeDefaultKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.Top')
console.info('new testStackDefaultSizeAlignContentTop END');
done();
});
/**
* @tc.number SUB_ACE_STACK_DEFAULTHEIGHTWIDTH_0300
* @tc.name testStackDefaultSizeAlignContentTopEnd
* @tc.desc Set stack's default height and width ,set alignContent mode 'TopEnd'.
*/
it('testStackDefaultSizeAlignContentTopEnd', 0, async function (done) {
console.info('new testStackDefaultSizeAlignContentTopEnd START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.TopEnd});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackSizeDefaultKey');
let obj = JSON.parse(strJson);
let stackSizeDefaultKey = CommonFunc.getComponentRect('stackSizeDefaultKey');
let stackSizeDefaultKey01 = CommonFunc.getComponentRect('stackSizeDefaultKey01');
expect(stackSizeDefaultKey.left).assertEqual(stackSizeDefaultKey01.left)
expect(stackSizeDefaultKey.right).assertEqual(stackSizeDefaultKey01.right)
expect(stackSizeDefaultKey.top).assertEqual(stackSizeDefaultKey01.top)
expect(stackSizeDefaultKey.bottom).assertEqual(stackSizeDefaultKey01.bottom)
expect(Math.round(stackSizeDefaultKey01.right - stackSizeDefaultKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.TopEnd')
console.info('new testStackDefaultSizeAlignContentTopEnd END');
done();
});
/**
* @tc.number SUB_ACE_STACK_DEFAULTHEIGHTWIDTH_0400
* @tc.name testStackDefaultSizeAlignContentStart
* @tc.desc Set stack's default height and width ,set alignContent mode 'START'.
*/
it('testStackDefaultSizeAlignContentStart', 0, async function (done) {
console.info('new testStackDefaultSizeAlignContentStart START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.Start});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackSizeDefaultKey');
let obj = JSON.parse(strJson);
let stackSizeDefaultKey = CommonFunc.getComponentRect('stackSizeDefaultKey');
let stackSizeDefaultKey01 = CommonFunc.getComponentRect('stackSizeDefaultKey01');
expect(stackSizeDefaultKey.left).assertEqual(stackSizeDefaultKey01.left)
expect(stackSizeDefaultKey.right).assertEqual(stackSizeDefaultKey01.right)
expect(stackSizeDefaultKey.top).assertEqual(stackSizeDefaultKey01.top)
expect(stackSizeDefaultKey.bottom).assertEqual(stackSizeDefaultKey01.bottom)
expect(Math.round(stackSizeDefaultKey01.right - stackSizeDefaultKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.Start')
console.info('new testStackDefaultSizeAlignContentStart END');
done();
});
/**
* @tc.number SUB_ACE_STACK_DEFAULTHEIGHTWIDTH_0500
* @tc.name testStackDefaultSizeAlignContentCenter
* @tc.desc Set stack's default height and width ,set alignContent mode 'Center'.
*/
it('testStackDefaultSizeAlignContentCenter', 0, async function (done) {
console.info('new testStackDefaultSizeAlignContentCenter START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.Center});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackSizeDefaultKey');
let obj = JSON.parse(strJson);
let stackSizeDefaultKey = CommonFunc.getComponentRect('stackSizeDefaultKey');
let stackSizeDefaultKey01 = CommonFunc.getComponentRect('stackSizeDefaultKey01');
expect(stackSizeDefaultKey.left).assertEqual(stackSizeDefaultKey01.left)
expect(stackSizeDefaultKey.right).assertEqual(stackSizeDefaultKey01.right)
expect(stackSizeDefaultKey.top).assertEqual(stackSizeDefaultKey01.top)
expect(stackSizeDefaultKey.bottom).assertEqual(stackSizeDefaultKey01.bottom)
expect(Math.round(stackSizeDefaultKey01.right - stackSizeDefaultKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.Center')
console.info('new testStackDefaultSizeAlignContentCenter END');
done();
});
/**
* @tc.number SUB_ACE_STACK_DEFAULTHEIGHTWIDTH_0600
* @tc.name testStackDefaultSizeAlignContentEnd
* @tc.desc Set stack's default height and width ,set alignContent mode 'End'.
*/
it('testStackDefaultSizeAlignContentEnd', 0, async function (done) {
console.info('new testStackDefaultSizeAlignContentEnd START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.End});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackSizeDefaultKey');
let obj = JSON.parse(strJson);
let stackSizeDefaultKey = CommonFunc.getComponentRect('stackSizeDefaultKey');
let stackSizeDefaultKey01 = CommonFunc.getComponentRect('stackSizeDefaultKey01');
expect(stackSizeDefaultKey.left).assertEqual(stackSizeDefaultKey01.left)
expect(stackSizeDefaultKey.right).assertEqual(stackSizeDefaultKey01.right)
expect(stackSizeDefaultKey.top).assertEqual(stackSizeDefaultKey01.top)
expect(stackSizeDefaultKey.bottom).assertEqual(stackSizeDefaultKey01.bottom)
expect(Math.round(stackSizeDefaultKey01.right - stackSizeDefaultKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.End')
console.info('new testStackDefaultSizeAlignContentEnd END');
done();
});
/**
* @tc.number SUB_ACE_STACK_DEFAULTHEIGHTWIDTH_0700
* @tc.name testStackDefaultSizeAlignContentBottomStart
* @tc.desc Set stack's default height and width ,set alignContent mode 'BottomStart'.
*/
it('testStackDefaultSizeAlignContentBottomStart', 0, async function (done) {
console.info('new testStackDefaultSizeAlignContentBottomStart START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.BottomStart});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackSizeDefaultKey');
let obj = JSON.parse(strJson);
let stackSizeDefaultKey = CommonFunc.getComponentRect('stackSizeDefaultKey');
let stackSizeDefaultKey01 = CommonFunc.getComponentRect('stackSizeDefaultKey01');
expect(stackSizeDefaultKey.left).assertEqual(stackSizeDefaultKey01.left)
expect(stackSizeDefaultKey.right).assertEqual(stackSizeDefaultKey01.right)
expect(stackSizeDefaultKey.top).assertEqual(stackSizeDefaultKey01.top)
expect(stackSizeDefaultKey.bottom).assertEqual(stackSizeDefaultKey01.bottom)
expect(Math.round(stackSizeDefaultKey01.right - stackSizeDefaultKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.BottomStart')
console.info('new testStackDefaultSizeAlignContentBottomStart END');
done();
});
/**
* @tc.number SUB_ACE_STACK_DEFAULTHEIGHTWIDTH_0800
* @tc.name testStackDefaultSizeAlignContentBottom
* @tc.desc Set stack's default height and width ,set alignContent mode 'Bottom'.
*/
it('testStackDefaultSizeAlignContentBottom', 0, async function (done) {
console.info('new testStackDefaultSizeAlignContentBottom START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.Bottom});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackSizeDefaultKey');
let obj = JSON.parse(strJson);
let stackSizeDefaultKey = CommonFunc.getComponentRect('stackSizeDefaultKey');
let stackSizeDefaultKey01 = CommonFunc.getComponentRect('stackSizeDefaultKey01');
expect(stackSizeDefaultKey.left).assertEqual(stackSizeDefaultKey01.left)
expect(stackSizeDefaultKey.right).assertEqual(stackSizeDefaultKey01.right)
expect(stackSizeDefaultKey.top).assertEqual(stackSizeDefaultKey01.top)
expect(stackSizeDefaultKey.bottom).assertEqual(stackSizeDefaultKey01.bottom)
expect(Math.round(stackSizeDefaultKey01.right - stackSizeDefaultKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.Bottom')
console.info('new testStackDefaultSizeAlignContentBottom END');
done();
});
/**
* @tc.number SUB_ACE_STACK_DEFAULTHEIGHTWIDTH_0900
* @tc.name testStackDefaultSizeAlignContentBottomEnd
* @tc.desc Set stack's default height and width ,set alignContent mode 'BottomEnd'.
*/
it('testStackDefaultSizeAlignContentBottomEnd', 0, async function (done) {
console.info('new testStackDefaultSizeAlignContentBottomEnd START');
globalThis.value.message.notify({name:'alignContent', value:Alignment.BottomEnd});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('stackSizeDefaultKey');
let obj = JSON.parse(strJson);
let stackSizeDefaultKey = CommonFunc.getComponentRect('stackSizeDefaultKey');
let stackSizeDefaultKey01 = CommonFunc.getComponentRect('stackSizeDefaultKey01');
expect(stackSizeDefaultKey.left).assertEqual(stackSizeDefaultKey01.left)
expect(stackSizeDefaultKey.right).assertEqual(stackSizeDefaultKey01.right)
expect(stackSizeDefaultKey.top).assertEqual(stackSizeDefaultKey01.top)
expect(stackSizeDefaultKey.bottom).assertEqual(stackSizeDefaultKey01.bottom)
expect(Math.round(stackSizeDefaultKey01.right - stackSizeDefaultKey01.left)).assertEqual(vp2px(200))
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.BottomEnd')
console.info('new testStackDefaultSizeAlignContentBottomEnd 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.
先完成此消息的编辑!
想要评论请 注册