399 lines
18 KiB
Plaintext
399 lines
18 KiB
Plaintext
/*
|
|
* Copyright (C) 2022 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 router from '@ohos.router';
|
|
|
|
|
|
@Entry
|
|
@Component
|
|
struct IndexFunctionDemo {
|
|
@State hint1: string = '启用网络模拟加载替换网络加载'
|
|
|
|
build() {
|
|
Scroll() {
|
|
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Text("OHOS基础接口测试列表").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试元能力")
|
|
.onClick(() => {
|
|
console.log("测试List列表")
|
|
router.pushUrl({ url: "pages/basicTestFeatureAbilityPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试文件")
|
|
.onClick(() => {
|
|
console.log("测试文件子系统")
|
|
router.pushUrl({ url: "pages/basicTestFileIOPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("优先级加载")
|
|
.onClick(() => {
|
|
console.log("优先级加载")
|
|
router.pushUrl({ url: "pages/testPriorityComponent" });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试全球化")
|
|
.onClick(() => {
|
|
console.log("测试全球化子系统")
|
|
router.pushUrl({ url: "pages/basicTestResourceManagerPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试媒体")
|
|
.onClick(() => {
|
|
console.log("测试媒体子系统")
|
|
router.pushUrl({ url: "pages/basicTestMediaImage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
|
|
Text("测试图片切换功能点").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
|
|
Button("测试图片切换")
|
|
.onClick(() => {
|
|
console.log("测试ImageKnifeComponent所有图片切换")
|
|
router.pushUrl({ url: "pages/testImageKnifeOptionChangedPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试图片高度自适应")
|
|
.onClick(() => {
|
|
console.log("测试ImageKnifeComponent图片高度自适应")
|
|
router.pushUrl({ url: "pages/testImageKnifeAutoHeightPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试gif播放次数")
|
|
.onClick(() => {
|
|
router.pushUrl({ url: "pages/testGifPlayTimesPage" });
|
|
}).margin({ top: 15 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
|
|
Button("测试图片宽度自适应")
|
|
.onClick(() => {
|
|
console.log("测试ImageKnifeComponent图片宽度自适应")
|
|
router.pushUrl({ url: "pages/testImageKnifeAutoWidthPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试图片宽高自适应")
|
|
.onClick(() => {
|
|
console.log("测试ImageKnifeComponent图片宽高自适应")
|
|
router.pushUrl({ url: "pages/testImageKnifeAutoPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试thumbnail")
|
|
.onClick(() => {
|
|
console.log("测试ImageKnifeComponent thumbnail")
|
|
router.pushUrl({ url: "pages/testImageKnifeOptionChangedPage2" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试RequestOption加载图片")
|
|
.onClick(() => {
|
|
console.log("测试RequestOption加载图片")
|
|
router.pushUrl({ url: "pages/RequestOptionLoadImage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text("测试缓存功能点").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试内存缓存LRU")
|
|
.onClick(() => {
|
|
console.log("测试一级内存缓存")
|
|
router.pushUrl({ url: "pages/storageTestLruCache" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试所有缓存信息输出")
|
|
.onClick(() => {
|
|
console.log("pages/testAllCacheInfoPage 页面跳转")
|
|
router.pushUrl({ url: "pages/testAllCacheInfoPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
|
|
}.width('100%')
|
|
.height(60).backgroundColor(Color.Pink)
|
|
Text("测试复用场景").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("懒加载复用列表")
|
|
.onClick(() => {
|
|
console.log("测试一级内存缓存")
|
|
router.pushUrl({ url: "pages/testReusePhotoPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%')
|
|
.height(60).backgroundColor(Color.Pink)
|
|
Text("测试占位图 失败占位图 功能点").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试失败占位图")
|
|
.onClick(() => {
|
|
console.log("测试失败占位图")
|
|
router.pushUrl({ url: "pages/showErrorholderTestCasePage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text("测试预加载 gif静态动态切换功能点").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试预加载")
|
|
.onClick(() => {
|
|
console.log("测试预加载")
|
|
router.pushUrl({ url: "pages/testPreloadPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试磁盘预加载返回string")
|
|
.onClick(() => {
|
|
console.log("测试预加载测试磁盘预加载返回string")
|
|
router.pushUrl({ url: "pages/testDiskPreLoadPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text("测试图片变换 图片压缩 功能点").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试图片变换")
|
|
.onClick(() => {
|
|
console.log("测试图片变换")
|
|
router.pushUrl({ url: "pages/transformPixelMapPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试图片压缩")
|
|
.onClick(() => {
|
|
console.log("测试图片压缩")
|
|
router.pushUrl({ url: "pages/compressPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text("测试缓存规则和重试").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("更改缓存规则")
|
|
.onClick(() => {
|
|
console.log("更改缓存规则")
|
|
router.pushUrl({ url: "pages/CacheRuleChangedPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("重试Retry")
|
|
.onClick(() => {
|
|
console.log("重试Retry")
|
|
router.pushUrl({ url: "pages/frescoRetryTestCasePage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("加载媒体库uri")
|
|
.onClick(() => {
|
|
console.log("加载媒体库uri")
|
|
router.pushUrl({ url: "pages/dataShareUriLoadPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试Option缓存是否生效")
|
|
.onClick(() => {
|
|
console.log("测试Option缓存是否生效")
|
|
router.pushUrl({ url: "pages/OptionTestPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试Signature自定义缓存")
|
|
.onClick(() => {
|
|
console.log("测试Signature自定义缓存")
|
|
router.pushUrl({ url: "pages/SignatureTestPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
|
|
Text("测试pngj和裁剪").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试pngj")
|
|
.onClick(() => {
|
|
console.log("测试pngj")
|
|
router.pushUrl({ url: "pages/pngjTestCasePage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("图片裁剪")
|
|
.onClick(() => {
|
|
console.log("图片裁剪")
|
|
router.pushUrl({ url: "pages/cropImagePage2" });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
|
|
Button("测试svg")
|
|
.onClick(() => {
|
|
console.log("pages/svgTestCasePage 页面跳转")
|
|
router.pushUrl({ url: "pages/svgTestCasePage" });
|
|
}).margin({ top: 15 })
|
|
|
|
Button("测试gif已转移,不再使用worker")
|
|
.onClick(() => {
|
|
|
|
}).margin({ top: 15 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
|
|
Button("组件显式动画")
|
|
.onClick(() => {
|
|
console.log("pages/testImageKnifeOptionChangedPage3 页面跳转")
|
|
router.pushUrl({ url: "pages/testImageKnifeOptionChangedPage3" });
|
|
}).margin({ top: 15 })
|
|
|
|
Button("组件内容动画")
|
|
.onClick(() => {
|
|
console.log("pages/testImageKnifeOptionChangedPage4 页面跳转")
|
|
router.pushUrl({ url: "pages/testImageKnifeOptionChangedPage4" });
|
|
}).margin({ top: 15 })
|
|
|
|
Button("自定义圆角椭圆")
|
|
.onClick(() => {
|
|
console.log("pages/testImageKnifeOptionChangedPage5 页面跳转")
|
|
router.pushUrl({ url: "pages/testImageKnifeOptionChangedPage5" });
|
|
}).margin({ top: 15 })
|
|
|
|
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
|
|
Button("大量照片")
|
|
.onClick(() => {
|
|
console.log("pages/manyPhotoShowPage 页面跳转")
|
|
router.pushUrl({ url: "pages/manyPhotoShowPage" });
|
|
}).margin({ top: 15 })
|
|
Button("部分url测试")
|
|
.onClick(() => {
|
|
console.log("pages/tempUrlTestPage 页面跳转")
|
|
router.pushUrl({ url: "pages/tempUrlTestPage" });
|
|
}).margin({ top: 15 })
|
|
Button("测试drawFactory")
|
|
.onClick(() => {
|
|
console.log("pages/drawFactoryTestPage 页面跳转")
|
|
router.pushUrl({ url: "pages/drawFactoryTestPage" });
|
|
}).margin({ top: 15 })
|
|
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("图片暂停和恢复")
|
|
.onClick(() => {
|
|
console.log("pages/photosPausedResumedPage 页面跳转")
|
|
router.pushUrl({ url: "pages/photosPausedResumedPage" });
|
|
}).margin({ top: 15 })
|
|
Button("List滑动暂停和恢复")
|
|
.onClick(() => {
|
|
console.log("pages/photosPausedResumedPage2 页面跳转")
|
|
router.pushUrl({ url: "pages/photosPausedResumedPage2" });
|
|
}).margin({ top: 15 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text("单帧gif测试").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("单帧gif测试")
|
|
.onClick(() => {
|
|
router.pushUrl({ url: "pages/testSingleFrameGifPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("webp测试")
|
|
.onClick(() => {
|
|
router.pushUrl({ url: "pages/webpImageTestPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text("worker测试").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("gif加载测试已转移,worker不再使用")
|
|
.onClick(() => {
|
|
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text("HSP相关测试").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
|
|
Button("进入HSP的library共享包")
|
|
.onClick(() => {
|
|
router.pushUrl({ url: '@bundle:com.openharmony.imageknife/sharedlibrary/ets/pages/Index' })
|
|
.then(() => {
|
|
console.log('push page suceess')
|
|
})
|
|
}).margin({ top: 15 })
|
|
Button("hsp加载后缓存情况,先点左侧按钮")
|
|
.onClick(() => {
|
|
console.log("pages/hspCacheTestPage 页面跳转")
|
|
router.pushUrl({ url: "pages/hspCacheTestPage" });
|
|
}).margin({ top: 15 })
|
|
Button("不同的hsp资源加载")
|
|
.onClick(() => {
|
|
console.log("pages/multiHspTestPage 页面跳转")
|
|
router.pushUrl({ url: "pages/multiHspTestPage" });
|
|
})
|
|
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text("测试图片加载稳定").fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button("测试多张网络图片加载速度")
|
|
.onClick(() => {
|
|
router.pushUrl({ url: "pages/testManyNetImageLoadWithPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("多线程加载大量网络图片加载速度")
|
|
.onClick(() => {
|
|
router.pushUrl({ url: "pages/testManyNetImageLoadWithPage2" });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button("测试多张gif加载位置")
|
|
.onClick(() => {
|
|
router.pushUrl({ url: "pages/testManyGifLoadWithPage" });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text('测试图片抗锯齿').fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button('测试图片抗锯齿')
|
|
.onClick(() => {
|
|
router.pushUrl({ url: 'pages/testImageAntiAliasingWithPage' });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button('共享转场缩放')
|
|
.onClick(() => {
|
|
router.pushUrl({ url: 'pages/testImageKnifeRouter1' });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text('测试图片header属性').fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button('图片header属性设置')
|
|
.onClick(() => {
|
|
router.pushUrl({ url: 'pages/testImageKnifeHttpRequestHeader' });
|
|
}).margin({ top: 5, left: 3 })
|
|
Button('测试自定义DataFetch属性')
|
|
.onClick(() => {
|
|
router.pushUrl({ url: 'pages/testImageKnifeDataFetch' });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text('测试图片缓存内存').fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button('测试图片缓存内存')
|
|
.onClick(() => {
|
|
router.pushUrl({ url: 'pages/testImageKnifeCache' });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
|
|
Text('测试gif暂停播放属性').fontSize(15)
|
|
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
|
Button('测试gif暂停播放属性')
|
|
.onClick(() => {
|
|
router.pushUrl({ url: 'pages/testStopPlayingGifPage' });
|
|
}).margin({ top: 5, left: 3 })
|
|
}.width('100%').height(60).backgroundColor(Color.Pink)
|
|
}
|
|
}
|
|
.width('100%')
|
|
.height('100%')
|
|
}
|
|
|
|
aboutToAppear() {
|
|
}
|
|
|
|
onBackPress() {
|
|
|
|
}
|
|
} |