添加单帧gif加载闪退测试界面

Signed-off-by: 李艺为 <liyiwei18@h-partners.com>
This commit is contained in:
李艺为 2023-08-17 10:48:49 +08:00
parent 0ecd3db6ac
commit 6267a61694
4 changed files with 61 additions and 1 deletions

View File

@ -216,6 +216,14 @@ struct IndexFunctionDemo {
}).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 })
}.width('100%').height(60).backgroundColor(Color.Pink)
}
}
.width('100%')

View File

@ -0,0 +1,51 @@
import { ImageKnifeComponent } from '@ohos/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent'
import { ImageKnifeOption } from '@ohos/imageknife/src/main/ets/components/imageknife/ImageKnifeOption'
@Entry
@Component
struct TestSingleFrameGifPage {
@State message: string = '单帧gif测试'
@State options: ImageKnifeOption = {
loadSrc: $r('app.media.app_icon')
}
build() {
Column() {
Column() {
Text(`${this.message}`)
.width("300vp")
.height("60vp")
.textAlign(TextAlign.Center)
.fontSize("50fp")
.fontWeight(FontWeight.Bold)
Button("加载单帧gif")
.margin(16)
.onClick(() => {
console.log("liyiwei 加载单帧gif")
this.options = {
loadSrc: $r('app.media.gifSample_single_frame'),
placeholderSrc:$r('app.media.icon_loading')
}
})
Button("加载多帧gif")
.margin(16)
.onClick(() => {
console.log("liyiwei 加载多帧gif")
this.options = {
loadSrc: $r('app.media.gifSample'),
placeholderSrc:$r('app.media.icon_loading')
}
})
ImageKnifeComponent({ imageKnifeOption: this.options })
.margin(16)
.width(300)
.height(300)
}
.width("100%")
.height("100%")
.justifyContent(FlexAlign.Center)
}
.width("100%")
.height("100%")
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -27,6 +27,7 @@
"pages/dataShareUriLoadPage",
"pages/manyPhotoShowPage",
"pages/tempUrlTestPage",
"pages/drawFactoryTestPage"
"pages/drawFactoryTestPage",
"pages/testSingleFrameGifPage"
]
}