feat: Trace programing practice

Signed-off-by: revin-sun <sunren1@huawei.com>
This commit is contained in:
revin-sun 2023-12-15 14:21:29 +08:00
parent b82d35b993
commit d7bb3f873d
29 changed files with 833 additions and 115 deletions

View File

@ -70,6 +70,10 @@ SmartPerfHost使用说明
5.点击SmartPerfHost查看AppStartup优化前场景页的**AppStartup优化后代码**按钮进入场景页。
Trace使用说明
1.点击性能示例主页的**Trace**按钮,进入**懒加载示例**场景页。
### 工程目录
```
@ -130,6 +134,13 @@ features
| | |---StaticContentPageTwo.ets // 常规加载子页面
| | |---StaticEntryView.ets // 常规加载入口页面
| | |---StaticHome.ets // 常规加载主页
|---/trace/src/main/ets // Trace功能HAR共享包
|---|---/pages
| | |---LazyForEachPage.ets // 懒加载示例场景页面
|---|---/view
| | |---IconView.ets // 懒加载示例场景子页面
|---|---/viewmodel
| | |---BasicDataSource.ets // 封装列表数据方法
products/phone/entry/src/main/ets
|---/entryability
| |---EntryAbility.ts // 封装整个模块启用监听Ability对应的窗口等逻辑
@ -172,7 +183,9 @@ products/phone/entry/src/main/ets
| |---/staticImport
| | |---StaticEntryView.ets // 常规加载入口页面
| | |---StaticHome.ets // 常规加载主页
| |---/Index // 性能示例首页
| |---/trace
| | |---TracePage.ets // 懒加载示例首页
| |---/Index
|---/utils
| |---Logger.ets // 封装整个日志

View File

@ -0,0 +1,6 @@
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test

View File

@ -0,0 +1,16 @@
/*
* Copyright (c) 2023 Huawei Device 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.
*/
export { LazyForEachPage } from './src/main/ets/pages/LazyForEachPage'

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2023 Huawei Device 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.
*/
{
"apiType": "stageMode",
"buildOption": {
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
},
"consumerFiles": [
"./consumer-rules.txt"
]
}
}
},
],
"targets": [
{
"name": "default"
}
]
}

View File

@ -0,0 +1,21 @@
/*
* Copyright (c) 2023 Huawei Device 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 { harTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
}

View File

@ -0,0 +1,18 @@
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2023 Huawei Device 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.
*/
{
"license": "Apache-2.0",
"devDependencies": {},
"author": "",
"name": "trace",
"description": "Please describe the basic information.",
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,101 @@
/*
* Copyright (c) 2023 Huawei Device 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 { IconItem } from '../view/IconView';
import { BasicDataSource } from '../viewmodel/BasicDataSource';
// List子组件主轴方向的间隔
const LIST_SPACE: number = 20;
// List分割线的宽度
const STROKE_WIDTH: number = 2;
// List分割线的起始位置
const START_MARGIN: number = 20;
// List分割线的结束位置
const END_MARGIN: number = 20;
// 设置子组件和兄弟元素在主轴上的权重
const LAYOUT_WEIGHT: number = 1;
// IconItem相关数据
class IconItemModel {
image: string | Resource = '';
text: string | Resource = '';
constructor(image: string | Resource = '', text: string | Resource = '') {
this.image = image;
this.text = text;
}
}
@Component
export struct LazyForEachPage {
private iconItemSourceList = new ListData();
aboutToAppear() {
// 遍历添加120个IconItem的数据
for (let index = 0; index < 20; index++) {
const numStart: number = index * 6;
// 此处循环使用三张图片资源
this.iconItemSourceList.pushData(new IconItemModel($r('app.media.nearby'), `item${numStart + 1}`));
this.iconItemSourceList.pushData(new IconItemModel($r('app.media.scan'), `item${numStart + 2}`));
this.iconItemSourceList.pushData(new IconItemModel($r('app.media.shop'), `item${numStart + 3}`));
this.iconItemSourceList.pushData(new IconItemModel($r('app.media.cards'), `item${numStart + 4}`));
this.iconItemSourceList.pushData(new IconItemModel($r('app.media.album'), `item${numStart + 5}`));
this.iconItemSourceList.pushData(new IconItemModel($r('app.media.applet'), `item${numStart + 6}`));
}
}
build() {
Column() {
Text('懒加载示例')
.fontSize($r('app.integer.LazyForEachPage_title_font'))
.fontColor(Color.Black)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Start)
.width($r('app.string.layout_90_percent'))
.height($r('app.integer.LazyForEachPage_title_height'))
List({ space:LIST_SPACE }) {
LazyForEach(this.iconItemSourceList, (item: IconItemModel) => {
ListItem() {
IconItem({ image: item.image, text: item.text })
}
}, (item: IconItemModel, index) => index.toString())
}
.divider({ strokeWidth: STROKE_WIDTH, startMargin: START_MARGIN, endMargin: END_MARGIN }) // 每行之间的分界线
.width($r('app.string.layout_100_percent'))
.height($r('app.string.layout_100_percent'))
.layoutWeight(LAYOUT_WEIGHT)
}
.width('100%')
.height('100%')
.alignItems(HorizontalAlign.Center)
}
}
export class ListData extends BasicDataSource<IconItemModel> {
private menuList: Array<IconItemModel> = [];
public totalCount(): number {
return this.menuList.length;
}
public getData(index: number): IconItemModel {
return this.menuList[index];
}
public pushData(data: IconItemModel): void {
this.menuList.push(data);
this.notifyDataAdd(this.menuList.length - 1);
}
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2023 Huawei Device 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.
*/
@Component
export struct IconItem {
image: string | Resource = '';
text: string | Resource = '';
build() {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignContent: FlexAlign.Center }) {
Image(this.image)
.id('itemImage')
.height($r('app.integer.LazyForEachPage_item_image_height'))
.width($r('app.integer.LazyForEachPage_item_image_width'))
.objectFit(ImageFit.Contain)
.margin({
left: $r('app.integer.LazyForEachPage_item_image_margin_left')
})
Text(this.text)
.fontSize($r('app.integer.LazyForEachPage_text_font'))
.fontColor(Color.Black)
.width($r('app.integer.LazyForEachPage_text_width'))
.height($r('app.integer.LazyForEachPage_text_height'))
.textAlign(TextAlign.Center)
}
.width('100%')
.height($r('app.integer.LazyForEachPage_item_height'))
}
}

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2023 Huawei Device 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.
*/
/**
* IDataSource处理数据监听的基本实现
*/
export abstract class BasicDataSource<T> implements IDataSource {
private listeners: DataChangeListener[] = []
public abstract totalCount(): number
public getData(index: number): T | void {
console.info('getDataindex:'+index);
}
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
}
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
}
notifyDataReload(): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataReloaded();
});
}
notifyDataAdd(index: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataAdd(index);
})
}
notifyDataChange(index: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataChange(index);
})
}
notifyDataDelete(index: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataDelete(index);
})
}
notifyDataMove(from: number, to: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataMove(from, to);
})
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2023 Huawei Device 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.
*/
{
"module": {
"name": "trace",
"type": "har",
"deviceTypes": [
"default",
"tablet"
]
}
}

View File

@ -0,0 +1,40 @@
{
"integer": [
{
"name": "LazyForEachPage_title_font",
"value": 24
},
{
"name": "LazyForEachPage_title_height",
"value": 50
},
{
"name": "LazyForEachPage_item_image_height",
"value": 40
},
{
"name": "LazyForEachPage_item_image_width",
"value": 40
},
{
"name": "LazyForEachPage_item_image_margin_left",
"value": 15
},
{
"name": "LazyForEachPage_text_font",
"value": 20
},
{
"name": "LazyForEachPage_text_width",
"value": 100
},
{
"name": "LazyForEachPage_text_height",
"value": 50
},
{
"name": "LazyForEachPage_item_height",
"value": 50
}
]
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "page_show",
"value": "page from npm package"
},
{
"name": "layout_100_percent",
"value": "100%"
},
{
"name": "layout_90_percent",
"value": "90%"
}
]
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_applet</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="发现" transform="translate(-24.000000, -357.000000)">
<g id="编组-4备份-4" transform="translate(12.000000, 340.000000)">
<g id="List/single-line/48/with-right-element备份" transform="translate(12.000000, 16.000000)">
<g id="ic_applet" transform="translate(0.000000, 1.000000)">
<rect id="矩形" x="0" y="0" width="22" height="22"></rect>
<path d="M11,1 C16.5228571,1 21,5.47714286 21,11 C21,16.5228571 16.5228571,21 11,21 C5.47714286,21 1,16.5228571 1,11 C1,5.47714286 5.47714286,1 11,1 Z M11,2.42857143 C6.26613839,2.42857143 2.42857143,6.26613839 2.42857143,11 C2.42857143,15.7338616 6.26613839,19.5714286 11,19.5714286 C15.7338616,19.5714286 19.5714286,15.7338616 19.5714286,11 C19.5714286,6.26613839 15.7338616,2.42857143 11,2.42857143 Z M13.3277679,5.58399554 C14.9937723,5.58399554 16.3492634,6.93948661 16.3492634,8.60549107 C16.3492634,9.77866071 15.6610045,10.8554911 14.5960268,11.3485045 C14.502288,11.3920684 14.4001752,11.4146619 14.296808,11.4147098 C14.0186123,11.4148874 13.765693,11.2533209 13.6489062,11.0008259 C13.4850446,10.6468527 13.6359598,10.2277009 13.9859375,10.0587277 L13.9965848,10.053683 C14.5590848,9.79330357 14.9224107,9.22493304 14.9224107,8.60546875 C14.9224107,7.72613839 14.2071205,7.01084821 13.3277679,7.01084821 C12.4572321,7.01084821 11.7474554,7.71191964 11.7333482,8.57915179 L11.733125,8.60549107 C11.733125,8.62511161 11.7321652,8.64549107 11.7302679,8.66754464 L11.7300446,8.67232143 L11.7300446,13.3669643 L11.7219643,13.3669643 L11.7219643,13.4227679 C11.7219643,15.0887946 10.3664732,16.4442634 8.70049107,16.4442634 C7.03448661,16.4442634 5.67899554,15.0887946 5.67899554,13.4227902 C5.67899554,12.2489955 6.36774554,11.171942 7.43348214,10.6791518 C7.79107143,10.51375 8.21506696,10.6696205 8.38046875,11.0272768 C8.54419643,11.3813393 8.39308036,11.8004241 8.04301339,11.9692411 L8.03234375,11.9742634 C7.46946429,12.2345312 7.10584821,12.8029911 7.10584821,13.4227902 C7.10584821,14.3021205 7.82113839,15.0174107 8.70049107,15.0174107 C9.57982143,15.0174107 10.2951116,14.3021205 10.2951116,13.4227679 C10.2951116,13.3869866 10.2977902,13.3512277 10.3031027,13.3158259 L10.3037277,13.3116964 L10.3037054,8.66129464 L10.3062946,8.66129464 L10.3062946,8.60549107 C10.3062946,6.95616071 11.6347768,5.61116071 13.2778795,5.58441964 L13.3277679,5.58399554 L13.3277679,5.58399554 Z" id="形状" fill="#6236FF" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="18px" viewBox="0 0 20 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>public/ic_back</title>
<defs>
<path d="M3.81079777,10.7499686 L9.78033009,16.7196699 L9.81407138,16.7556673 C10.0727547,17.0502619 10.0615076,17.4991526 9.78033009,17.7803301 C9.4991526,18.0615076 9.05026186,18.0727547 8.75566731,17.8140714 L8.71966991,17.7803301 L1.68929777,10.7499686 L3.81079777,10.7499686 Z M9.78033009,0.219669914 C10.0615076,0.500847404 10.0727547,0.949738137 9.81407138,1.24433269 L9.78033009,1.28033009 L2.8105,8.25 L19.5,8.25 C19.8994202,8.25 20.2259152,8.56222999 20.2487268,8.9559318 L20.25,9 C20.25,9.39942022 19.93777,9.72591522 19.5440682,9.74872683 L19.5,9.75 L1,9.75 C0.346037929,9.75 0.0115866314,8.97615472 0.440603566,8.50027227 L0.469669914,8.46966991 L8.71966991,0.219669914 C9.01256313,-0.0732233047 9.48743687,-0.0732233047 9.78033009,0.219669914 Z" id="path-1"></path>
</defs>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="朋友圈" transform="translate(-26.000000, -43.000000)">
<g id="AppBar/Regular/basic+actions" transform="translate(24.000000, 37.000000)">
<g id="public/ic_back" transform="translate(0.000000, 3.000000)">
<g id="symbol/frame/symbol_grid24-copy"></g>
<g id="编组" transform="translate(1.750000, 3.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<g id="形状结合" fill-rule="nonzero"></g>
<rect id="color/#000000" fill="#182431" mask="url(#mask-2)" x="-1.75" y="-3" width="24" height="24"></rect>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_cards</title>
<defs>
<filter color-interpolation-filters="auto" id="filter-1">
<feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 0.000000 0 0 0 0 0.490196 0 0 0 0 1.000000 0 0 0 1.000000 0"></feColorMatrix>
</filter>
<path d="M21.0833333,15.5833333 C21.0833333,17.6083774 19.4417107,19.25 17.4166667,19.25 L4.58333333,19.25 C2.55828925,19.25 0.916666667,17.6083774 0.916666667,15.5833333 L0.916666667,6.41666667 C0.916666667,4.39162258 2.55828925,2.75 4.58333333,2.75 L17.4166667,2.75 C19.3763867,2.75 20.9770232,4.28741969 21.0782508,6.22193384 L21.0833333,6.41666667 L21.0833333,15.5833333 Z M19.7076667,8.25 L2.29166667,8.25 L2.29166667,15.5833333 C2.29166667,16.8275341 3.28319539,17.840151 4.51918847,17.8741196 L4.58333333,17.875 L17.4166667,17.875 C18.6608675,17.875 19.6734844,16.8834713 19.7074529,15.6474782 L19.7083333,15.5833333 L19.7076667,8.25 Z M10.3125,9.625 C10.6921958,9.625 11,9.93280423 11,10.3125 C11,10.6921958 10.6921958,11 10.3125,11 L4.35416667,11 C3.9744709,11 3.66666667,10.6921958 3.66666667,10.3125 C3.66666667,9.93280423 3.9744709,9.625 4.35416667,9.625 L10.3125,9.625 Z M17.4808115,4.12588041 L4.58333333,4.125 C3.33913252,4.125 2.32651565,5.11652872 2.29254708,6.35252181 L2.29166667,6.416 L19.7083333,6.41666667 C19.7083333,5.17246585 18.7168046,4.15984898 17.4808115,4.12588041 Z" id="path-2"></path>
</defs>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="我的" transform="translate(-24.000000, -358.000000)">
<g id="ic_cards" transform="translate(12.000000, 197.000000)" filter="url(#filter-1)">
<g transform="translate(12.000000, 161.000000)">
<rect id="矩形" x="0" y="0" width="22" height="22"></rect>
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<g id="形状结合" fill-rule="nonzero"></g>
<g id="编组" mask="url(#mask-3)" fill="#FA6400" fill-opacity="0.9">
<g id="Symbol/color-light/colorPrimary">
<rect id="color/#000000" x="0" y="0" width="22" height="22"></rect>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="18px" height="22px" viewBox="0 0 18 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_near</title>
<defs>
<filter color-interpolation-filters="auto" id="filter-1">
<feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 0.105882 0 0 0 0 0.835294 0 0 0 0 0.509804 0 0 0 1.000000 0"></feColorMatrix>
</filter>
<path d="M11,0.816240026 C15.6799965,0.816240026 19.4791667,4.54359252 19.4791667,9.14814635 C19.4791667,10.9413637 18.9359957,12.6935534 17.9278262,14.4644549 C17.3001642,15.5669755 16.5459661,16.6050046 15.5474582,17.7902515 L15.5474582,17.7902515 L15.3030652,18.0776458 L15.048929,18.3713436 C14.9625528,18.4703657 14.8744924,18.5705468 14.7846876,18.6719953 C14.5844402,18.8982057 14.3595853,19.135905 14.1100407,19.3852499 L14.1100407,19.3852499 L13.9182516,19.5744445 C13.7873043,19.7020333 13.6501795,19.8325433 13.5068668,19.9659941 L13.5068668,19.9659941 L13.2872556,20.1683783 C13.2498799,20.2024774 13.2121171,20.236761 13.173967,20.2712292 L13.173967,20.2712292 L12.9404188,20.4802579 C12.8610197,20.5506746 12.7800704,20.6218326 12.6975697,20.6937345 L12.6975697,20.6937345 L12.4454119,20.9116738 C11.645446,21.5975104 10.4692289,21.618815 9.63358735,20.9564556 L9.63358735,20.9564556 L9.56839926,20.9021196 L9.26507984,20.6375891 L9.07795078,20.4728538 L8.81273835,20.2369709 L8.5660092,20.0144421 L8.33765747,19.8051438 L8.12757728,19.6089523 L7.99762241,19.4853786 L7.87570981,19.3675385 L7.76180812,19.2553955 L7.65588595,19.1489129 L7.55791196,19.0480542 C7.54224357,19.031711 7.52690504,19.0156006 7.51189573,18.9997223 L7.51189573,18.9997223 L7.42578517,18.9072306 L7.21319597,18.6700154 L6.97833832,18.4036777 C6.93967201,18.3594594 6.90124435,18.3153257 6.86305587,18.2712747 L6.86305587,18.2712747 L6.63679901,18.0079485 L6.41630662,17.7465258 L6.41630662,17.7465258 L6.30822974,17.6165022 L6.09642992,17.3577784 L5.89045574,17.1007496 C3.69071271,14.3251517 2.52083333,11.8332778 2.52083333,9.14814635 C2.52083333,4.57730584 6.14891831,0.890581125 10.7556612,0.81728588 L10.7556612,0.81728588 L10.8899427,0.816240026 Z M11,2.1912183 L10.8954084,2.1912183 L10.7720671,2.1921771 C6.92160051,2.25345789 3.89583333,5.32812971 3.89583333,9.14814635 C3.89583333,11.8217999 5.31593095,14.4119317 8.00841612,17.4928378 L8.00841612,17.4928378 L8.23897567,17.7543772 L8.44472439,17.9840122 C8.45625336,17.9965985 8.46810817,18.009428 8.4802884,18.0225002 L8.4802884,18.0225002 L8.55727142,18.1038423 L8.64204421,18.1909864 L8.73458647,18.2839089 L8.88792324,18.4340761 L9.05862717,18.5971127 L9.24662976,18.7729396 L9.38154136,18.8972241 L9.59822285,19.0941919 L9.83202035,19.3037387 L10.0828654,19.525785 L10.4591378,19.8547809 L10.4994215,19.8884098 C10.8078076,20.1327674 11.2507501,20.1247444 11.5504598,19.8677937 L11.5504598,19.8677937 L11.7911033,19.6598268 L12.0224506,19.4565243 C12.0980162,19.3895359 12.1720311,19.3233274 12.244494,19.2579011 L12.244494,19.2579011 L12.4572258,19.0639718 L12.6606382,18.8747511 L12.8547237,18.6902536 L13.0394744,18.5104942 C13.3095956,18.2444159 13.5481863,17.9943779 13.7551294,17.7606036 L13.7551294,17.7606036 L13.8713764,17.6288064 L14.0990641,17.367729 C14.1364784,17.3244905 14.173626,17.2813874 14.2105071,17.2384171 L14.2105071,17.2384171 L14.4285972,16.9821675 L14.6403003,16.7289778 C14.7793088,16.5611765 14.9140654,16.3953306 15.0445823,16.2312711 L15.0445823,16.2312711 L15.2371794,15.9865004 C17.1629544,13.5111891 18.1041667,11.4316478 18.1041667,9.14814635 C18.1041667,5.30891955 14.9264165,2.1912183 11,2.1912183 L11,2.1912183 Z M11,7.10416667 C12.1390873,7.10416667 13.0625,8.02757937 13.0625,9.16666667 C13.0625,10.305754 12.1390873,11.2291667 11,11.2291667 C9.8609127,11.2291667 8.9375,10.305754 8.9375,9.16666667 C8.9375,8.02757937 9.8609127,7.10416667 11,7.10416667 Z" id="path-2"></path>
</defs>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="发现" transform="translate(-26.000000, -425.000000)">
<g id="编组-4备份-5" transform="translate(12.000000, 408.000000)">
<g id="List/single-line/48/with-right-element备份" transform="translate(12.000000, 16.000000)">
<g id="Public/ic_public_gps" transform="translate(0.000000, 1.000000)" filter="url(#filter-1)">
<g>
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<g id="蒙版" fill-rule="nonzero"></g>
<g id="编组" mask="url(#mask-3)" fill="#1BD582" fill-opacity="0.9">
<g id="Symbol/color-light/colorPrimary">
<rect id="color/#000000" x="0" y="0" width="22" height="22"></rect>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_scan</title>
<defs>
<filter color-interpolation-filters="auto" id="filter-1">
<feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 0.000000 0 0 0 0 0.490196 0 0 0 0 1.000000 0 0 0 1.000000 0"></feColorMatrix>
</filter>
<path d="M19.4791667,12.8333333 C19.8272211,12.8333333 20.1148667,13.0919744 20.1603906,13.4275437 L20.1666667,13.5208333 L20.1666667,16.5 C20.1666667,18.4636791 18.6230289,20.0668223 16.6830036,20.1621793 L16.5,20.1666667 L13.5208333,20.1666667 C13.1411376,20.1666667 12.8333333,19.8588624 12.8333333,19.4791667 C12.8333333,19.1311122 13.0919744,18.8434666 13.4275437,18.7979427 L13.5208333,18.7916667 L16.5,18.7916667 C17.7150264,18.7916667 18.7092021,17.8460921 18.7867921,16.6506777 L18.7916667,16.5 L18.7916667,13.5208333 C18.7916667,13.1411376 19.0994709,12.8333333 19.4791667,12.8333333 Z M2.52083333,12.8333333 C2.86888779,12.8333333 3.15653338,13.0919744 3.20205727,13.4275437 L3.20833333,13.5208333 L3.20833333,16.5 C3.20833333,17.7150264 4.15390794,18.7092021 5.34932229,18.7867921 L5.5,18.7916667 L8.47916667,18.7916667 C8.85886243,18.7916667 9.16666667,19.0994709 9.16666667,19.4791667 C9.16666667,19.8272211 8.90802561,20.1148667 8.57245634,20.1603906 L8.47916667,20.1666667 L5.5,20.1666667 C3.53632089,20.1666667 1.9331777,18.6230289 1.8378207,16.6830036 L1.83333333,16.5 L1.83333333,13.5208333 C1.83333333,13.1411376 2.14113757,12.8333333 2.52083333,12.8333333 Z M16.7291667,10.3125 C17.1088624,10.3125 17.4166667,10.6203042 17.4166667,11 C17.4166667,11.3796958 17.1088624,11.6875 16.7291667,11.6875 L5.27083333,11.6875 C4.89113757,11.6875 4.58333333,11.3796958 4.58333333,11 C4.58333333,10.6203042 4.89113757,10.3125 5.27083333,10.3125 L16.7291667,10.3125 Z M16.5,1.83333333 C18.4636791,1.83333333 20.0668223,3.3769711 20.1621793,5.31699635 L20.1666667,5.5 L20.1666667,8.47916667 C20.1666667,8.85886243 19.8588624,9.16666667 19.4791667,9.16666667 C19.1311122,9.16666667 18.8434666,8.90802561 18.7979427,8.57245634 L18.7916667,8.47916667 L18.7916667,5.5 C18.7916667,4.28497355 17.8460921,3.29079788 16.6506777,3.21320787 L16.5,3.20833333 L13.5208333,3.20833333 C13.1411376,3.20833333 12.8333333,2.9005291 12.8333333,2.52083333 C12.8333333,2.17277888 13.0919744,1.88513329 13.4275437,1.8396094 L13.5208333,1.83333333 L16.5,1.83333333 Z M8.47916667,1.83333333 C8.85886243,1.83333333 9.16666667,2.14113757 9.16666667,2.52083333 C9.16666667,2.86888779 8.90802561,3.15653338 8.57245634,3.20205727 L8.47916667,3.20833333 L5.5,3.20833333 C4.28497355,3.20833333 3.29079788,4.15390794 3.21320787,5.34932229 L3.20833333,5.5 L3.20833333,8.47916667 C3.20833333,8.85886243 2.9005291,9.16666667 2.52083333,9.16666667 C2.17277888,9.16666667 1.88513329,8.90802561 1.8396094,8.57245634 L1.83333333,8.47916667 L1.83333333,5.5 C1.83333333,3.53632089 3.3769711,1.9331777 5.31699635,1.8378207 L5.5,1.83333333 L8.47916667,1.83333333 Z" id="path-2"></path>
</defs>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="发现" transform="translate(-25.000000, -174.000000)">
<g id="编组-4" transform="translate(12.000000, 156.000000)">
<g id="Public/ic_public_scan" transform="translate(12.000000, 17.000000)" filter="url(#filter-1)">
<g>
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<g id="形状结合" fill-rule="nonzero"></g>
<g id="编组" mask="url(#mask-3)" fill="#007DFF" fill-opacity="0.9">
<g id="Symbol/color-light/colorPrimary">
<rect id="color/#000000" x="0" y="0" width="22" height="22"></rect>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_shop</title>
<defs>
<filter color-interpolation-filters="auto" id="filter-1">
<feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 0.878431 0 0 0 0 0.125490 0 0 0 0 0.125490 0 0 0 1.000000 0"></feColorMatrix>
</filter>
<path d="M16.5,1.83333333 C18.5250441,1.83333333 20.1666667,3.47495592 20.1666667,5.5 L20.1666667,16.5 C20.1666667,18.5250441 18.5250441,20.1666667 16.5,20.1666667 L5.5,20.1666667 C3.47495592,20.1666667 1.83333333,18.5250441 1.83333333,16.5 L1.83333333,5.5 C1.83333333,3.47495592 3.47495592,1.83333333 5.5,1.83333333 L16.5,1.83333333 Z M16.5,3.20833333 L5.5,3.20833333 C4.28497355,3.20833333 3.29079788,4.15390794 3.21320787,5.34932229 L3.20833333,5.5 L3.20833333,16.5 C3.20833333,17.7150264 4.15390794,18.7092021 5.34932229,18.7867921 L5.5,18.7916667 L16.5,18.7916667 C17.7150264,18.7916667 18.7092021,17.8460921 18.7867921,16.6506777 L18.7916667,16.5 L18.7916667,5.5 C18.7916667,4.28497355 17.8460921,3.29079788 16.6506777,3.21320787 L16.5,3.20833333 Z M15.125,5.5 C15.5046958,5.5 15.8125,5.80780423 15.8125,6.1875 C15.8125,8.84537036 13.6578704,11 11,11 C8.34212964,11 6.1875,8.84537036 6.1875,6.1875 C6.1875,5.80780423 6.49530423,5.5 6.875,5.5 C7.25469577,5.5 7.5625,5.80780423 7.5625,6.1875 C7.5625,8.08597883 9.10152117,9.625 11,9.625 C12.8984788,9.625 14.4375,8.08597883 14.4375,6.1875 C14.4375,5.80780423 14.7453042,5.5 15.125,5.5 Z" id="path-2"></path>
</defs>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="发现" transform="translate(-25.000000, -500.000000)">
<g id="编组-4备份-2" transform="translate(8.000000, 482.000000)">
<g id="List/single-line/48/with-right-element备份" transform="translate(16.000000, 4.000000)">
<g id="Public/ic_public_appstore" transform="translate(0.000000, 13.000000)" filter="url(#filter-1)">
<g>
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<g id="形状结合" fill-rule="nonzero"></g>
<g id="编组" mask="url(#mask-3)" fill="#E02020" fill-opacity="0.9">
<g id="Symbol/color-light/colorPrimary">
<rect id="color/#000000" x="0" y="0" width="22" height="22"></rect>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2023 Huawei Device 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.
*/
{
"lockfileVersion": 1,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
},
"packages": {
"@ohos/hypium@1.0.6": {
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
}
}
}

View File

@ -27,6 +27,7 @@
"@ohos/ifOrVisibility": "file:../../../feature/ifOrVisibility",
"@ohos/dynamicImport": "file:../../../feature/dynamicImport",
"@ohos/smartPerfEditor": "file:../../../feature/smartPerfEditor",
"@ohos/hiDumper": "file:../../../feature/hiDumper"
"@ohos/hiDumper": "file:../../../feature/hiDumper",
"@ohos/trace": "file:../../../feature/trace"
}
}

View File

@ -43,5 +43,9 @@ export let performanceTypeArray: Array<PerformanceMsg> = [
{
name: 'SmartPerfHost',
uri: 'pages/smartPerfHost/SmartPerfHostPage'
},
{
name: 'Trace',
uri: 'pages/trace/TracePage'
}
]

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2023 Huawei Device 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 { LazyForEachPage } from '@ohos/trace';
@Entry
@Component
struct TracePage {
build() {
Column() {
LazyForEachPage()
}
}
}

View File

@ -28,6 +28,7 @@
"pages/grid/GridLayoutOptionsPage",
"pages/grid/GridLazyForEachPage",
"pages/grid/GridPage",
"pages/smartPerfEditor/SmartPerfEditorPage"
"pages/smartPerfEditor/SmartPerfEditorPage",
"pages/trace/TracePage"
]
}

View File

@ -41,10 +41,11 @@ export default function abilityTest() {
Logger.info(TAG, BUNDLE + '_startAbility end')
done()
})
/**
* 点击HiDumper按钮进入HiDumper查看组件信息页面
*/
it(BUNDLE + "HiDumperFunction_001", 2, async (done: Function) => {
it(BUNDLE + "HiDumperFunction_001", 1, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}HiDumperFunction_001 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(5000);
@ -64,7 +65,7 @@ export default function abilityTest() {
/**
* 进入查看应用组件树页面,查看页面是否在正常显示
*/
it(BUNDLE + "HiDumperFunction_002", 3, async (done: Function) => {
it(BUNDLE + "HiDumperFunction_002", 2, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}HiDumperFunction_002 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
@ -83,7 +84,7 @@ export default function abilityTest() {
/**
* 进入查看if/else组件页面查看页面是否在正常显示
*/
it(BUNDLE + "HiDumperFunction_003", 4, async (done: Function) => {
it(BUNDLE + "HiDumperFunction_003", 3, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}HiDumperFunction_003 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
@ -102,10 +103,11 @@ export default function abilityTest() {
Logger.info(TAG, `${BUNDLE}HiDumperFunction_003 end`);
done();
})
/**
* 进入查看visibility属性页面查看页面是否在正常显示
*/
it(BUNDLE + "HiDumperFunction_004", 5, async (done: Function) => {
it(BUNDLE + "HiDumperFunction_004", 4, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}HiDumperFunction_004 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
@ -134,6 +136,7 @@ export default function abilityTest() {
Logger.info(TAG, `${BUNDLE}HiDumperFunction_004 end`);
done();
})
/**
* 点击"点击跳转静态加载案例"按钮,进入静态加载场景页面
*/
@ -175,6 +178,7 @@ export default function abilityTest() {
Logger.info(TAG, `${BUNDLE}DynamicImportFunction_001 end`);
done();
})
/**
* 点击"点击跳转动态加载案例"按钮,进入动态加载场景页面
*/
@ -205,91 +209,20 @@ export default function abilityTest() {
await back.click();
await driver.delayMs(500);
await driver.pressBack();
Logger.info(TAG, `${BUNDLE}DynamicImportFunction_001 end`)
})
/**
* 进入查看SmartPerfHostFrameTimeline优化前页面查看页面是否在正常显示
*/
it(BUNDLE + "SmartPerfHostFrameTimeline01", 555, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}SmartPerfHostFrameTimeline01 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(1000);
await driver.assertComponentExist(ON.text("SmartPerfHost"))
let ifElseComponent: Component = await driver.findComponent(ON.text("SmartPerfHost"));
await driver.delayMs(500);
await ifElseComponent.click();
await driver.delayMs(1000);
let showChange: Component = await driver.findComponent(ON.text("FrameTimeline优化前代码"));
await driver.delayMs(500);
await showChange.click();
await driver.delayMs(10000);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}SmartPerfHostFrameTimeline01 end`);
done();
})
/**
* 进入查看SmartPerfHostFrameTimeline优化后页面查看页面是否在正常显示
*/
it(BUNDLE + "SmartPerfHostFrameTimeline02", 556, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}SmartPerfHostFrameTimeline00 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
let showChange: Component = await driver.findComponent(ON.text("FrameTimeline优化后代码"));
await driver.delayMs(500);
await showChange.click();
await driver.delayMs(5000);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}SmartPerfHostFrameTimeline02 end`);
done();
})
/**
* 进入查看SmartPerfHostAPPStartup优化前页面查看页面是否在正常显示
*/
it(BUNDLE + "SmartPerfHostAPPStartup01", 557, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}SmartPerfHostAPPStartup01 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
let showChange: Component = await driver.findComponent(ON.text("AppStartup优化前代码"));
await driver.delayMs(500);
await showChange.click();
await driver.delayMs(5000);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}SmartPerfHostAPPStartup01 end`);
done();
})
/**
* 进入查看SmartPerfHostAPPStartup优化后页面查看页面是否在正常显示
*/
it(BUNDLE + "SmartPerfHostAPPStartup02", 558, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}SmartPerfHostAPPStartup02 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
let showChange: Component = await driver.findComponent(ON.text("AppStartup优化后代码"));
await driver.delayMs(500);
await showChange.click();
await driver.delayMs(5000);
await driver.pressBack();
await driver.delayMs(500);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}SmartPerfHostAPPStartup02 end`);
Logger.info(TAG, `${BUNDLE}DynamicImportFunction_001 end`);
done();
})
/**
* 点击IfOrVisibility按钮进入合理渲染信息页面
*/
it(BUNDLE + "IfOrVisibilityFunction_001", 3, async (done: Function) => {
it(BUNDLE + "IfOrVisibilityFunction_001", 1, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}IfOrVisibilityFunction_001 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(5000);
let hiDumper: Component = await driver.findComponent(ON.text("IfOrVisibility"));
await driver.delayMs(1000);
let IfOrVisibility: Component = await driver.findComponent(ON.text("IfOrVisibility"));
await driver.delayMs(500);
await hiDumper.click();
await IfOrVisibility.click();
await driver.delayMs(1000);
await driver.assertComponentExist(ON.text("合理选择条件渲染和显隐控制"));
await driver.assertComponentExist(ON.text("频繁切换:显隐控制"));
@ -301,17 +234,17 @@ export default function abilityTest() {
await driver.assertComponentExist(ON.text("复杂子树:条件渲染+组件复用"));
await driver.assertComponentExist(ON.text("复杂子树:仅条件渲染"));
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}HiDumperFunction_001 end`);
Logger.info(TAG, `${BUNDLE}IfOrVisibilityFunction_001 end`);
done();
})
/**
* 进入频繁切换场景,查看页面是否在正常显示
*/
it(BUNDLE + "IfOrVisibilityFunction_002", 4, async (done: Function) => {
it(BUNDLE + "IfOrVisibilityFunction_002", 2, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}IfOrVisibilityFunction_002 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
await driver.delayMs(1000);
let animateComponent: Component = await driver.findComponent(ON.text("频繁切换:显隐控制"));
await driver.delayMs(500);
await animateComponent.click();
@ -324,7 +257,7 @@ export default function abilityTest() {
await driver.delayMs(500);
await driver.pressBack();
await driver.delayMs(500);
animateComponent = await driver.findComponent(ON.text("频繁切换:显隐控制"));
animateComponent = await driver.findComponent(ON.text("频繁切换:条件渲染"));
await driver.delayMs(500);
await animateComponent.click();
await driver.delayMs(1000);
@ -343,10 +276,10 @@ export default function abilityTest() {
/**
* 进入首页渲染场景,查看页面是否在正常显示
*/
it(BUNDLE + "IfOrVisibilityFunction_003", 4, async (done: Function) => {
it(BUNDLE + "IfOrVisibilityFunction_003", 3, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}IfOrVisibilityFunction_003 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
await driver.delayMs(1000);
let animateComponent: Component = await driver.findComponent(ON.text("首页渲染:条件渲染"));
await driver.delayMs(500);
await animateComponent.click();
@ -381,30 +314,30 @@ export default function abilityTest() {
it(BUNDLE + "IfOrVisibilityFunction_004", 4, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}IfOrVisibilityFunction_004 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
await driver.delayMs(1000);
let animateComponent: Component = await driver.findComponent(ON.text("部分修改:条件渲染+容器限制"));
await driver.delayMs(500);
await driver.delayMs(1000);
await animateComponent.click();
await driver.delayMs(5000);
await driver.delayMs(1000);
let showChange: Component = await driver.findComponent(ON.text("Switch Hidden and Show"));
await driver.delayMs(1000);
await showChange.click();
await driver.delayMs(1000);
await showChange.click();
await driver.delayMs(500);
await showChange.click();
await driver.delayMs(1000);
await showChange.click();
await driver.delayMs(1000);
await driver.pressBack();
await driver.delayMs(500);
animateComponent = await driver.findComponent(ON.text("部分修改:仅条件渲染"));
await driver.delayMs(5000);
await driver.delayMs(3000);
await animateComponent.click();
await driver.delayMs(1000);
await driver.delayMs(15000);
showChange = await driver.findComponent(ON.text("Switch Hidden and Show"));
await driver.delayMs(500);
await driver.delayMs(1000);
await showChange.click();
await driver.delayMs(1000);
await showChange.click();
await driver.delayMs(500);
await driver.delayMs(1000);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}IfOrVisibilityFunction_004 end`);
@ -414,12 +347,12 @@ export default function abilityTest() {
/**
* 进入复杂子树场景,查看页面是否在正常显示
*/
it(BUNDLE + "IfOrVisibilityFunction_005", 4, async (done: Function) => {
it(BUNDLE + "IfOrVisibilityFunction_005", 5, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}IfOrVisibilityFunction_005 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
await driver.delayMs(1000);
let animateComponent: Component = await driver.findComponent(ON.text("复杂子树:条件渲染+组件复用"));
await driver.delayMs(3000);
await driver.delayMs(1000);
await animateComponent.click();
await driver.delayMs(1000);
let showChange: Component = await driver.findComponent(ON.text("Change FlexAlign"));
@ -427,31 +360,32 @@ export default function abilityTest() {
await showChange.click();
await driver.delayMs(1000);
await showChange.click();
await driver.delayMs(500);
await driver.delayMs(1000);
await driver.pressBack();
await driver.delayMs(500);
await driver.delayMs(1000);
animateComponent = await driver.findComponent(ON.text("复杂子树:仅条件渲染"));
await driver.delayMs(3000);
await animateComponent.click();
await driver.delayMs(1000);
showChange = await driver.findComponent(ON.text("Change FlexAlign"));
await driver.delayMs(500);
await driver.delayMs(5000);
await showChange.click();
await driver.delayMs(1000);
await showChange.click();
await driver.delayMs(500);
await driver.delayMs(1000);
await driver.pressBack();
await driver.delayMs(500);
await driver.delayMs(1000);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}IfOrVisibilityFunction_005 end`);
done();
})
/**
* Grid的使用
*/
it(BUNDLE + "GridFunction_001", 5, async (done: Function) => {
it(BUNDLE + "GridFunction_001", 1, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}GridFunction_001 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
@ -506,10 +440,11 @@ export default function abilityTest() {
Logger.info(TAG, `${BUNDLE}GridFunction_001 end`);
done();
})
/**
* SmartPerf Editor的使用
*/
it(BUNDLE + "SmartPerf_001", 5, async (done: Function) => {
it(BUNDLE + "SmartPerf_001", 1, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}SmartPerf_001 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
@ -529,5 +464,105 @@ export default function abilityTest() {
Logger.info(TAG, `${BUNDLE}SmartPerf_001 end`);
done();
})
/**
* 进入查看SmartPerfHostFrameTimeline优化前页面查看页面是否在正常显示
*/
it(BUNDLE + "SmartPerfHostFrameTimeline01", 1, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}SmartPerfHostFrameTimeline01 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(1000);
await driver.assertComponentExist(ON.text("SmartPerfHost"))
let ifElseComponent: Component = await driver.findComponent(ON.text("SmartPerfHost"));
await driver.delayMs(500);
await ifElseComponent.click();
await driver.delayMs(1000);
let showChange: Component = await driver.findComponent(ON.text("FrameTimeline优化前代码"));
await driver.delayMs(500);
await showChange.click();
await driver.delayMs(10000);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}SmartPerfHostFrameTimeline01 end`);
done();
})
/**
* 进入查看SmartPerfHostFrameTimeline优化后页面查看页面是否在正常显示
*/
it(BUNDLE + "SmartPerfHostFrameTimeline02", 2, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}SmartPerfHostFrameTimeline00 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
let showChange: Component = await driver.findComponent(ON.text("FrameTimeline优化后代码"));
await driver.delayMs(500);
await showChange.click();
await driver.delayMs(5000);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}SmartPerfHostFrameTimeline02 end`);
done();
})
/**
* 进入查看SmartPerfHostAPPStartup优化前页面查看页面是否在正常显示
*/
it(BUNDLE + "SmartPerfHostAPPStartup01", 1, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}SmartPerfHostAPPStartup01 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
let showChange: Component = await driver.findComponent(ON.text("AppStartup优化前代码"));
await driver.delayMs(500);
await showChange.click();
await driver.delayMs(5000);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}SmartPerfHostAPPStartup01 end`);
done();
})
/**
* 进入查看SmartPerfHostAPPStartup优化后页面查看页面是否在正常显示
*/
it(BUNDLE + "SmartPerfHostAPPStartup02", 2, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}SmartPerfHostAPPStartup02 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
let showChange: Component = await driver.findComponent(ON.text("AppStartup优化后代码"));
await driver.delayMs(500);
await showChange.click();
await driver.delayMs(5000);
await driver.pressBack();
await driver.delayMs(500);
await driver.pressBack();
await driver.delayMs(500);
Logger.info(TAG, `${BUNDLE}SmartPerfHostAPPStartup02 end`);
done();
})
/**
* Trace的使用
*/
it(BUNDLE + "Trace_001", 1, async (done: Function) => {
Logger.info(TAG, `${BUNDLE}Trace_001 begin`);
let driver: Driver = Driver.create();
await driver.delayMs(500);
// 点击进入Trace首页
let traceBtn: Component = await driver.findComponent(ON.text('Trace'));
await driver.delayMs(500);
await traceBtn.click();
await driver.delayMs(500);
// 滑动页面 循环连续向上滑动3次
for (let index = 0; index < 3; index++) {
await driver.swipe(0, 800, 0, 100, 600);
await driver.delayMs(1000);
await driver.assertComponentExist(ON.id('itemImage'));
}
// 退出到首页面
await driver.delayMs(500);
await driver.pressBack();
Logger.info(TAG, `${BUNDLE}Trace_001 end`);
done();
})
})
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 17 KiB

File diff suppressed because one or more lines are too long