Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
bf2e4f97
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,发现更多精彩内容 >>
未验证
提交
bf2e4f97
编写于
4月 11, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 11, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8219 test:add tabs testcase of arkui component
Merge pull request !8219 from 李伟明/tabs
上级
721622fc
ba6728a1
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
1155 addition
and
1 deletion
+1155
-1
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_PadMar.ets
...s/MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_PadMar.ets
+83
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_WidHei.ets
...s/MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_WidHei.ets
+81
-0
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/tabs_index/Tabs_index.ets
...main/ets/MainAbility/pages/Tabs/tabs_index/Tabs_index.ets
+77
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets
...ace_ets_layout_test/entry/src/main/ets/test/List.test.ets
+6
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/Tabs_ParmsChange/Tabs_PadMar.test.ets
.../main/ets/test/Tabs/Tabs_ParmsChange/Tabs_PadMar.test.ets
+339
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/Tabs_ParmsChange/Tabs_WidHei.test.ets
.../main/ets/test/Tabs/Tabs_ParmsChange/Tabs_WidHei.test.ets
+243
-0
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/tabs_index/Tabs_index.test.ets
...try/src/main/ets/test/Tabs/tabs_index/Tabs_index.test.ets
+322
-0
arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+4
-1
未找到文件。
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_PadMar.ets
0 → 100644
浏览文件 @
bf2e4f97
/**
* 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_PadMar {
@State fontColor: string = '#182431';
@State selectedFontColor: string = '#007DFF';
@State testPadding: number = 0;
@State testMargin: number = 0;
@State currentIndex: number = 0;
private controller: TabsController = new TabsController();
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('Tabs_PadMar 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 == 'margin') {
this.testMargin = message.value;
}
if (message.name == 'index') {
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(22)
}.width('100%').height('100%').key('Tabs_PadMar_' + name)
}
build() {
Column() {
Tabs({index: this.currentIndex}) {
TabContent() {
Column().width('100%').height('100%').backgroundColor('#00CB87').key("Tabs_PadMar_001");
}.tabBar(this.TabBuilder(0, 'Green')).key("Tabs_PadMar_011")
TabContent() {
Column().width('100%').height('100%').backgroundColor('#007DFF').key("Tabs_PadMar_002");
}.tabBar(this.TabBuilder(1, 'Blue')).key("Tabs_PadMar_012")
TabContent() {
Column().width('100%').height('100%').backgroundColor('#FFBF00').key("Tabs_PadMar_003");
}.tabBar(this.TabBuilder(2, 'Yellow')).key("Tabs_PadMar_013")
}
.key("Tabs_PadMar_01")
.vertical(false)
.animationDuration(400)
.onChange((index: number) => {
this.currentIndex = index
})
.width(330)
.height(300)
.padding(this.testPadding)
.margin(this.testMargin)
.backgroundColor('#F1F3F5')
}.alignItems(HorizontalAlign.Start).width('100%').key("Tabs_PadMar_Column_01")
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_WidHei.ets
0 → 100644
浏览文件 @
bf2e4f97
/**
* 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_WidHei {
@State fontColor: string = '#182431';
@State selectedFontColor: string = '#007DFF';
@State testWidth: number = 300;
@State testHeight: number = 200;
@State currentIndex: number = 0;
private controller: TabsController = new TabsController();
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('Tabs_WidHei onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
};
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'width') {
this.testWidth = message.value;
}
if (message.name == 'height') {
this.testHeight = message.value;
}
if (message.name == 'index') {
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(22)
}.width('100%').height('100%').key('Tabs_WidHei_' + name)
}
build() {
Column() {
Tabs({index: this.currentIndex}) {
TabContent() {
Column().width('100%').height('100%').backgroundColor('#00CB87').key("Tabs_WidHei_001");
}.tabBar(this.TabBuilder(0, 'Green')).key("Tabs_WidHei_011")
TabContent() {
Column().width('100%').height('100%').backgroundColor('#007DFF').key("Tabs_WidHei_002");
}.tabBar(this.TabBuilder(1, 'Blue')).key("Tabs_WidHei_012")
TabContent() {
Column().width('100%').height('100%').backgroundColor('#FFBF00').key("Tabs_WidHei_003");
}.tabBar(this.TabBuilder(2, 'Yellow')).key("Tabs_WidHei_013")
}
.key("Tabs_WidHei_01")
.vertical(false)
.animationDuration(400)
.onChange((index: number) => {
this.currentIndex = index
})
.width(this.testWidth)
.height(this.testHeight)
.backgroundColor('#F1F3F5')
}.width('100%')
}
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Tabs/tabs_index/Tabs_index.ets
0 → 100644
浏览文件 @
bf2e4f97
/**
* 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_Index {
@State fontColor: string = '#182431';
@State selectedFontColor: string = '#007DFF';
@State currentIndex: number = 0;
private controller: TabsController = new TabsController();
messageManager:MessageManager = new MessageManager();
onPageShow() {
console.info('Tabs_Index onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
};
let callback:Callback = (message:any) => {
console.log('message = ' + message.name + "--" + message.value);
if (message.name == 'index') {
this.currentIndex = message.value;
}
}
this.messageManager.registerCallback(callback);
}
@Builder TabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor((this.currentIndex < 0 ||
this.currentIndex > 2 ? 0 : this.currentIndex) === index ? this.selectedFontColor : this.fontColor)
.fontSize(16)
.fontWeight((this.currentIndex < 0 ||
this.currentIndex > 2 ? 0 : this.currentIndex) === index ? 500 : 400)
.lineHeight(22)
}.width('100%').height('100%').key('Tabs_Index_'+ name)
}
build() {
Column() {
Tabs({index: this.currentIndex, controller: this.controller}) {
TabContent() {
Column().width('100%').height('100%').backgroundColor('#00CB87').key("Tabs_Index_001");
}.tabBar(this.TabBuilder(0, 'Green')).key("Tabs_Index_011")
TabContent() {
Column().width('100%').height('100%').backgroundColor('#007DFF').key("Tabs_Index_002");
}.tabBar(this.TabBuilder(1, 'Blue')).key("Tabs_Index_012")
TabContent() {
Column().width('100%').height('100%').backgroundColor('#FFBF00').key("Tabs_Index_003");
}.tabBar(this.TabBuilder(2, 'Yellow')).key("Tabs_Index_013")
}
.key("Tabs_Index_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/List.test.ets
浏览文件 @
bf2e4f97
...
...
@@ -86,6 +86,9 @@
import flex_AlignContent_SpaceAround_TextMarTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar.test';
import flex_AlignContent_SpaceAround_TextOffsetTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset.test';
import flex_AlignContent_SpaceAround_TextVisibilityTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility.test';
import tabs_IndexTest from './Tabs/tabs_index/Tabs_index.test';
import tabs_PadMarTest from './Tabs/Tabs_ParmsChange/Tabs_PadMar.test';
import tabs_WidHeiTest from './Tabs/Tabs_ParmsChange/Tabs_WidHei.test';
export default function testsuite() {
flexBase_AutoJsunit()
flexPadding_AutoJsunit()
...
...
@@ -161,4 +164,7 @@ export default function testsuite() {
flex_AlignContent_SpaceAround_TextMarTest();
flex_AlignContent_SpaceAround_TextOffsetTest();
flex_AlignContent_SpaceAround_TextVisibilityTest();
tabs_IndexTest();
tabs_PadMarTest();
tabs_WidHeiTest();
}
\ No newline at end of file
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/Tabs_ParmsChange/Tabs_PadMar.test.ets
0 → 100644
浏览文件 @
bf2e4f97
此差异已折叠。
点击以展开。
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/Tabs_ParmsChange/Tabs_WidHei.test.ets
0 → 100644
浏览文件 @
bf2e4f97
/**
* 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_WidHeiTest() {
describe('tabs_WidHeiTest', function () {
beforeEach(async function (done) {
console.info("Tabs_WidHei beforeEach start");
let options = {
url: "MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_WidHei",
}
try {
router.clear();
let pages = router.getState();
console.info("get Tabs_WidHei state pages:" + JSON.stringify(pages));
if (!("Tabs_WidHei" == pages.name)) {
console.info("get Tabs_WidHei pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Tabs_WidHei page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Tabs_WidHei page error " + JSON.stringify(err));
expect().assertFail();
}
console.info("Tabs_WidHei beforeEach end");
done();
});
afterEach(async function () {
globalThis.value.message.notify({name:'index', value:0});
await CommonFunc.sleep(2000);
console.info("tabs_WidHeiTest after each called")
});
/**
* @tc.number SUB_ACE_TABS_WIDHEI_TEST_0100
* @tc.name testTabsWidHei01
* @tc.desc set width of tabs to 330,height of tabs to 350
*/
it('testTabsWidHei01', 0, async function (done) {
console.info('[testTabsWidHei01] START');
globalThis.value.message.notify({name:'width', value:330});
globalThis.value.message.notify({name:'height', value:350});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('Tabs_WidHei_01');
let obj = JSON.parse(strJson);
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_WidHei_01 = CommonFunc.getComponentRect('Tabs_WidHei_01');
let Tabs_WidHei_001 = CommonFunc.getComponentRect('Tabs_WidHei_001');
let Tabs_WidHei_011 = CommonFunc.getComponentRect('Tabs_WidHei_011');
console.info(`[testTabsWidHei01] type: ${JSON.stringify(obj.$type)}`);
console.info(`[testTabsWidHei01] barPosition: ${JSON.stringify(obj.$attrs.barPosition)}`);
console.info(`[testTabsWidHei01] index: ${JSON.stringify(obj.$attrs.index)}`);
console.info(`[testTabsWidHei01] scrollable: ${JSON.stringify(obj.$attrs.scrollable)}`);
console.info(`[testTabsWidHei01] vertical: ${JSON.stringify(obj.$attrs.vertical)}`);
console.info(`[testTabsWidHei01] barMode: ${JSON.stringify(obj.$attrs.barMode)}`);
let driver = await Driver.create();
await driver.swipe(Math.round(Tabs_WidHei_011.right - 30),
Math.round(Tabs_WidHei_011.top + ((Tabs_WidHei_011.bottom - Tabs_WidHei_011.top) / 2)),
Math.round(Tabs_WidHei_011.left + 30),
Math.round(Tabs_WidHei_011.top + ((Tabs_WidHei_011.bottom - Tabs_WidHei_011.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_WidHei_002 = CommonFunc.getComponentRect('Tabs_WidHei_002');
let Tabs_WidHei_012 = CommonFunc.getComponentRect('Tabs_WidHei_012');
await driver.swipe(Math.round(Tabs_WidHei_011.right - 30),
Math.round(Tabs_WidHei_012.top + ((Tabs_WidHei_012.bottom - Tabs_WidHei_012.top) / 2)),
Math.round(Tabs_WidHei_012.left + 30),
Math.round(Tabs_WidHei_012.top + ((Tabs_WidHei_012.bottom - Tabs_WidHei_012.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_WidHei_003 = CommonFunc.getComponentRect('Tabs_WidHei_003');
let Tabs_WidHei_013 = CommonFunc.getComponentRect('Tabs_WidHei_013');
let subGreen = CommonFunc.getComponentRect('Tabs_WidHei_Green');
let subBlue = CommonFunc.getComponentRect('Tabs_WidHei_Blue');
let subYellow = CommonFunc.getComponentRect('Tabs_WidHei_Yellow');
console.info(`[testTabsWidHei01] Tabs_WidHei_01.right -
Tabs_WidHei_01.left = ${Tabs_WidHei_01.right - Tabs_WidHei_01.left}`);
expect(Math.round(Tabs_WidHei_01.right - Tabs_WidHei_01.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_WidHei_01.bottom - Tabs_WidHei_01.top)).assertEqual(vp2px(350));
console.info(`[testTabsWidHei01] Tabs_WidHei_01.left = ${Tabs_WidHei_01.left}`);
expect(Tabs_WidHei_01.left).assertEqual(Tabs_WidHei_011.left);
expect(Tabs_WidHei_01.left).assertEqual(Tabs_WidHei_012.left);
expect(Tabs_WidHei_01.left).assertEqual(Tabs_WidHei_013.left);
console.info(`[testTabsWidHei01] Tabs_index_011.left = ${Tabs_WidHei_011.left}`);
expect(Tabs_WidHei_011.left).assertEqual(Tabs_WidHei_001.left);
expect(Tabs_WidHei_012.left).assertEqual(Tabs_WidHei_002.left);
expect(Tabs_WidHei_013.left).assertEqual(Tabs_WidHei_003.left);
expect(Tabs_WidHei_011.top).assertEqual(Tabs_WidHei_001.top);
expect(Tabs_WidHei_012.top).assertEqual(Tabs_WidHei_002.top);
expect(Tabs_WidHei_013.top).assertEqual(Tabs_WidHei_003.top);
console.info(`[testTabsWidHei01] Tabs_WidHei_011.bottom -
Tabs_WidHei_011.top = ${Tabs_WidHei_011.bottom - Tabs_WidHei_011.top}`);
expect(Math.round(Tabs_WidHei_011.bottom - Tabs_WidHei_011.top)).assertEqual(Math.round(vp2px(294)));
expect(Math.round(Tabs_WidHei_012.bottom - Tabs_WidHei_012.top)).assertEqual(Math.round(vp2px(294)));
expect(Math.round(Tabs_WidHei_013.bottom - Tabs_WidHei_013.top)).assertEqual(Math.round(vp2px(294)));
expect(Math.round(Tabs_WidHei_011.right - Tabs_WidHei_011.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_WidHei_012.right - Tabs_WidHei_012.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_WidHei_013.right - Tabs_WidHei_013.left)).assertEqual(vp2px(330));
console.info(`[testTabsWidHei01] Tabs_WidHei_001.bottom -
Tabs_WidHei_001.top = ${Tabs_WidHei_001.bottom - Tabs_WidHei_001.top}`);
expect(Math.round(Tabs_WidHei_001.bottom - Tabs_WidHei_001.top)).assertEqual(Math.round(vp2px(294)));
expect(Math.round(Tabs_WidHei_002.bottom - Tabs_WidHei_002.top)).assertEqual(Math.round(vp2px(294)));
expect(Math.round(Tabs_WidHei_003.bottom - Tabs_WidHei_003.top)).assertEqual(Math.round(vp2px(294)));
expect(Math.round(Tabs_WidHei_001.right - Tabs_WidHei_001.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_WidHei_002.right - Tabs_WidHei_002.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_WidHei_003.right - Tabs_WidHei_003.left)).assertEqual(vp2px(330));
console.info(`[testTabsWidHei01] subGreen.bottom = ${subGreen.bottom}`);
expect(subGreen.bottom).assertEqual(Tabs_WidHei_001.top);
expect(subGreen.bottom).assertEqual(subBlue.bottom);
expect(subGreen.bottom).assertEqual(subYellow.bottom);
console.info(`[testTabsWidHei01]subGreen.bottom - subGreen.top = ${subGreen.bottom - subGreen.top}`);
expect(Math.round(subGreen.bottom - subGreen.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subBlue.bottom - subBlue.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subYellow.bottom - subYellow.top)).assertEqual(Math.round(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('[testTabsWidHei01] END');
done();
});
/**
* @tc.number SUB_ACE_TABS_WIDHEI_TEST_0200
* @tc.name testTabsWidHei02
* @tc.desc set width of tabs to 300,height of tabs to 400
*/
it('testTabsWidHei02', 0, async function (done) {
console.info('[testTabsWidHei02] START');
globalThis.value.message.notify({name:'width', value:300});
globalThis.value.message.notify({name:'height', value:400});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('Tabs_WidHei_01');
let obj = JSON.parse(strJson);
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_WidHei_01 = CommonFunc.getComponentRect('Tabs_WidHei_01');
let Tabs_WidHei_001 = CommonFunc.getComponentRect('Tabs_WidHei_001');
let Tabs_WidHei_011 = CommonFunc.getComponentRect('Tabs_WidHei_011');
console.info(`[testTabsWidHei02] type: ${JSON.stringify(obj.$type)}`);
console.info(`[testTabsWidHei02] barPosition: ${JSON.stringify(obj.$attrs.barPosition)}`);
console.info(`[testTabsWidHei02] index: ${JSON.stringify(obj.$attrs.index)}`);
console.info(`[testTabsWidHei02] scrollable: ${JSON.stringify(obj.$attrs.scrollable)}`);
console.info(`[testTabsWidHei02] vertical: ${JSON.stringify(obj.$attrs.vertical)}`);
console.info(`[testTabsWidHei02] barMode: ${JSON.stringify(obj.$attrs.barMode)}`);
let driver = await Driver.create();
await driver.swipe(Math.round(Tabs_WidHei_011.right - 30),
Math.round(Tabs_WidHei_011.top + ((Tabs_WidHei_011.bottom - Tabs_WidHei_011.top) / 2)),
Math.round(Tabs_WidHei_011.left + 30),
Math.round(Tabs_WidHei_011.top + ((Tabs_WidHei_011.bottom - Tabs_WidHei_011.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_WidHei_002 = CommonFunc.getComponentRect('Tabs_WidHei_002');
let Tabs_WidHei_012 = CommonFunc.getComponentRect('Tabs_WidHei_012');
await driver.swipe(Math.round(Tabs_WidHei_011.right - 30),
Math.round(Tabs_WidHei_012.top + ((Tabs_WidHei_012.bottom - Tabs_WidHei_012.top) / 2)),
Math.round(Tabs_WidHei_012.left + 30),
Math.round(Tabs_WidHei_012.top + ((Tabs_WidHei_012.bottom - Tabs_WidHei_012.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_WidHei_003 = CommonFunc.getComponentRect('Tabs_WidHei_003');
let Tabs_WidHei_013 = CommonFunc.getComponentRect('Tabs_WidHei_013');
let subGreen = CommonFunc.getComponentRect('Tabs_WidHei_Green');
let subBlue = CommonFunc.getComponentRect('Tabs_WidHei_Blue');
let subYellow = CommonFunc.getComponentRect('Tabs_WidHei_Yellow');
console.info(`[testTabsWidHei02] Tabs_WidHei_01.right -
Tabs_WidHei_01.left = ${Tabs_WidHei_01.right - Tabs_WidHei_01.left}`);
expect(Math.round(Tabs_WidHei_01.right - Tabs_WidHei_01.left)).assertEqual(vp2px(300));
expect(Math.round(Tabs_WidHei_01.bottom - Tabs_WidHei_01.top)).assertEqual(vp2px(400));
console.info(`[testTabsWidHei02] Tabs_WidHei_01.left = ${Tabs_WidHei_01.left}`);
expect(Tabs_WidHei_01.left).assertEqual(Tabs_WidHei_011.left);
expect(Tabs_WidHei_01.left).assertEqual(Tabs_WidHei_012.left);
expect(Tabs_WidHei_01.left).assertEqual(Tabs_WidHei_013.left);
console.info(`[testTabsWidHei02] Tabs_index_011.left = ${Tabs_WidHei_011.left}`);
expect(Tabs_WidHei_011.left).assertEqual(Tabs_WidHei_001.left);
expect(Tabs_WidHei_012.left).assertEqual(Tabs_WidHei_002.left);
expect(Tabs_WidHei_013.left).assertEqual(Tabs_WidHei_003.left);
expect(Tabs_WidHei_011.top).assertEqual(Tabs_WidHei_001.top);
expect(Tabs_WidHei_012.top).assertEqual(Tabs_WidHei_002.top);
expect(Tabs_WidHei_013.top).assertEqual(Tabs_WidHei_003.top);
console.info(`[testTabsWidHei02] Tabs_WidHei_011.bottom -
Tabs_WidHei_011.top = ${Tabs_WidHei_011.bottom - Tabs_WidHei_011.top}`);
expect(Math.round(Tabs_WidHei_011.bottom - Tabs_WidHei_011.top)).assertEqual(Math.round(vp2px(344)));
expect(Math.round(Tabs_WidHei_012.bottom - Tabs_WidHei_012.top)).assertEqual(Math.round(vp2px(344)));
expect(Math.round(Tabs_WidHei_013.bottom - Tabs_WidHei_013.top)).assertEqual(Math.round(vp2px(344)));
expect(Math.round(Tabs_WidHei_011.right - Tabs_WidHei_011.left)).assertEqual(vp2px(300));
expect(Math.round(Tabs_WidHei_012.right - Tabs_WidHei_012.left)).assertEqual(vp2px(300));
expect(Math.round(Tabs_WidHei_013.right - Tabs_WidHei_013.left)).assertEqual(vp2px(300));
console.info(`[testTabsWidHei02] Tabs_WidHei_001.bottom -
Tabs_WidHei_001.top = ${Tabs_WidHei_001.bottom - Tabs_WidHei_001.top}`);
expect(Math.round(Tabs_WidHei_001.bottom - Tabs_WidHei_001.top)).assertEqual(Math.round(vp2px(344)));
expect(Math.round(Tabs_WidHei_002.bottom - Tabs_WidHei_002.top)).assertEqual(Math.round(vp2px(344)));
expect(Math.round(Tabs_WidHei_003.bottom - Tabs_WidHei_003.top)).assertEqual(Math.round(vp2px(344)));
expect(Math.round(Tabs_WidHei_001.right - Tabs_WidHei_001.left)).assertEqual(vp2px(300));
expect(Math.round(Tabs_WidHei_002.right - Tabs_WidHei_002.left)).assertEqual(vp2px(300));
expect(Math.round(Tabs_WidHei_003.right - Tabs_WidHei_003.left)).assertEqual(vp2px(300));
console.info(`[testTabsWidHei02] subGreen.bottom = ${subGreen.bottom}`);
expect(subGreen.bottom).assertEqual(Tabs_WidHei_001.top);
expect(subGreen.bottom).assertEqual(subBlue.bottom);
expect(subGreen.bottom).assertEqual(subYellow.bottom);
console.info(`[testTabsWidHei02]subGreen.bottom - subGreen.top = ${subGreen.bottom - subGreen.top}`);
expect(Math.round(subGreen.bottom - subGreen.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subBlue.bottom - subBlue.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subYellow.bottom - subYellow.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subGreen.right - subGreen.left)).assertEqual(vp2px(100));
expect(Math.round(subBlue.right - subBlue.left)).assertEqual(vp2px(100));
expect(Math.round(subYellow.right - subYellow.left)).assertEqual(vp2px(100));
console.info('[testTabsWidHei02] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/ets/test/Tabs/tabs_index/Tabs_index.test.ets
0 → 100644
浏览文件 @
bf2e4f97
/**
* 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_IndexTest() {
describe('Tabs_IndexTest', function () {
beforeEach(async function (done) {
console.info("Tabs_IndexTest beforeEach start");
let options = {
url: "MainAbility/pages/Tabs/tabs_index/Tabs_index",
}
try {
router.clear();
let pages = router.getState();
console.info("get Tabs_index state pages:" + JSON.stringify(pages));
if (!("Tabs_index" == pages.name)) {
console.info("get Tabs_index pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Tabs_index page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Tabs_index page error " + JSON.stringify(err));
expect().assertFail();
}
console.info("Tabs_IndexTest beforeEach end");
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Tabs_IndexTest after each called")
});
/**
* @tc.number SUB_ACE_TABS_INDEX_TEST_0100
* @tc.name testTabsIndexLessThanMin
* @tc.desc set index of tabs to -1
*/
it('testTabsIndexLessThanMin', 0, async function (done) {
console.info('[testTabsIndexLessThanMin] START');
globalThis.value.message.notify({name:'index', value:-1});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('Tabs_Index_01');
let obj = JSON.parse(strJson);
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');
console.info(`[testTabsIndexLessThanMin] type: ${JSON.stringify(obj.$type)}`);
console.info(`[testTabsIndexLessThanMin] barPosition: ${JSON.stringify(obj.$attrs.barPosition)}`);
console.info(`[testTabsIndexLessThanMin] index: ${JSON.stringify(obj.$attrs.index)}`);
console.info(`[testTabsIndexLessThanMin] scrollable: ${JSON.stringify(obj.$attrs.scrollable)}`);
console.info(`[testTabsIndexLessThanMin] vertical: ${JSON.stringify(obj.$attrs.vertical)}`);
console.info(`[testTabsIndexLessThanMin] barMode: ${JSON.stringify(obj.$attrs.barMode)}`);
let Tabs_index_01 = CommonFunc.getComponentRect('Tabs_Index_01');
let Tabs_index_001 = CommonFunc.getComponentRect('Tabs_Index_001');
let Tabs_index_011 = CommonFunc.getComponentRect('Tabs_Index_011');
let driver = await Driver.create();
await driver.swipe(Math.round(Tabs_index_011.right - 30),
Math.round(Tabs_index_011.top + ((Tabs_index_011.bottom - Tabs_index_011.top) / 2)),
Math.round(Tabs_index_011.left + 30),
Math.round(Tabs_index_011.top + ((Tabs_index_011.bottom - Tabs_index_011.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_index_002 = CommonFunc.getComponentRect('Tabs_Index_002');
let Tabs_index_012 = CommonFunc.getComponentRect('Tabs_Index_012');
await driver.swipe(Math.round(Tabs_index_012.right - 30),
Math.round(Tabs_index_012.top +((Tabs_index_012.bottom - Tabs_index_012.top) / 2)),
Math.round(Tabs_index_012.left + 30),
Math.round(Tabs_index_012.top + ((Tabs_index_012.bottom - Tabs_index_012.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_index_003 = CommonFunc.getComponentRect('Tabs_Index_003');
let Tabs_index_013 = CommonFunc.getComponentRect('Tabs_Index_013');
let subGreen = CommonFunc.getComponentRect('Tabs_Index_Green');
let subBlue = CommonFunc.getComponentRect('Tabs_Index_Blue');
let subYellow = CommonFunc.getComponentRect('Tabs_Index_Yellow');
console.info(`[testTabsIndexLessThanMin] Tabs_index_01.left = ${Tabs_index_01.left}`);
expect(Tabs_index_01.left).assertEqual(Tabs_index_011.left);
expect(Tabs_index_01.left).assertEqual(Tabs_index_012.left);
expect(Tabs_index_01.left).assertEqual(Tabs_index_013.left);
console.info(`[testTabsIndexLessThanMin] Tabs_index_011.left = ${Tabs_index_011.left}`);
expect(Tabs_index_011.left).assertEqual(Tabs_index_001.left);
expect(Tabs_index_012.left).assertEqual(Tabs_index_002.left);
expect(Tabs_index_013.left).assertEqual(Tabs_index_003.left);
expect(Tabs_index_011.top).assertEqual(Tabs_index_001.top);
expect(Tabs_index_012.top).assertEqual(Tabs_index_002.top);
expect(Tabs_index_013.top).assertEqual(Tabs_index_003.top);
console.info(`[testTabsIndexLessThanMin] Tabs_index_011.bottom -
Tabs_index_011.top = ${Tabs_index_011.bottom - Tabs_index_011.top}`);
expect(Math.round(Tabs_index_011.bottom - Tabs_index_011.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_012.bottom - Tabs_index_012.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_013.bottom - Tabs_index_013.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_011.right - Tabs_index_011.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_012.right - Tabs_index_012.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_013.right - Tabs_index_013.left)).assertEqual(vp2px(330));
console.info(`[testTabsIndexLessThanMin] Tabs_index_001.bottom -
Tabs_index_001.top = ${Tabs_index_001.bottom - Tabs_index_001.top}`);
expect(Math.round(Tabs_index_001.bottom - Tabs_index_001.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_002.bottom - Tabs_index_002.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_003.bottom - Tabs_index_003.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_001.right - Tabs_index_001.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_002.right - Tabs_index_002.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_003.right - Tabs_index_003.left)).assertEqual(vp2px(330));
console.info(`[testTabsIndexLessThanMin] subGreen.bottom = ${subGreen.bottom}`);
expect(subGreen.bottom).assertEqual(Tabs_index_001.top);
expect(subGreen.bottom).assertEqual(subBlue.bottom);
expect(subGreen.bottom).assertEqual(subYellow.bottom);
console.info(`[testTabsIndexLessThanMin] subGreen.bottom - subGreen.top = ${subGreen.bottom - subGreen.top}`);
expect(Math.round(subGreen.bottom - subGreen.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subBlue.bottom - subBlue.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subYellow.bottom - subYellow.top)).assertEqual(Math.round(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('[testTabsIndexLessThanMin] END');
done();
});
/**
* @tc.number SUB_ACE_TABS_INDEX_TEST_0200
* @tc.name testTabsIndexNormal
* @tc.desc set index of tabs to 1
*/
it('testTabsIndexNormal', 0, async function (done) {
console.info('[testTabsIndexNormal] START');
globalThis.value.message.notify({name:'index', value:1});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('Tabs_Index_01');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Tabs');
expect(obj.$attrs.barPosition).assertEqual("BarPosition.Start");
expect(obj.$attrs.index).assertEqual("1");
expect(obj.$attrs.scrollable).assertEqual(true);
expect(obj.$attrs.barMode).assertEqual('BarMode.Fixed');
console.info(`[testTabsIndexNormal] type: ${JSON.stringify(obj.$type)}`);
console.info(`[testTabsIndexNormal] barPosition: ${JSON.stringify(obj.$attrs.barPosition)}`);
console.info(`[testTabsIndexNormal] index: ${JSON.stringify(obj.$attrs.index)}`);
console.info(`[testTabsIndexNormal] scrollable: ${JSON.stringify(obj.$attrs.scrollable)}`);
console.info(`[testTabsIndexNormal] vertical: ${JSON.stringify(obj.$attrs.vertical)}`);
console.info(`[testTabsIndexNormal] barMode: ${JSON.stringify(obj.$attrs.barMode)}`);
let driver = await Driver.create();
let Tabs_index_002 = CommonFunc.getComponentRect('Tabs_Index_002');
let Tabs_index_012 = CommonFunc.getComponentRect('Tabs_Index_012');
await driver.swipe(Math.round(Tabs_index_012.right - 30),
Math.round(Tabs_index_012.top + ((Tabs_index_012.bottom - Tabs_index_012.top) / 2)),
Math.round(Tabs_index_012.left + 30),
Math.round(Tabs_index_012.top + ((Tabs_index_012.bottom - Tabs_index_012.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_index_003 = CommonFunc.getComponentRect('Tabs_Index_003');
let Tabs_index_013 = CommonFunc.getComponentRect('Tabs_Index_013');
let subGreen = CommonFunc.getComponentRect('Tabs_Index_Green');
let subBlue = CommonFunc.getComponentRect('Tabs_Index_Blue');
let subYellow = CommonFunc.getComponentRect('Tabs_Index_Yellow');
globalThis.value.message.notify({name:'index', value:0});
await CommonFunc.sleep(1000);
let Tabs_index_01 = CommonFunc.getComponentRect('Tabs_Index_01');
let Tabs_index_001 = CommonFunc.getComponentRect('Tabs_Index_001');
let Tabs_index_011 = CommonFunc.getComponentRect('Tabs_Index_011');
console.info(`[testTabsIndexNormal] Tabs_index_01.left = ${Tabs_index_01.left}`);
expect(Tabs_index_01.left).assertEqual(Tabs_index_011.left);
expect(Tabs_index_01.left).assertEqual(Tabs_index_012.left);
expect(Tabs_index_01.left).assertEqual(Tabs_index_013.left);
console.info(`[testTabsIndexNormal] Tabs_index_011.left = ${Tabs_index_011.left}`);
expect(Tabs_index_011.left).assertEqual(Tabs_index_001.left);
expect(Tabs_index_012.left).assertEqual(Tabs_index_002.left);
expect(Tabs_index_013.left).assertEqual(Tabs_index_003.left);
expect(Tabs_index_011.top).assertEqual(Tabs_index_001.top);
expect(Tabs_index_012.top).assertEqual(Tabs_index_002.top);
expect(Tabs_index_013.top).assertEqual(Tabs_index_003.top);
console.info(`[testTabsIndexNormal] Tabs_index_011.bottom -
Tabs_index_011.top = ${Tabs_index_011.bottom - Tabs_index_011.top}`);
expect(Math.round(Tabs_index_011.bottom - Tabs_index_011.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_012.bottom - Tabs_index_012.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_013.bottom - Tabs_index_013.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_011.right - Tabs_index_011.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_012.right - Tabs_index_012.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_013.right - Tabs_index_013.left)).assertEqual(vp2px(330));
console.info(`[testTabsIndexNormal] Tabs_index_001.bottom -
Tabs_index_001.top = ${Tabs_index_001.bottom - Tabs_index_001.top}`);
expect(Math.round(Tabs_index_001.bottom - Tabs_index_001.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_002.bottom - Tabs_index_002.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_003.bottom - Tabs_index_003.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_001.right - Tabs_index_001.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_002.right - Tabs_index_002.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_003.right - Tabs_index_003.left)).assertEqual(vp2px(330));
console.info(`[testTabsIndexNormal] subGreen.bottom = ${subGreen.bottom}`);
expect(subGreen.bottom).assertEqual(Tabs_index_001.top);
expect(subGreen.bottom).assertEqual(subBlue.bottom);
expect(subGreen.bottom).assertEqual(subYellow.bottom);
console.info(`[testTabsIndexNormal] subGreen.bottom - subGreen.top = ${subGreen.bottom - subGreen.top}`);
expect(Math.round(subGreen.bottom - subGreen.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subBlue.bottom - subBlue.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subYellow.bottom - subYellow.top)).assertEqual(Math.round(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('[testTabsIndexNormal] END');
done();
});
/**
* @tc.number SUB_ACE_TABS_INDEX_TEST_0300
* @tc.name testTabsIndexMoreThanMax
* @tc.desc set index of tabs to 3
*/
it('testTabsIndexMoreThanMax', 0, async function (done) {
console.info('[testTabsIndexMoreThanMax] START');
globalThis.value.message.notify({name:'index', value:3});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('Tabs_Index_01');
let obj = JSON.parse(strJson);
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');
console.info(`[testTabsIndexMoreThanMax] type: ${JSON.stringify(obj.$type)}`);
console.info(`[testTabsIndexMoreThanMax] barPosition: ${JSON.stringify(obj.$attrs.barPosition)}`);
console.info(`[testTabsIndexMoreThanMax] index: ${JSON.stringify(obj.$attrs.index)}`);
console.info(`[testTabsIndexMoreThanMax] scrollable: ${JSON.stringify(obj.$attrs.scrollable)}`);
console.info(`[testTabsIndexMoreThanMax] vertical: ${JSON.stringify(obj.$attrs.vertical)}`);
console.info(`[testTabsIndexMoreThanMax] barMode: ${JSON.stringify(obj.$attrs.barMode)}`);
let Tabs_index_01 = CommonFunc.getComponentRect('Tabs_Index_01');
let Tabs_index_001 = CommonFunc.getComponentRect('Tabs_Index_001');
let Tabs_index_011 = CommonFunc.getComponentRect('Tabs_Index_011');
let driver = await Driver.create();
await driver.swipe(Math.round(Tabs_index_011.right - 30),
Math.round(Tabs_index_011.top + ((Tabs_index_011.bottom - Tabs_index_011.top) / 2)),
Math.round(Tabs_index_011.left + 30),
Math.round(Tabs_index_011.top + ((Tabs_index_011.bottom - Tabs_index_011.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_index_002 = CommonFunc.getComponentRect('Tabs_Index_002');
let Tabs_index_012 = CommonFunc.getComponentRect('Tabs_Index_012');
await driver.swipe(Math.round(Tabs_index_012.right - 30),
Math.round(Tabs_index_012.top +((Tabs_index_012.bottom - Tabs_index_012.top) / 2)),
Math.round(Tabs_index_012.left + 30),
Math.round(Tabs_index_012.top + ((Tabs_index_012.bottom - Tabs_index_012.top) / 2)));
await CommonFunc.sleep(1000);
let Tabs_index_003 = CommonFunc.getComponentRect('Tabs_Index_003');
let Tabs_index_013 = CommonFunc.getComponentRect('Tabs_Index_013');
let subGreen = CommonFunc.getComponentRect('Tabs_Index_Green');
let subBlue = CommonFunc.getComponentRect('Tabs_Index_Blue');
let subYellow = CommonFunc.getComponentRect('Tabs_Index_Yellow');
console.info(`[testTabsIndexMoreThanMax] Tabs_index_01.left = ${Tabs_index_01.left}`);
expect(Tabs_index_01.left).assertEqual(Tabs_index_011.left);
expect(Tabs_index_01.left).assertEqual(Tabs_index_012.left);
expect(Tabs_index_01.left).assertEqual(Tabs_index_013.left);
console.info(`[testTabsIndexMoreThanMax] Tabs_index_011.left = ${Tabs_index_011.left}`);
expect(Tabs_index_011.left).assertEqual(Tabs_index_001.left);
expect(Tabs_index_012.left).assertEqual(Tabs_index_002.left);
expect(Tabs_index_013.left).assertEqual(Tabs_index_003.left);
expect(Tabs_index_011.top).assertEqual(Tabs_index_001.top);
expect(Tabs_index_012.top).assertEqual(Tabs_index_002.top);
expect(Tabs_index_013.top).assertEqual(Tabs_index_003.top);
console.info(`[testTabsIndexMoreThanMax] Tabs_index_011.bottom -
Tabs_index_011.top = ${Tabs_index_011.bottom - Tabs_index_011.top}`);
expect(Math.round(Tabs_index_011.bottom - Tabs_index_011.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_012.bottom - Tabs_index_012.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_013.bottom - Tabs_index_013.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_011.right - Tabs_index_011.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_012.right - Tabs_index_012.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_013.right - Tabs_index_013.left)).assertEqual(vp2px(330));
console.info(`[testTabsIndexMoreThanMax] Tabs_index_001.bottom -
Tabs_index_001.top = ${Tabs_index_001.bottom - Tabs_index_001.top}`);
expect(Math.round(Tabs_index_001.bottom - Tabs_index_001.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_002.bottom - Tabs_index_002.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_003.bottom - Tabs_index_003.top)).assertEqual(Math.round(vp2px(244)));
expect(Math.round(Tabs_index_001.right - Tabs_index_001.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_002.right - Tabs_index_002.left)).assertEqual(vp2px(330));
expect(Math.round(Tabs_index_003.right - Tabs_index_003.left)).assertEqual(vp2px(330));
console.info(`[testTabsIndexMoreThanMax] subGreen.bottom = ${subGreen.bottom}`);
expect(subGreen.bottom).assertEqual(Tabs_index_001.top);
expect(subGreen.bottom).assertEqual(subBlue.bottom);
expect(subGreen.bottom).assertEqual(subYellow.bottom);
console.info(`[testTabsIndexMoreThanMax] subGreen.bottom - subGreen.top = ${subGreen.bottom - subGreen.top}`);
expect(Math.round(subGreen.bottom - subGreen.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subBlue.bottom - subBlue.top)).assertEqual(Math.round(vp2px(56)));
expect(Math.round(subYellow.bottom - subYellow.top)).assertEqual(Math.round(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('[testTabsIndexMoreThanMax] END');
done();
});
})
}
arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
bf2e4f97
...
...
@@ -74,6 +74,9 @@
"MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize"
,
"MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar"
,
"MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset"
,
"MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility"
"MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility"
,
"MainAbility/pages/Tabs/tabs_index/Tabs_index"
,
"MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_PadMar"
,
"MainAbility/pages/Tabs/Tabs_ParmsChange/Tabs_WidHei"
]
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录