Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
977c64f7
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
977c64f7
编写于
4月 27, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 27, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7867 XTS Arkui Stack组件 代码提交
Merge pull request !7867 from 张海霖/zhl_08
上级
4de5bef2
c57027c5
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
2005 addition
and
0 deletion
+2005
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Stack/Stack_change/stackMarginChange.ets
...ainAbility/pages/Stack/Stack_change/stackMarginChange.ets
+51
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Stack/Stack_change/stackNoneSettingWidthHeight.ets
.../pages/Stack/Stack_change/stackNoneSettingWidthHeight.ets
+47
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Stack/Stack_change/stackPaddingChange.ets
...inAbility/pages/Stack/Stack_change/stackPaddingChange.ets
+51
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Stack/Stack_change/stackSizeChange.ets
.../MainAbility/pages/Stack/Stack_change/stackSizeChange.ets
+57
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Stack/Stack_change/stackMarginChange.test.ets
...in/ets/test/Stack/Stack_change/stackMarginChange.test.ets
+272
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Stack/Stack_change/stackNoneSettingWidthHeight.test.ets
...t/Stack/Stack_change/stackNoneSettingWidthHeight.test.ets
+263
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Stack/Stack_change/stackPaddingChange.test.ets
...n/ets/test/Stack/Stack_change/stackPaddingChange.test.ets
+515
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Stack/Stack_change/stackSizeChange.test.ets
...main/ets/test/Stack/Stack_change/stackSizeChange.test.ets
+749
-0
未找到文件。
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Stack/Stack_change/stackMarginChange.ets
0 → 100644
浏览文件 @
977c64f7
/**
* 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)
}
}
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Stack/Stack_change/stackNoneSettingWidthHeight.ets
0 → 100644
浏览文件 @
977c64f7
/**
* 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)
}
}
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Stack/Stack_change/stackPaddingChange.ets
0 → 100644
浏览文件 @
977c64f7
/**
* 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)
}
}
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Stack/Stack_change/stackSizeChange.ets
0 → 100644
浏览文件 @
977c64f7
/**
* 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)
}
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Stack/Stack_change/stackMarginChange.test.ets
0 → 100644
浏览文件 @
977c64f7
/**
* 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
arkui/ace_ets_layout_test/entry/src/main/ets/test/Stack/Stack_change/stackNoneSettingWidthHeight.test.ets
0 → 100644
浏览文件 @
977c64f7
/**
* 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
arkui/ace_ets_layout_test/entry/src/main/ets/test/Stack/Stack_change/stackPaddingChange.test.ets
0 → 100644
浏览文件 @
977c64f7
此差异已折叠。
点击以展开。
arkui/ace_ets_layout_test/entry/src/main/ets/test/Stack/Stack_change/stackSizeChange.test.ets
0 → 100644
浏览文件 @
977c64f7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录