Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5b29630e
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,发现更多精彩内容 >>
提交
5b29630e
编写于
3月 24, 2023
作者:
E
e
提交者:
qianwangdq
5月 17, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交用例
Signed-off-by:
N
e
<
qianwangdq@isoftstone.com
>
上级
65901d9b
变更
4
展开全部
显示空白变更内容
内联
并排
Showing
4 changed file
with
627 addition
and
0 deletion
+627
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/Tabs_ItemsChange/Tabs_itemPadMar.ets
...inAbility/pages/Tabs/Tabs_ItemsChange/Tabs_itemPadMar.ets
+84
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/Tabs_ItemsChange/Tabs_itemSize.ets
...MainAbility/pages/Tabs/Tabs_ItemsChange/Tabs_itemSize.ets
+81
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/Tabs_ItemsChange/Tabs_itemPadMar.test.ets
...n/ets/test/Tabs/Tabs_ItemsChange/Tabs_itemPadMar.test.ets
+322
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/Tabs_ItemsChange/Tabs_itemSize.test.ets
...ain/ets/test/Tabs/Tabs_ItemsChange/Tabs_itemSize.test.ets
+140
-0
未找到文件。
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/Tabs_ItemsChange/Tabs_itemPadMar.ets
0 → 100644
浏览文件 @
5b29630e
/**
* 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 Tabs_itemPadMar {
@State fontColor: string = '#182431';
@State selectedFontColor: string = '#007DFF';
@State dadPadding: number = 0;
@State dadMargin: number = 0;
@State currentIndex: number = 0;
private controller: TabsController = new TabsController();
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('Tabs_itemPadMar onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'dadPadding') {
this.dadPadding = message.value;
}
if (message.name == 'dadMargin') {
this.dadMargin = message.value;
}
if (message.name == 'currentIndex') {
this.currentIndex = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@Builder TabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.fontSize(16)
.fontWeight(this.currentIndex === index ? 500 : 400)
.lineHeight(40)
}.width('100%').height('100%').key('Tabs_itemPadMar_' + name)
}
build() {
Column() {
Tabs({ controller: this.controller, index:this.currentIndex }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor('#00CB87').key("Tabs_itemPadMar_001")
}.tabBar(this.TabBuilder(0, 'green'))
.key("Tabs_itemPadMar_011")
.padding(this.dadPadding)
.margin(this.dadMargin)
TabContent() {
Column().width('100%').height('100%').backgroundColor('#007DFF').key("Tabs_itemPadMar_002")
}.tabBar(this.TabBuilder(1, 'blue')).key("Tabs_itemPadMar_012")
TabContent() {
Column().width('100%').height('100%').backgroundColor('#FFBF00').key("Tabs_itemPadMar_003")
}.tabBar(this.TabBuilder(2, 'yellow')).key("Tabs_itemPadMar_013")
}
.key("Tabs_itemPadMar_01")
.vertical(false)
.barWidth(330)
.barHeight(56)
.animationDuration(400)
.onChange((index: number) => {
this.currentIndex = index
})
.width(330)
.height(300)
.backgroundColor('#F1F3F5')
}.width('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/Tabs_ItemsChange/Tabs_itemSize.ets
0 → 100644
浏览文件 @
5b29630e
/**
* 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 Tabs_itemSize {
@State fontColor: string = '#182431';
@State selectedFontColor: string = '#007DFF';
@State dadWeight: number = 200;
@State dadHeight: number = 200;
@State currentIndex: number = 0;
private controller: TabsController = new TabsController();
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('Tabs_itemSize onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'dadWeight') {
this.dadWeight = message.value;
}
if (message.name == 'dadHeight') {
this.dadHeight = message.value;
}
if (message.name == 'currentIndex') {
this.currentIndex = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@Builder TabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.fontSize(16)
.fontWeight(this.currentIndex === index ? 500 : 400)
.lineHeight(40)
}.width('100%').height('100%').key('Tabs_itemSize_' + name)
}
build() {
Column() {
Tabs({ index:this.currentIndex }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor('#00CB87').key("Tabs_itemSize_001")
}.tabBar(this.TabBuilder(0, 'green')).key("Tabs_itemSize_011").width(this.dadWeight).height(this.dadHeight)
TabContent() {
Column().width('100%').height('100%').backgroundColor('#007DFF').key("Tabs_itemSize_002")
}.tabBar(this.TabBuilder(1, 'blue')).key("Tabs_itemSize_012")
TabContent() {
Column().width('100%').height('100%').backgroundColor('#FFBF00').key("Tabs_itemSize_003")
}.tabBar(this.TabBuilder(2, 'yellow')).key("Tabs_itemSize_013")
}
.key("Tabs_itemSize_01")
.vertical(false)
.barWidth(330)
.barHeight(56)
.animationDuration(400)
.onChange((index: number) => {
this.currentIndex = index
})
.width(330)
.height(300)
.backgroundColor('#F1F3F5')
}.width('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/Tabs_ItemsChange/Tabs_itemPadMar.test.ets
0 → 100644
浏览文件 @
5b29630e
此差异已折叠。
点击以展开。
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/Tabs_ItemsChange/Tabs_itemSize.test.ets
0 → 100644
浏览文件 @
5b29630e
/**
* 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 '@ohos.router';
import CommonFunc from '../../../MainAbility/common/Common';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection,
WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function Tabs_itemSize() {
describe('Tabs_itemSize', function () {
beforeEach(async function (done) {
console.info("Tabs_itemSize beforeEach start");
let options = {
url: "MainAbility/pages/Tabs/Tabs_ItemsChange/Tabs_itemSize",
}
try {
router.clear();
let pages = router.getState();
console.info("get Tabs_itemSize state pages:" + JSON.stringify(pages));
if (!("Tabs_itemSize" == pages.name)) {
console.info("get Tabs_itemSize pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Tabs_itemSize page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Tabs_itemSize page error " + JSON.stringify(err));
expect().assertFail();
}
console.info("Tabs_itemSize beforeEach end");
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Tabs_itemSize after each called")
globalThis.value.message.notify({name:'currentIndex', value:0});
});
/**
* @tc.number SUB_ACE_TABS_ITEMSIZE_TEST_0100
* @tc.name testTabsItemSize
* @tc.desc Set width to 200 and height to 200 for TabContent
*/
it('testTabsItemSize', 0, async function (done) {
console.info('[testTabsItemSize] START');
await CommonFunc.sleep(3000);
let strJson = getInspectorByKey('Tabs_itemSize_01');
let obj = JSON.parse(strJson);
console.info(`[testTabsItemSize] type: ${JSON.stringify(obj.$type)}`);
console.info("[testTabsItemSize] barPosition: " + JSON.stringify(obj.$attrs.barPosition));
console.info("[testTabsItemSize] index: " + JSON.stringify(obj.$attrs.index));
console.info("[testTabsItemSize] scrollable: " + JSON.stringify(obj.$attrs.scrollable));
console.info("[testTabsItemSize] barMode: " + JSON.stringify(obj.$attrs.barMode));
expect(obj.$type).assertEqual('Tabs');
expect(obj.$attrs.barPosition).assertEqual("BarPosition.Start");
expect(obj.$attrs.index).assertEqual("0");
expect(obj.$attrs.scrollable).assertEqual(true);
expect(obj.$attrs.barMode).assertEqual('BarMode.Fixed');
let Tabs_itemSize_001 = CommonFunc.getComponentRect('Tabs_itemSize_001');
let Tabs_itemSize_011 = CommonFunc.getComponentRect('Tabs_itemSize_011');
let driver = await Driver.create();
await driver.swipe(Math.round(Tabs_itemSize_011.right - 30),
Math.round(Tabs_itemSize_011.top + ((Tabs_itemSize_011.bottom - Tabs_itemSize_011.top) / 2)),
Math.round(Tabs_itemSize_011.left + 30),
Math.round(Tabs_itemSize_011.top + ((Tabs_itemSize_011.bottom - Tabs_itemSize_011.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_itemSize_002 = CommonFunc.getComponentRect('Tabs_itemSize_002');
let Tabs_itemSize_012 = CommonFunc.getComponentRect('Tabs_itemSize_012');
await driver.swipe(Math.round(Tabs_itemSize_012.right - 30),
Math.round(Tabs_itemSize_012.top +((Tabs_itemSize_012.bottom - Tabs_itemSize_012.top) / 2)),
Math.round(Tabs_itemSize_012.left + 30),
Math.round(Tabs_itemSize_012.top + ((Tabs_itemSize_012.bottom - Tabs_itemSize_012.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_itemSize_003 = CommonFunc.getComponentRect('Tabs_itemSize_003');
let Tabs_itemSize_013 = CommonFunc.getComponentRect('Tabs_itemSize_013');
let Tabs_itemSize_01 = CommonFunc.getComponentRect('Tabs_itemSize_01');
let subGreen = CommonFunc.getComponentRect('Tabs_itemSize_green');
let subBlue = CommonFunc.getComponentRect('Tabs_itemSize_blue');
let subYellow = CommonFunc.getComponentRect('Tabs_itemSize_yellow');
console.info(`[testTabsItemSize]Tabs_itemSize_011.left equal Tabs_itemSize_001.left=
${Tabs_itemSize_011.left} === ${Tabs_itemSize_001.left}`);
expect(Tabs_itemSize_011.left).assertEqual(Tabs_itemSize_001.left);
expect(Tabs_itemSize_012.left).assertEqual(Tabs_itemSize_002.left);
expect(Tabs_itemSize_013.left).assertEqual(Tabs_itemSize_003.left);
expect(Tabs_itemSize_011.top).assertEqual(Tabs_itemSize_001.top);
expect(Tabs_itemSize_012.top).assertEqual(Tabs_itemSize_002.top);
expect(Tabs_itemSize_013.top).assertEqual(Tabs_itemSize_003.top);
console.info(`[testTabsItemSize]Tabs_itemSize_011.left equal Tabs_itemSize_01.left=
${Tabs_itemSize_011.left} === ${Tabs_itemSize_01.left}`);
expect(Tabs_itemSize_011.left).assertEqual(Tabs_itemSize_01.left);
expect(Tabs_itemSize_012.left).assertEqual(Tabs_itemSize_01.left);
expect(Tabs_itemSize_013.left).assertEqual(Tabs_itemSize_01.left);
expect(Tabs_itemSize_011.top).assertEqual(subGreen.bottom);
expect(Tabs_itemSize_012.top).assertEqual(subBlue.bottom);
expect(Tabs_itemSize_013.top).assertEqual(subYellow.bottom);
console.info(`[testTabsItemSize]Tabs_itemSize_011.bottom - Tabs_itemSize_011.top=
${Math.round(Tabs_itemSize_011.bottom - Tabs_itemSize_011.top)}`);
expect(Math.round(Tabs_itemSize_011.bottom - Tabs_itemSize_011.top)).assertEqual(vp2px(244));
expect(Math.round(Tabs_itemSize_012.bottom - Tabs_itemSize_012.top)).assertEqual(vp2px(244));
expect(Math.round(Tabs_itemSize_013.bottom - Tabs_itemSize_013.top)).assertEqual(vp2px(244));
expect(Math.round(Tabs_itemSize_011.right - Tabs_itemSize_011.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_itemSize_012.right - Tabs_itemSize_012.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_itemSize_013.right - Tabs_itemSize_013.left)).assertEqual(vp2px(330));
console.info(`[testTabsItemSize]Tabs_itemSize_001.bottom - Tabs_itemSize_001.top=
${Math.round(Tabs_itemSize_001.bottom - Tabs_itemSize_001.top)}`);
expect(Math.round(Tabs_itemSize_001.bottom - Tabs_itemSize_001.top)).assertEqual(vp2px(244));
expect(Math.round(Tabs_itemSize_002.bottom - Tabs_itemSize_002.top)).assertEqual(vp2px(244));
expect(Math.round(Tabs_itemSize_003.bottom - Tabs_itemSize_003.top)).assertEqual(vp2px(244));
expect(Math.round(Tabs_itemSize_001.right - Tabs_itemSize_001.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_itemSize_002.right - Tabs_itemSize_002.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_itemSize_003.right - Tabs_itemSize_003.left)).assertEqual(vp2px(330));
console.info(`[testTabsItemSize]subGreen.bottom - subGreen.top = ${Math.round(subGreen.bottom - subGreen.top)}`);
expect(Math.round(subGreen.bottom - subGreen.top)).assertEqual(vp2px(56));
expect(Math.round(subBlue.bottom - subBlue.top)).assertEqual(vp2px(56));
expect(Math.round(subYellow.bottom - subYellow.top)).assertEqual(vp2px(56));
expect(Math.round(subGreen.right - subGreen.left)).assertEqual(vp2px(110));
expect(Math.round(subBlue.right - subBlue.left)).assertEqual(vp2px(110));
expect(Math.round(subYellow.right - subYellow.left)).assertEqual(vp2px(110));
console.info('[testTabsItemSize] END');
done();
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录