diff --git a/code/UI/MediaFullScreen/entry/src/main/ets/view/MediaFullScreen.ets b/code/UI/MediaFullScreen/entry/src/main/ets/view/MediaFullScreen.ets index a70d4dcd528e0d1f6303ea084559925385ca7f0f..22102182a6f47f2e196140172245a569fee93b30 100644 --- a/code/UI/MediaFullScreen/entry/src/main/ets/view/MediaFullScreen.ets +++ b/code/UI/MediaFullScreen/entry/src/main/ets/view/MediaFullScreen.ets @@ -132,7 +132,6 @@ export struct MediaFullScreenComponent { .height($r('app.string.media_full_screen_layout_100')) .layoutWeight(LAYOUT_WEIGHT) .clip(true) - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) } .hideTitleBar(true) // TODO:知识点:返回时进行判断,如果在非全屏状态则返回首页,否则仅退出全屏 diff --git a/code/UI/MediaFullScreen/entry/src/main/ets/view/XComponentVideo.ets b/code/UI/MediaFullScreen/entry/src/main/ets/view/XComponentVideo.ets index 3f34f2d1b21fb5ee9239da58fe916759f5fa36b4..9b9b8f72a78a660d3c8f80564f4c23b517dc5ef2 100644 --- a/code/UI/MediaFullScreen/entry/src/main/ets/view/XComponentVideo.ets +++ b/code/UI/MediaFullScreen/entry/src/main/ets/view/XComponentVideo.ets @@ -266,7 +266,7 @@ export struct XVideoComponent { animateTo({ duration: ANIMATE_DURATION, onFinish: () => { - this.isLandscape = !this.isLandscape; // 设置横屏 + } }, () => { this.isFullScreen = !this.isFullScreen; @@ -412,7 +412,7 @@ export struct XVideoComponent { // 播放icon Image(this.isPlaying ? $r('app.media.media_full_screen_icon_play') : $r('app.media.media_full_screen_icon_pause')) - .id(this.isPlaying ? 'playingIcon' : 'pauseIcon') + .id('playingIcon') .width($r('app.integer.media_full_screen_video_icon_play_width')) .height($r('app.integer.media_full_screen_video_icon_play_height')) .margin({ diff --git a/code/UI/MediaFullScreen/entry/src/ohosTest/ets/test/Ability.test.ets b/code/UI/MediaFullScreen/entry/src/ohosTest/ets/test/Ability.test.ets index b11fd02c5dfde7a9a4d5be4e698473501953cc99..207725c7105c76fac04052de227d2dc582fc879f 100644 --- a/code/UI/MediaFullScreen/entry/src/ohosTest/ets/test/Ability.test.ets +++ b/code/UI/MediaFullScreen/entry/src/ohosTest/ets/test/Ability.test.ets @@ -46,7 +46,7 @@ export default function abilityTest() { const driver: Driver = Driver.create(); /** - * 点击图片打开视频。 + * 点击图片打开视频,视频正常播放,窗口为竖屏状态。 */ it('TestOpenVideo', 0, async (done: Function) => { await driver.assertComponentExist(ON.id('mediaPic1')); @@ -58,10 +58,22 @@ export default function abilityTest() { }) /** - * 视频正常播放,窗口为横屏状态。 + * 视频切换全屏播放 */ it('TestChangeToHorizontal', 0, async (done: Function) => { - await driver.assertComponentExist(ON.id('playingIcon')); + await driver.assertComponentExist(ON.id('collapseVideoButton')); + let videoPic = await driver.findComponent(ON.id('collapseVideoButton')); + await videoPic.click(); + await driver.delayMs(5000); + await driver.assertComponentExist(ON.text('media_full_screen_video', MatchPattern.CONTAINS)); + done(); + }) + + /** + * 视频正常播放,窗口为横屏状态。 + */ + it('TestPlayHorizontal', 0, async (done: Function) => { + await driver.assertComponentExist(ON.id('playingIcon')||ON.id('pauseIcon')); let rotation = await driver.getDisplayRotation(); expect(rotation === DisplayRotation.ROTATION_90 || rotation === DisplayRotation.ROTATION_270).assertTrue(); done(); diff --git a/code/UI/MediaFullScreen/ohosTest.md b/code/UI/MediaFullScreen/ohosTest.md index 3729e8eebd3d1a439486244c40aaaed9904fab4e..63eb9d244be0e78dbc77c3accb4794b4379ec7fd 100644 --- a/code/UI/MediaFullScreen/ohosTest.md +++ b/code/UI/MediaFullScreen/ohosTest.md @@ -2,7 +2,8 @@ ### 用例表 -| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动化 | 测试结果 | -|:----------------:|:----------:|:------:|:------------:|:-----:|:----:| -| 点击图片打开视频。 | 启动视频全屏切换案例 | 点击图片 | 视频正常播放,窗口为横屏状态。 | Yes | Pass | -| 视频正常缩小,窗口恢复原本状态。 | 启动视频全屏切换案例 | 点击缩小按钮 | 视频正常缩小,窗口恢复原本状态。 | YES | Pass | +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动化 | 测试结果 | +|:----------------:|:----------:|:------:|:---------------:|:-----:|:----:| +| 点击图片打开视频。 | 启动视频全屏切换案例 | 点击图片 | 视频正常播放,窗口为竖屏状态。 | Yes | Pass | +| 视频切换全屏播放 | 视频处于竖屏播放状态 | 点击全屏按钮 | 视频切换为全屏横屏播放 | Yes | Pass | +| 视频正常缩小,窗口恢复原本状态。 | 启动视频全屏切换案例 | 点击缩小按钮 | 回到视频首页 | YES | Pass |