From 4d559dad2ddde23bd1ec7c98f26d2d776181ccdf Mon Sep 17 00:00:00 2001 From: fulizhong Date: Fri, 17 Jun 2022 13:51:03 +0800 Subject: [PATCH] modify videoPlayer and audioPlayer testcases Signed-off-by: FULIZHONG Signed-off-by: fulizhong --- .../media_js_standard/audioPlayer/Test.json | 48 +++++++-------- .../audio/audioplayer/MainAbility.java | 35 ----------- .../audio/audioplayer/MyApplication.java | 29 --------- .../js/test/PlayerLocalTestAudioAPI.test.js | 14 +++-- .../js/test/PlayerLocalTestAudioFUNC.test.js | 13 +++- .../test/PlayerLocalTestAudioFormat.test.js | 60 ++++++++++--------- .../audio/audioplayer/MainAbility.java | 35 ----------- .../audio/audioplayer/MyApplication.java | 29 --------- .../media_js_standard/videoPlayer/Test.json | 2 +- .../test/VideoPlayerAPICallbackTest.test.js | 13 +++- .../test/VideoPlayerFuncCallbackTest.test.js | 14 ++++- .../test/VideoPlayerFuncPromiseTest.test.js | 15 +++-- 12 files changed, 110 insertions(+), 197 deletions(-) delete mode 100644 multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java delete mode 100644 multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java delete mode 100644 multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java delete mode 100644 multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java diff --git a/multimedia/media/media_js_standard/audioPlayer/Test.json b/multimedia/media/media_js_standard/audioPlayer/Test.json index 8d705ef06..3a839ac35 100644 --- a/multimedia/media/media_js_standard/audioPlayer/Test.json +++ b/multimedia/media/media_js_standard/audioPlayer/Test.json @@ -19,30 +19,30 @@ "pre-push": [ ], "push": [ - "./resource/audio/01.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/02.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/03.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/04.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/47.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/49.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/50.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/51.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/54.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/55.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/57.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/58.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/59.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/62.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/64.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/65.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/66.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/67.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/92.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/93.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/94.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/96.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/97.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/98.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/" + "./resource/audio/01.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/02.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/03.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/04.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/47.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/49.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/50.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/51.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/54.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/55.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/57.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/58.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/59.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/62.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/64.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/65.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/66.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/67.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/92.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/93.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/94.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/96.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/97.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/98.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/" ] }, { diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java b/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java deleted file mode 100644 index c3adacfc7..000000000 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ - - package ohos.acts.multimedia.audio.audioplayer; - - import ohos.ace.ability.AceAbility; - import ohos.aafwk.content.Intent; - -/* - * java MainAbility - */ - - public class MainAbility extends AceAbility { - @Override - public void onStart(Intent intent) { - super.onStart(intent); - } - - @Override - public void onStop() { - super.onStop(); - } - } diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java b/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java deleted file mode 100644 index 956bc8897..000000000 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ - - package ohos.acts.multimedia.audio.audioplayer; - - import ohos.aafwk.ability.AbilityPackage; - -/* - * java MyApplication - */ - - public class MyApplication extends AbilityPackage { - @Override - public void onInitialize() { - super.onInitialize(); - } - } diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js index 4b041dad9..588cf2fe6 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js @@ -15,13 +15,14 @@ import media from '@ohos.multimedia.media' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('PlayerLocalTestAudioAPI', function () { let audioPlayer = media.createAudioPlayer(); let loopValue = false; let isTimeOut = false; - const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/01.mp3'; + const AUDIO_SOURCE = '01.mp3'; const PLAY_TIME = 3000; const END_STATE = 0; const SRC_STATE = 1; @@ -39,11 +40,11 @@ describe('PlayerLocalTestAudioAPI', function () { const SEEK_TIME = 5000; const DELTA_TIME = 1000; const SECOND_INDEX = 1; - const TIME_OUT = 20000; const VOLUME_VALUE = 0.5; let fdPath; let fdValue; - + let context = featureAbility.getContext(); + let audioPath = ''; beforeAll(async function() { await getFd(); console.info('beforeAll case'); @@ -68,8 +69,13 @@ describe('PlayerLocalTestAudioAPI', function () { } async function getFd() { + await context.getFilesDir().then((data) => { + console.info("case file path is" + JSON.stringify(data)); + audioPath = data + '/' + AUDIO_SOURCE; + console.info("case audioPath is" + audioPath); + }); fdPath = 'fd://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(audioPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js index 13a6355f1..a17fd3800 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js @@ -15,12 +15,13 @@ import media from '@ohos.multimedia.media' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('PlayerLocalTestAudioFUNC', function () { let audioPlayer = media.createAudioPlayer(); let isTimeOut = false; - const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/01.mp3'; + const AUDIO_SOURCE = '01.mp3'; const PLAY_TIME = 3000; const DURATION_TIME = 219600; const SEEK_TIME = 5000; @@ -43,7 +44,8 @@ describe('PlayerLocalTestAudioFUNC', function () { const MAX_VOLUME = 1; let fdPath; let fdValue; - + let context = featureAbility.getContext(); + let audioPath = ''; beforeAll(async function() { await getFd(); console.info('beforeAll case'); @@ -68,8 +70,13 @@ describe('PlayerLocalTestAudioFUNC', function () { } async function getFd() { + await context.getFilesDir().then((data) => { + console.info("case file path is" + JSON.stringify(data)); + audioPath = data + '/' + AUDIO_SOURCE; + console.info("case audioPath is" + audioPath); + }); fdPath = 'fd://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(audioPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js index 7e5c44583..e86f3b57b 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js @@ -15,10 +15,10 @@ import media from '@ohos.multimedia.media' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('PlayerLocalTestAudioFormat', function () { - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/'; const MAX_VOLUME = 1; const PLAY_TIME = 3000; const SEEK_TIME = 10000; // 10s @@ -26,7 +26,7 @@ describe('PlayerLocalTestAudioFormat', function () { let isToDuration = false; let fdPath; let fdValue; - + let context = featureAbility.getContext(); beforeAll(function() { console.info('beforeAll case'); }) @@ -51,8 +51,14 @@ describe('PlayerLocalTestAudioFormat', function () { } async function getFd(pathName) { + let audioPath = ''; + await context.getFilesDir().then((data) => { + console.info("case file path is" + JSON.stringify(data)); + audioPath = data + '/' + pathName; + console.info("case audioPath is" + audioPath); + }); fdPath = 'fd://'; - await fileIO.open(pathName).then((fdNumber) => { + await fileIO.open(audioPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); @@ -151,7 +157,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0100', 0, async function (done) { - playSource(BASIC_PATH + '01.mp3', done); + playSource('01.mp3', done); }) /* * @@ -167,7 +173,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0200', 0, async function (done) { - playSource(BASIC_PATH + '02.mp3', done); + playSource('02.mp3', done); }) /* * @@ -183,7 +189,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0300', 0, async function (done) { - playSource(BASIC_PATH + '03.mp3', done); + playSource('03.mp3', done); }) /* * @@ -199,7 +205,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0400', 0, async function (done) { - playSource(BASIC_PATH + '04.mp3', done); + playSource('04.mp3', done); }) /* * @@ -215,7 +221,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0100', 0, async function (done) { - playSource(BASIC_PATH + '47.mp4', done); + playSource('47.mp4', done); }) @@ -232,7 +238,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0300', 0, async function (done) { - playSource(BASIC_PATH + '49.mp4', done); + playSource('49.mp4', done); }) /* * @@ -248,7 +254,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0400', 0, async function (done) { - playSource(BASIC_PATH + '50.mp4', done); + playSource('50.mp4', done); }) /* * @@ -264,7 +270,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0500', 0, async function (done) { - playSource(BASIC_PATH + '51.mp4', done); + playSource('51.mp4', done); }) /* * @@ -280,7 +286,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0600', 0, async function (done) { - playSource(BASIC_PATH + '54.mp4', done); + playSource('54.mp4', done); }) /* * @@ -296,7 +302,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0700', 0, async function (done) { - playSource(BASIC_PATH + '64.mp4', done); + playSource('64.mp4', done); }) /* * @@ -312,7 +318,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0800', 0, async function (done) { - playSource(BASIC_PATH + '65.mp4', done); + playSource('65.mp4', done); }) /* * @@ -328,7 +334,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0900', 0, async function (done) { - playSource(BASIC_PATH + '66.mp4', done); + playSource('66.mp4', done); }) /* * @@ -344,7 +350,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1000', 0, async function (done) { - playSource(BASIC_PATH + '67.mp4', done); + playSource('67.mp4', done); }) /* * @@ -360,7 +366,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1100', 0, async function (done) { - playSource(BASIC_PATH + '92.mp4', done); + playSource('92.mp4', done); }) /* * @@ -376,7 +382,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1200', 0, async function (done) { - playSource(BASIC_PATH + '93.mp4', done); + playSource('93.mp4', done); }) /* * @@ -392,7 +398,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1300', 0, async function (done) { - playSource(BASIC_PATH + '94.mp4', done); + playSource('94.mp4', done); }) /* * @@ -408,7 +414,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1400', 0, async function (done) { - playSource(BASIC_PATH + '96.mp4', done); + playSource('96.mp4', done); }) /* * @@ -424,7 +430,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1500', 0, async function (done) { - playSource(BASIC_PATH + '97.mp4', done); + playSource('97.mp4', done); }) /* * @@ -440,7 +446,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1600', 0, async function (done) { - playSource(BASIC_PATH + '98.mp4', done); + playSource('98.mp4', done); }) /* * @@ -456,7 +462,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0100', 0, async function (done) { - playSource(BASIC_PATH + '55.m4a', done); + playSource('55.m4a', done); }) @@ -473,7 +479,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0300', 0, async function (done) { - playSource(BASIC_PATH + '57.m4a', done); + playSource('57.m4a', done); }) /* * @@ -489,7 +495,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0400', 0, async function (done) { - playSource(BASIC_PATH + '58.m4a', done); + playSource('58.m4a', done); }) /* * @@ -505,7 +511,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0500', 0, async function (done) { - playSource(BASIC_PATH + '59.m4a', done); + playSource('59.m4a', done); }) /* * @@ -521,6 +527,6 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0700', 0, async function (done) { - playSource(BASIC_PATH + '62.m4a', done); + playSource('62.m4a', done); }) }) diff --git a/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java b/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java deleted file mode 100644 index c3adacfc7..000000000 --- a/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ - - package ohos.acts.multimedia.audio.audioplayer; - - import ohos.ace.ability.AceAbility; - import ohos.aafwk.content.Intent; - -/* - * java MainAbility - */ - - public class MainAbility extends AceAbility { - @Override - public void onStart(Intent intent) { - super.onStart(intent); - } - - @Override - public void onStop() { - super.onStop(); - } - } diff --git a/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java b/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java deleted file mode 100644 index 956bc8897..000000000 --- a/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ - - package ohos.acts.multimedia.audio.audioplayer; - - import ohos.aafwk.ability.AbilityPackage; - -/* - * java MyApplication - */ - - public class MyApplication extends AbilityPackage { - @Override - public void onInitialize() { - super.onInitialize(); - } - } diff --git a/multimedia/media/media_js_standard/videoPlayer/Test.json b/multimedia/media/media_js_standard/videoPlayer/Test.json index 97db72d66..21ba0fb2f 100644 --- a/multimedia/media/media_js_standard/videoPlayer/Test.json +++ b/multimedia/media/media_js_standard/videoPlayer/Test.json @@ -19,7 +19,7 @@ "pre-push": [ ], "push": [ - "./resource/audio/H264_AAC.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/" + "./resource/audio/H264_AAC.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files/" ] }, { diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js index e47312f36..3ede8e0ea 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js @@ -16,13 +16,13 @@ import media from '@ohos.multimedia.media' import router from '@system.router' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('VideoPlayerAPICallbackTest', function () { - const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4'; + const VIDEO_SOURCE = 'H264_AAC.mp4'; const PLAY_TIME = 1000; const SEEK_TIME = 5000; - const SEEK_CLOSEST = 3; const WIDTH_VALUE = 720; const HEIGHT_VALUE = 480; const DURATION_TIME = 10034; @@ -51,6 +51,8 @@ describe('VideoPlayerAPICallbackTest', function () { let temp = 0; let events = require('events'); let eventEmitter = new events.EventEmitter(); + let context = featureAbility.getContext(); + let videoPath = ''; beforeAll(function() { console.info('beforeAll case'); @@ -90,8 +92,13 @@ describe('VideoPlayerAPICallbackTest', function () { } async function getFd() { + await context.getFilesDir().then((data) => { + console.info("case file path is" + JSON.stringify(data)); + videoPath = data + '/' + VIDEO_SOURCE; + console.info("case audioPath is" + videoPath); + }); fdPath = 'fd://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(videoPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js index 68a686010..84def3464 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js @@ -16,10 +16,11 @@ import media from '@ohos.multimedia.media' import router from '@system.router' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('VideoPlayerFuncCallbackTest', function () { - const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4'; + const VIDEO_SOURCE = 'H264_AAC.mp4'; const PLAY_TIME = 3000; const SEEK_TIME = 5000; const WIDTH_VALUE = 720; @@ -51,6 +52,8 @@ describe('VideoPlayerFuncCallbackTest', function () { let temp = 0; let events = require('events'); let eventEmitter = new events.EventEmitter(); + let context = featureAbility.getContext(); + let videoPath = ''; beforeAll(function() { console.info('beforeAll case'); @@ -99,7 +102,7 @@ describe('VideoPlayerFuncCallbackTest', function () { path = 'pages/surfaceTest/surfaceTest'; temp = 1; } else { - path = 'pages/surfaceTest/surfaceTest2'; + path = 'pages/surfaceTest2/surfaceTest2'; temp = 0; } let options = { @@ -113,8 +116,13 @@ describe('VideoPlayerFuncCallbackTest', function () { } async function getFd() { + await context.getFilesDir().then((data) => { + console.info("case file path is" + JSON.stringify(data)); + videoPath = data + '/' + VIDEO_SOURCE; + console.info("case audioPath is" + videoPath); + }); fdPath = 'fd://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(videoPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js index 8c031160b..b58b09c44 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js @@ -16,13 +16,13 @@ import media from '@ohos.multimedia.media' import router from '@system.router' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('VideoPlayerFuncPromiseTest', function () { - const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4'; + const VIDEO_SOURCE = 'H264_AAC.mp4'; const PLAY_TIME = 3000; const SEEK_TIME = 5000; - const SEEK_CLOSEST = 3; const WIDTH_VALUE = 720; const HEIGHT_VALUE = 480; const DURATION_TIME = 10034; @@ -33,6 +33,8 @@ describe('VideoPlayerFuncPromiseTest', function () { let fdPath; let fdValue; let temp = 0; + let context = featureAbility.getContext(); + let videoPath = ''; beforeAll(function() { console.info('beforeAll case'); }) @@ -80,7 +82,7 @@ describe('VideoPlayerFuncPromiseTest', function () { path = 'pages/surfaceTest/surfaceTest'; temp = 1; } else { - path = 'pages/surfaceTest/surfaceTest2'; + path = 'pages/surfaceTest2/surfaceTest2'; temp = 0; } let options = { @@ -94,8 +96,13 @@ describe('VideoPlayerFuncPromiseTest', function () { } async function getFd() { + await context.getFilesDir().then((data) => { + console.info("case file path is" + JSON.stringify(data)); + videoPath = data + '/' + VIDEO_SOURCE; + console.info("case audioPath is" + videoPath); + }); fdPath = 'fd://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(videoPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); -- GitLab