From a8fd45e63c8af97998d69cc334566d505cf829dd Mon Sep 17 00:00:00 2001 From: haoxiaohui Date: Tue, 22 Apr 2025 17:04:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E5=92=8C=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: haoxiaohui --- .../src/main/ets/view/MediaFullScreen.ets | 1 - .../src/main/ets/view/XComponentVideo.ets | 4 ++-- .../src/ohosTest/ets/test/Ability.test.ets | 18 +++++++++++++++--- code/UI/MediaFullScreen/ohosTest.md | 9 +++++---- 4 files changed, 22 insertions(+), 10 deletions(-) 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 a70d4dcd52..22102182a6 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 3f34f2d1b2..9b9b8f72a7 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 b11fd02c5d..207725c710 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 3729e8eebd..63eb9d244b 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 | -- Gitee