diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index d49aa9efe3573fd622fb02bc1ecf425e76b4515c..a8fd227ea89239d2dc88bb277188915d5f779adb 100755 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -20,8 +20,7 @@ group("multimedia") { "audio/audio_js_standard/audioManager:audio_manager_js_hap", "audio/audio_js_standard/audioPlayer:audio_player_js_hap", "audio/audio_js_standard/audioPlayer_API:audio_player_api_js_hap", - - #"audio/audio_js_standard/audioRecorder:audio_recorder_js_hap", + "audio/audio_js_standard/audioRecorder:audio_recorder_js_hap", "media/media_cpp_test_standard:ActsMediaCppStandardTest", ] } else { diff --git a/multimedia/audio/audio_js_standard/audioManager/Test.json b/multimedia/audio/audio_js_standard/audioManager/Test.json index c8139f0233bae1519fdc9aad32a0a51d34897d6f..f1ff31d4c906241d97fb71a7aa7adc530131bbed 100755 --- a/multimedia/audio/audio_js_standard/audioManager/Test.json +++ b/multimedia/audio/audio_js_standard/audioManager/Test.json @@ -3,7 +3,7 @@ "driver": { "type": "JSUnitTest", "test-timeout": "4800000", - "package": "ohos.acts.multimedia.audio.function", + "package": "ohos.acts.multimedia.audio.audiomanager", "shell-timeout": "60000" }, "kits": [ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/config.json b/multimedia/audio/audio_js_standard/audioManager/src/main/config.json index 31b9a1b5a0f828e620d2db6f973f3f8266a176dd..3d16947ca50a1a2346090ee2a5a7c309f30bb72f 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/config.json +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/config.json @@ -1,31 +1,31 @@ { "app": { - "bundleName": "ohos.acts.multimedia.audio.function", + "bundleName": "ohos.acts.multimedia.audio.audiomanager", "vendor": "acts", "version": { "code": 1000000, "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 } }, "deviceConfig": {}, "module": { - "package": "ohos.acts.multimedia.audio.function", + "package": "ohos.acts.multimedia.audio.audiomanager", "name": ".MyApplication", + "mainAbility": "ohos.acts.multimedia.audio.audiomanager.MainAbility", "deviceType": [ - "phone" + "phone", + "tablet", + "tv", + "wearable" ], "distro": { "deliveryWithInstall": true, "moduleName": "entry", - "moduleType": "entry" + "moduleType": "entry", + "installationFree": false }, "abilities": [ { - "visible": true, "skills": [ { "entities": [ @@ -36,10 +36,11 @@ ] } ], - "name": "ohos.acts.multimedia.audio.function.MainAbility", + "visible": true, + "name": "ohos.acts.multimedia.audio.audiomanager.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", - "label": "$string:app_name", + "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" } @@ -52,9 +53,9 @@ "name": "default", "window": { "designWidth": 720, - "autoDesignWidth": false + "autoDesignWidth": true } } ] } -} +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/java/ohos/acts/multimedia/audio/audiomanager/MainAbility.java b/multimedia/audio/audio_js_standard/audioManager/src/main/java/ohos/acts/multimedia/audio/audiomanager/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..102b559f642157f12b1e59213c380090106d9c4f --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/java/ohos/acts/multimedia/audio/audiomanager/MainAbility.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2021 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.audiomanager; + +import ohos.ace.ability.AceAbility; +import ohos.aafwk.content.Intent; + +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/java/ohos/acts/multimedia/audio/audiomanager/MyApplication.java b/multimedia/audio/audio_js_standard/audioManager/src/main/java/ohos/acts/multimedia/audio/audiomanager/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..fc3cb5fd8c99c31c9aa2d89f77b22bdc64c0deb0 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/java/ohos/acts/multimedia/audio/audiomanager/MyApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 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.audiomanager; + +import ohos.aafwk.ability.AbilityPackage; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/app.js index e0b2e05a461ecda7b070d1bb20829b7bde8d5a8a..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/app.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/app.js @@ -13,8 +13,6 @@ * limitations under the License. */ -import device from '@system.device'; - export default { onCreate() { console.info('AceApplication onCreate'); diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/common/images/Wallpaper.png b/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/common/images/Wallpaper.png differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/pages/index/index.css index 6fda792753f2e15f22b529c7b90a82185b2770bf..5bd7567028568bd522193b2519d545ca6dcf397d 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/pages/index/index.css +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/pages/index/index.css @@ -2,8 +2,45 @@ flex-direction: column; justify-content: center; align-items: center; + width: 100%; + height: 100%; } .title { - font-size: 100px; + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("/common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } } diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/pages/index/index.js index 770b1218eb08c0c46fed349f0f5baff40c02f215..20a3cea29d30ad0acb89e4ccc9eece9a3652cbbc 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/pages/index/index.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/pages/index/index.js @@ -13,11 +13,11 @@ * limitations under the License. */ +import file from '@system.file' import app from '@system.app' -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' export default { data: { @@ -32,12 +32,23 @@ export default { const expectExtend = new ExpectExtend({ 'id': 'extend' }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + const configService = core.getDefaultService('config') configService.setConfig(this) - require('../../test/List.test') + require('../../../test/List.test') core.execute() }, onReady() { diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/test/AudioFramework.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js old mode 100755 new mode 100644 similarity index 100% rename from multimedia/audio/audio_js_standard/audioManager/src/main/js/default/test/AudioFramework.test.js rename to multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/test/AudioPerf.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioPerf.test.js similarity index 100% rename from multimedia/audio/audio_js_standard/audioManager/src/main/js/default/test/AudioPerf.test.js rename to multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioPerf.test.js diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/test/List.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js old mode 100755 new mode 100644 similarity index 95% rename from multimedia/audio/audio_js_standard/audioManager/src/main/js/default/test/List.test.js rename to multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js index d4f7d85701a1316c112cb3e85a2f5b012dfcaf65..0c0e87f6717c66799acb50dd96416b6a92978ce7 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/default/test/List.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + // require('./AudioPerf.test.js') require('./AudioFramework.test.js') //require('./AudioFramework.test-Gitee.js') diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/base/element/string.json index 2f9470d82c49675a64972657d8d367cd95e51c63..0bae6bd40f7360d5d818998221b199d3ec0f69c0 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/base/element/string.json +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ { "string": [ { - "name": "app_name", - "value": "MyApplication" + "name": "entry_MainAbility", + "value": "entry_MainAbility" }, { "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" + "value": "JS_Empty Ability" } ] } \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioPlayer/Test.json b/multimedia/audio/audio_js_standard/audioPlayer/Test.json index 577cc5a0c852f84f7f435b204432158aefd5a8a9..0515922b4002ab109e3a8d7f3d7945b6aa5f3af6 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer/Test.json +++ b/multimedia/audio/audio_js_standard/audioPlayer/Test.json @@ -1,15 +1,56 @@ { - "description": "Configuration for audio manager Tests", + "description": "Configuration for audioPlayer Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.multimedia.audio.function", + "test-timeout": "3000000", + "package": "ohos.acts.multimedia.audio.audioplayer", "shell-timeout": "60000" }, "kits": [ + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "resource/audio/01.mP3 ->/data/media/", + "resource/audio/02.mp3 ->/data/media/", + "resource/audio/03.mp3 ->/data/media/", + "resource/audio/04.mp3 ->/data/media/", + "resource/audio/47.mp4 ->/data/media/", + "resource/audio/49.mp4 ->/data/media/", + "resource/audio/50.mp4 ->/data/media/", + "resource/audio/51.mp4 ->/data/media/", + "resource/audio/54.mp4 ->/data/media/", + "resource/audio/55.m4a ->/data/media/", + "resource/audio/57.m4a ->/data/media/", + "resource/audio/58.m4a ->/data/media/", + "resource/audio/59.m4a ->/data/media/", + "resource/audio/62.m4a ->/data/media/", + "resource/audio/64.mp4 ->/data/media/", + "resource/audio/65.mp4 ->/data/media/", + "resource/audio/66.mp4 ->/data/media/", + "resource/audio/67.mp4 ->/data/media/", + "resource/audio/92.mp4 ->/data/media/", + "resource/audio/93.mp4 ->/data/media/", + "resource/audio/94.mp4 ->/data/media/", + "resource/audio/96.mp4 ->/data/media/", + "resource/audio/97.mp4 ->/data/media/", + "resource/audio/98.mp4 ->/data/media/" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod -R 666 /data/media/*", + "setenforce 0" + ], + "teardown-command":[ + "setenforce 1" + ] + }, { "test-file-name": [ - "AudioPlayerJsTest.hap" + "AudioPlayerApiJsTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/config.json b/multimedia/audio/audio_js_standard/audioPlayer/src/main/config.json index 31b9a1b5a0f828e620d2db6f973f3f8266a176dd..4652b6e7d6fa515efccc669d0f22b0a2322ebd0e 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer/src/main/config.json +++ b/multimedia/audio/audio_js_standard/audioPlayer/src/main/config.json @@ -1,31 +1,31 @@ { "app": { - "bundleName": "ohos.acts.multimedia.audio.function", + "bundleName": "ohos.acts.multimedia.audio.audioplayer", "vendor": "acts", "version": { "code": 1000000, "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 } }, "deviceConfig": {}, "module": { - "package": "ohos.acts.multimedia.audio.function", + "package": "ohos.acts.multimedia.audio.audioplayer", "name": ".MyApplication", + "mainAbility": "ohos.acts.multimedia.audio.audioplayer.MainAbility", "deviceType": [ - "phone" + "phone", + "tablet", + "tv", + "wearable" ], "distro": { "deliveryWithInstall": true, "moduleName": "entry", - "moduleType": "entry" + "moduleType": "entry", + "installationFree": false }, "abilities": [ { - "visible": true, "skills": [ { "entities": [ @@ -36,10 +36,11 @@ ] } ], - "name": "ohos.acts.multimedia.audio.function.MainAbility", + "visible": true, + "name": "ohos.acts.multimedia.audio.audioplayer.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", - "label": "$string:app_name", + "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" } @@ -52,9 +53,9 @@ "name": "default", "window": { "designWidth": 720, - "autoDesignWidth": false + "autoDesignWidth": true } } ] } -} +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java b/multimedia/audio/audio_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..2a6dbe56e291aee32572b8d69e3181721cf874ef --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2021 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; + +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java b/multimedia/audio/audio_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..5e33ccf8bc679a26327d534ba19c08a6e8622e54 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 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; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/app.js index e0b2e05a461ecda7b070d1bb20829b7bde8d5a8a..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/app.js +++ b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/app.js @@ -13,8 +13,6 @@ * limitations under the License. */ -import device from '@system.device'; - export default { onCreate() { console.info('AceApplication onCreate'); diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/common/images/Wallpaper.png b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/common/images/Wallpaper.png differ diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/pages/index/index.css index 6fda792753f2e15f22b529c7b90a82185b2770bf..5bd7567028568bd522193b2519d545ca6dcf397d 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/pages/index/index.css +++ b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/pages/index/index.css @@ -2,8 +2,45 @@ flex-direction: column; justify-content: center; align-items: center; + width: 100%; + height: 100%; } .title { - font-size: 100px; + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("/common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } } diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/pages/index/index.js index 770b1218eb08c0c46fed349f0f5baff40c02f215..20a3cea29d30ad0acb89e4ccc9eece9a3652cbbc 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/pages/index/index.js +++ b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/pages/index/index.js @@ -13,11 +13,11 @@ * limitations under the License. */ +import file from '@system.file' import app from '@system.app' -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' export default { data: { @@ -32,12 +32,23 @@ export default { const expectExtend = new ExpectExtend({ 'id': 'extend' }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + const configService = core.getDefaultService('config') configService.setConfig(this) - require('../../test/List.test') + require('../../../test/List.test') core.execute() }, onReady() { diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/List.test.js b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/test/List.test.js old mode 100755 new mode 100644 similarity index 100% rename from multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/List.test.js rename to multimedia/audio/audio_js_standard/audioPlayer/src/main/js/test/List.test.js diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFUNC.test.js b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js old mode 100755 new mode 100644 similarity index 99% rename from multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFUNC.test.js rename to multimedia/audio/audio_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js index 880dd6d7b5100b77963d2ac1e6ba3248bd1dc2d8..a99a2e109cff8e9fbff679f09156cb18f2ea5a79 --- a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFUNC.test.js +++ b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js @@ -19,9 +19,9 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' describe('PlayerLocalTestAudioFUNC', function () { let audioPlayer = media.createAudioPlayer(); let isTimeOut = false; - const AUDIO_SOURCE = 'file://data/media/audio/01.mp3'; + const AUDIO_SOURCE = 'file://data/media/01.mp3'; const PLAY_TIME = 3000; - const DURATION_TIME = 99432; + const DURATION_TIME = 219600; const SEEK_TIME = 5000; const DELTA_TIME = 1000; const END_STATE = 0; diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFormat.test.js b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js similarity index 88% rename from multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFormat.test.js rename to multimedia/audio/audio_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js index bb50e1966399aeae343be621a5ba0bc2b0411ab3..4dec6b3a5d06f92897e4ed3dc1ba13d04a218895 100644 --- a/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFormat.test.js +++ b/multimedia/audio/audio_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js @@ -1,595 +1,549 @@ -/* - * Copyright (C) 2021 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 media from '@ohos.multimedia.media' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('PlayerLocalTestAudioFormat', function () { - const BASIC_PATH = 'file:///data/media/audio/'; - const MAX_VOLUME = 1; - const PLAY_TIME = 3000; - const SEEK_TIME = 10000; // 10s - let isToSeek = false; - let isToDuration = false; - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - isToSeek = false; - isToDuration = false; - console.info('beforeEach case'); - }) - - afterEach(function() { - console.info('afterEach case'); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - function sleep(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - function setSrcCallback(audioPlayer) { - audioPlayer.on('dataLoad', () => { - console.info('case set source success'); - expect(audioPlayer.state).assertEqual('paused'); - expect(audioPlayer.currentTime).assertEqual(0); - audioPlayer.play(); - }); - } - - function setPlayCallback(audioPlayer) { - audioPlayer.on('play', () => { - console.info('case start to play'); - expect(audioPlayer.state).assertEqual('playing'); - sleep(PLAY_TIME); - if (!isToSeek) { - audioPlayer.pause(); - } else { - audioPlayer.seek(SEEK_TIME); - } - }); - } - - function setPauseCallback(audioPlayer) { - audioPlayer.on('pause', () => { - console.info('case now is paused'); - expect(audioPlayer.state).assertEqual('paused'); - audioPlayer.setVolume(MAX_VOLUME); - }); - } - - function setResetCallback(audioPlayer, done) { - audioPlayer.on('reset', () => { - console.info('case reset success'); - expect(audioPlayer.state).assertEqual('idle'); - audioPlayer.release(); - audioPlayer = undefined; - done(); - }); - } - - function setStopCallback(audioPlayer) { - audioPlayer.on('stop', () => { - console.info('case stop success'); - expect(audioPlayer.state).assertEqual('stopped'); - audioPlayer.reset(); - }); - } - - function setSeekCallback(audioPlayer, done) { - audioPlayer.on('timeUpdate', (seekDoneTime) => { - if (typeof (seekDoneTime) == "undefined") { - console.info(`case seek filed,errcode is ${seekDoneTime}`); - audioPlayer.release(); - expect().assertFail(); - done(); - return; - } - console.info('case seek success, and seek time is ' + seekDoneTime); - if (!isToDuration) { - expect(SEEK_TIME).assertEqual(seekDoneTime); - isToDuration = true; - sleep(PLAY_TIME); - audioPlayer.seek(audioPlayer.duration); - } else { - expect(audioPlayer.duration).assertEqual(seekDoneTime); - } - }); - } - - function setVolumeCallback(audioPlayer) { - audioPlayer.on('volumeChange', () => { - console.info('case set volume value to ' + MAX_VOLUME); - audioPlayer.play(); - isToSeek = true; - }); - } - - function setFinishCallback(audioPlayer) { - audioPlayer.on('finish', () => { - console.info('case play end'); - expect(audioPlayer.state).assertEqual('stopped'); - audioPlayer.stop(); - }); - } - - function setErrorCallback(audioPlayer, done) { - audioPlayer.on('error', (err) => { - console.info(`case error called,errName is ${err.name}`); - console.info(`case error called,errCode is ${err.code}`); - console.info(`case error called,errMessage is ${err.message}`); - audioPlayer.release(); - expect().assertFail(); - done(); - }); - } - - function playSource(audioSource, done) { - let audioPlayer = media.createAudioPlayer(); - if (typeof (audioPlayer) == 'undefined') { - console.info('case create player is faild'); - expect().assertFail(); - done(); - return; - } - setSrcCallback(audioPlayer); - setPlayCallback(audioPlayer); - setPauseCallback(audioPlayer); - setResetCallback(audioPlayer, done); - setStopCallback(audioPlayer); - setSeekCallback(audioPlayer, done); - setVolumeCallback(audioPlayer); - setFinishCallback(audioPlayer); - setErrorCallback(audioPlayer, done); - audioPlayer.src = audioSource; - } - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0100 - * @tc.name : 001.Playing mp3 streams - * @tc.desc : Format : MP3 - Codec : MP3 - Samplerate : 48000 - Bitrate : 32 - Channel : 1 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0100', 0, async function (done) { - playSource(BASIC_PATH + '01.mp3', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0200 - * @tc.name : 002.Playing mp3 streams - * @tc.desc : Format : MP3 - Codec : MP3 - Samplerate : 48000 - Bitrate : 16/32 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0200', 0, async function (done) { - playSource(BASIC_PATH + '02.mp3', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0300 - * @tc.name : 003.Playing mp3 streams - * @tc.desc : Format : MP3 - Codec : MP3 - Samplerate : 48000 - Bitrate : 32 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0300', 0, async function (done) { - playSource(BASIC_PATH + '03.mp3', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0400 - * @tc.name : 004.Playing mp3 streams - * @tc.desc : Format : MP3 - Codec : MP3 - Samplerate : 48000 - Bitrate : 64 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0400', 0, async function (done) { - playSource(BASIC_PATH + '04.mp3', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0100 - * @tc.name : 001.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : AAC LC - Samplerate : 48000 - Bitrate : 32 - Channel : 1 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0100', 0, async function (done) { - playSource(BASIC_PATH + '47.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0200 - * @tc.name : 002.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : AAC LC - Samplerate : 48000 - Bitrate : 16 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0200', 0, async function (done) { - playSource(BASIC_PATH + '48.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0300 - * @tc.name : 003.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : AAC LC - Samplerate : 48000 - Bitrate : 64 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0300', 0, async function (done) { - playSource(BASIC_PATH + '49.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0400 - * @tc.name : 004.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : AAC LC - Samplerate : 48000 - Bitrate : 32 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0400', 0, async function (done) { - playSource(BASIC_PATH + '50.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0500 - * @tc.name : 005.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : AAC LC - Samplerate : 96000 - Bitrate : 32 - Channel : 1 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0500', 0, async function (done) { - playSource(BASIC_PATH + '51.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0600 - * @tc.name : 006.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : AAC LC - Samplerate : 96000 - Bitrate : 64 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0600', 0, async function (done) { - playSource(BASIC_PATH + '54.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0700 - * @tc.name : 007.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : MP3 - Samplerate : 48000 - Bitrate : 32 - Channel : 1 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0700', 0, async function (done) { - playSource(BASIC_PATH + '64.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0800 - * @tc.name : 008.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : MP3 - Samplerate : 48000 - Bitrate : 16 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0800', 0, async function (done) { - playSource(BASIC_PATH + '65.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0900 - * @tc.name : 009.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : MP3 - Samplerate : 48000 - Bitrate : 64 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0900', 0, async function (done) { - playSource(BASIC_PATH + '66.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1000 - * @tc.name : 010.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : MP3 - Samplerate : 48000 - Bitrate : 32 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1000', 0, async function (done) { - playSource(BASIC_PATH + '67.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1100 - * @tc.name : 011.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : Vorbis - Samplerate : 48000 - Bitrate : 16 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1100', 0, async function (done) { - playSource(BASIC_PATH + '92.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1200 - * @tc.name : 012.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : Vorbis - Samplerate : 48000 - Bitrate : 64 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1200', 0, async function (done) { - playSource(BASIC_PATH + '93.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1300 - * @tc.name : 013.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : Vorbis - Samplerate : 48000 - Bitrate : 32 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1300', 0, async function (done) { - playSource(BASIC_PATH + '94.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1400 - * @tc.name : 014.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : Vorbis - Samplerate : 96000 - Bitrate : 16 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1400', 0, async function (done) { - playSource(BASIC_PATH + '96.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1500 - * @tc.name : 015.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : Vorbis - Samplerate : 96000 - Bitrate : 32 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1500', 0, async function (done) { - playSource(BASIC_PATH + '97.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1600 - * @tc.name : 016.Playing mp4 streams - * @tc.desc : Format : MP4 - Codec : Vorbis - Samplerate : 96000 - Bitrate : 64 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1600', 0, async function (done) { - playSource(BASIC_PATH + '98.mp4', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0100 - * @tc.name : 001.Playing m4a streams - * @tc.desc : Format : M4A - Codec : AAC LC - Samplerate : 48000 - Bitrate : 32 - Channel : 1 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0100', 0, async function (done) { - playSource(BASIC_PATH + '55.m4a', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0200 - * @tc.name : 002.Playing m4a streams - * @tc.desc : Format : M4A - Codec : AAC LC - Samplerate : 48000 - Bitrate : 16 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0200', 0, async function (done) { - playSource(BASIC_PATH + '56.m4a', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0300 - * @tc.name : 003.Playing m4a streams - * @tc.desc : Format : M4A - Codec : AAC LC - Samplerate : 48000 - Bitrate : 64 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0300', 0, async function (done) { - playSource(BASIC_PATH + '57.m4a', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0400 - * @tc.name : 004.Playing m4a streams - * @tc.desc : Format : M4A - Codec : AAC LC - Samplerate : 48000 - Bitrate : 32 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0400', 0, async function (done) { - playSource(BASIC_PATH + '58.m4a', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0500 - * @tc.name : 005.Playing m4a streams - * @tc.desc : Format : M4A - Codec : AAC LC - Samplerate : 96000 - Bitrate : 32 - Channel : 1 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0500', 0, async function (done) { - playSource(BASIC_PATH + '59.m4a', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0600 - * @tc.name : 006.Playing m4a streams - * @tc.desc : Format : M4A - Codec : AAC LC - Samplerate : 96000 - Bitrate : 32 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0600', 0, async function (done) { - playSource(BASIC_PATH + '61.m4a', done); - }) - - /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0700 - * @tc.name : 007.Playing m4a streams - * @tc.desc : Format : M4A - Codec : AAC LC - Samplerate : 96000 - Bitrate : 64 - Channel : 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0700', 0, async function (done) { - playSource(BASIC_PATH + '62.m4a', done); - }) -}) +/* + * Copyright (C) 2021 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 media from '@ohos.multimedia.media' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('PlayerLocalTestAudioFormat', function () { + const BASIC_PATH = 'file:///data/media/'; + const MAX_VOLUME = 1; + const PLAY_TIME = 3000; + const SEEK_TIME = 10000; // 10s + let isToSeek = false; + let isToDuration = false; + beforeAll(function() { + console.info('beforeAll case'); + }) + + beforeEach(function() { + isToSeek = false; + isToDuration = false; + console.info('beforeEach case'); + }) + + afterEach(function() { + console.info('afterEach case'); + }) + + afterAll(function() { + console.info('afterAll case'); + }) + + function sleep(time) { + for(let t = Date.now(); Date.now() - t <= time;); + } + + function setSrcCallback(audioPlayer) { + audioPlayer.on('dataLoad', () => { + console.info('case set source success'); + expect(audioPlayer.state).assertEqual('paused'); + expect(audioPlayer.currentTime).assertEqual(0); + audioPlayer.play(); + }); + } + + function setPlayCallback(audioPlayer) { + audioPlayer.on('play', () => { + console.info('case start to play'); + expect(audioPlayer.state).assertEqual('playing'); + sleep(PLAY_TIME); + if (!isToSeek) { + audioPlayer.pause(); + } else { + audioPlayer.seek(SEEK_TIME); + } + }); + } + + function setPauseCallback(audioPlayer) { + audioPlayer.on('pause', () => { + console.info('case now is paused'); + expect(audioPlayer.state).assertEqual('paused'); + audioPlayer.setVolume(MAX_VOLUME); + }); + } + + function setResetCallback(audioPlayer, done) { + audioPlayer.on('reset', () => { + console.info('case reset success'); + expect(audioPlayer.state).assertEqual('idle'); + audioPlayer.release(); + audioPlayer = undefined; + done(); + }); + } + + function setStopCallback(audioPlayer) { + audioPlayer.on('stop', () => { + console.info('case stop success'); + expect(audioPlayer.state).assertEqual('stopped'); + audioPlayer.reset(); + }); + } + + function setSeekCallback(audioPlayer, done) { + audioPlayer.on('timeUpdate', (seekDoneTime) => { + if (typeof (seekDoneTime) == "undefined") { + console.info(`case seek filed,errcode is ${seekDoneTime}`); + audioPlayer.release(); + expect().assertFail(); + done(); + return; + } + console.info('case seek success, and seek time is ' + seekDoneTime); + if (!isToDuration) { + expect(SEEK_TIME).assertEqual(seekDoneTime); + isToDuration = true; + sleep(PLAY_TIME); + audioPlayer.seek(audioPlayer.duration); + } else { + expect(audioPlayer.duration).assertEqual(seekDoneTime); + } + }); + } + + function setVolumeCallback(audioPlayer) { + audioPlayer.on('volumeChange', () => { + console.info('case set volume value to ' + MAX_VOLUME); + audioPlayer.play(); + isToSeek = true; + }); + } + + function setFinishCallback(audioPlayer) { + audioPlayer.on('finish', () => { + console.info('case play end'); + expect(audioPlayer.state).assertEqual('stopped'); + audioPlayer.stop(); + }); + } + + function setErrorCallback(audioPlayer, done) { + audioPlayer.on('error', (err) => { + console.info(`case error called,errName is ${err.name}`); + console.info(`case error called,errCode is ${err.code}`); + console.info(`case error called,errMessage is ${err.message}`); + audioPlayer.release(); + expect().assertFail(); + done(); + }); + } + + function playSource(audioSource, done) { + let audioPlayer = media.createAudioPlayer(); + if (typeof (audioPlayer) == 'undefined') { + console.info('case create player is faild'); + expect().assertFail(); + done(); + return; + } + setSrcCallback(audioPlayer); + setPlayCallback(audioPlayer); + setPauseCallback(audioPlayer); + setResetCallback(audioPlayer, done); + setStopCallback(audioPlayer); + setSeekCallback(audioPlayer, done); + setVolumeCallback(audioPlayer); + setFinishCallback(audioPlayer); + setErrorCallback(audioPlayer, done); + audioPlayer.src = audioSource; + } + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0100 + * @tc.name : 001.Playing mp3 streams + * @tc.desc : Format : MP3 + Codec : MP3 + Samplerate : 48000 + Bitrate : 32 + Channel : 1 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0100', 0, async function (done) { + playSource(BASIC_PATH + '01.mp3', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0200 + * @tc.name : 002.Playing mp3 streams + * @tc.desc : Format : MP3 + Codec : MP3 + Samplerate : 48000 + Bitrate : 16/32 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0200', 0, async function (done) { + playSource(BASIC_PATH + '02.mp3', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0300 + * @tc.name : 003.Playing mp3 streams + * @tc.desc : Format : MP3 + Codec : MP3 + Samplerate : 48000 + Bitrate : 32 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0300', 0, async function (done) { + playSource(BASIC_PATH + '03.mp3', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0400 + * @tc.name : 004.Playing mp3 streams + * @tc.desc : Format : MP3 + Codec : MP3 + Samplerate : 48000 + Bitrate : 64 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0400', 0, async function (done) { + playSource(BASIC_PATH + '04.mp3', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0100 + * @tc.name : 001.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : AAC LC + Samplerate : 48000 + Bitrate : 32 + Channel : 1 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0100', 0, async function (done) { + playSource(BASIC_PATH + '47.mp4', done); + }) + + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0300 + * @tc.name : 003.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : AAC LC + Samplerate : 48000 + Bitrate : 64 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0300', 0, async function (done) { + playSource(BASIC_PATH + '49.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0400 + * @tc.name : 004.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : AAC LC + Samplerate : 48000 + Bitrate : 32 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0400', 0, async function (done) { + playSource(BASIC_PATH + '50.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0500 + * @tc.name : 005.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : AAC LC + Samplerate : 96000 + Bitrate : 32 + Channel : 1 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0500', 0, async function (done) { + playSource(BASIC_PATH + '51.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0600 + * @tc.name : 006.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : AAC LC + Samplerate : 96000 + Bitrate : 64 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0600', 0, async function (done) { + playSource(BASIC_PATH + '54.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0700 + * @tc.name : 007.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : MP3 + Samplerate : 48000 + Bitrate : 32 + Channel : 1 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0700', 0, async function (done) { + playSource(BASIC_PATH + '64.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0800 + * @tc.name : 008.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : MP3 + Samplerate : 48000 + Bitrate : 16 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0800', 0, async function (done) { + playSource(BASIC_PATH + '65.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0900 + * @tc.name : 009.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : MP3 + Samplerate : 48000 + Bitrate : 64 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0900', 0, async function (done) { + playSource(BASIC_PATH + '66.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1000 + * @tc.name : 010.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : MP3 + Samplerate : 48000 + Bitrate : 32 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1000', 0, async function (done) { + playSource(BASIC_PATH + '67.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1100 + * @tc.name : 011.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : Vorbis + Samplerate : 48000 + Bitrate : 16 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1100', 0, async function (done) { + playSource(BASIC_PATH + '92.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1200 + * @tc.name : 012.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : Vorbis + Samplerate : 48000 + Bitrate : 64 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1200', 0, async function (done) { + playSource(BASIC_PATH + '93.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1300 + * @tc.name : 013.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : Vorbis + Samplerate : 48000 + Bitrate : 32 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1300', 0, async function (done) { + playSource(BASIC_PATH + '94.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1400 + * @tc.name : 014.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : Vorbis + Samplerate : 96000 + Bitrate : 16 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1400', 0, async function (done) { + playSource(BASIC_PATH + '96.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1500 + * @tc.name : 015.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : Vorbis + Samplerate : 96000 + Bitrate : 32 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1500', 0, async function (done) { + playSource(BASIC_PATH + '97.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1600 + * @tc.name : 016.Playing mp4 streams + * @tc.desc : Format : MP4 + Codec : Vorbis + Samplerate : 96000 + Bitrate : 64 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1600', 0, async function (done) { + playSource(BASIC_PATH + '98.mp4', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0100 + * @tc.name : 001.Playing m4a streams + * @tc.desc : Format : M4A + Codec : AAC LC + Samplerate : 48000 + Bitrate : 32 + Channel : 1 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0100', 0, async function (done) { + playSource(BASIC_PATH + '55.m4a', done); + }) + + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0300 + * @tc.name : 003.Playing m4a streams + * @tc.desc : Format : M4A + Codec : AAC LC + Samplerate : 48000 + Bitrate : 64 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0300', 0, async function (done) { + playSource(BASIC_PATH + '57.m4a', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0400 + * @tc.name : 004.Playing m4a streams + * @tc.desc : Format : M4A + Codec : AAC LC + Samplerate : 48000 + Bitrate : 32 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0400', 0, async function (done) { + playSource(BASIC_PATH + '58.m4a', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0500 + * @tc.name : 005.Playing m4a streams + * @tc.desc : Format : M4A + Codec : AAC LC + Samplerate : 96000 + Bitrate : 32 + Channel : 1 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0500', 0, async function (done) { + playSource(BASIC_PATH + '59.m4a', done); + }) + + /* * + * @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0700 + * @tc.name : 007.Playing m4a streams + * @tc.desc : Format : M4A + Codec : AAC LC + Samplerate : 96000 + Bitrate : 64 + Channel : 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0700', 0, async function (done) { + playSource(BASIC_PATH + '62.m4a', done); + }) +}) diff --git a/multimedia/audio/audio_js_standard/audioPlayer/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/audioPlayer/src/main/resources/base/element/string.json index 2f9470d82c49675a64972657d8d367cd95e51c63..0bae6bd40f7360d5d818998221b199d3ec0f69c0 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer/src/main/resources/base/element/string.json +++ b/multimedia/audio/audio_js_standard/audioPlayer/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ { "string": [ { - "name": "app_name", - "value": "MyApplication" + "name": "entry_MainAbility", + "value": "entry_MainAbility" }, { "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" + "value": "JS_Empty Ability" } ] } \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/Test.json b/multimedia/audio/audio_js_standard/audioPlayer_API/Test.json index 59024212b742c14bf71dd4561969a06757d6ed85..7b69983f5d516cffed42c999c6641ee53ce6d69b 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer_API/Test.json +++ b/multimedia/audio/audio_js_standard/audioPlayer_API/Test.json @@ -1,12 +1,53 @@ { - "description": "Configuration for audio manager Tests", + "description": "Configuration for audioPlayerApi Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.multimedia.audio.function", + "test-timeout": "3000000", + "package": "ohos.acts.multimedia.audio.audioplayerapi", "shell-timeout": "60000" }, "kits": [ + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "resource/audio/01.mP3 ->/data/media/", + "resource/audio/02.mp3 ->/data/media/", + "resource/audio/03.mp3 ->/data/media/", + "resource/audio/04.mp3 ->/data/media/", + "resource/audio/47.mp4 ->/data/media/", + "resource/audio/49.mp4 ->/data/media/", + "resource/audio/50.mp4 ->/data/media/", + "resource/audio/51.mp4 ->/data/media/", + "resource/audio/54.mp4 ->/data/media/", + "resource/audio/55.m4a ->/data/media/", + "resource/audio/57.m4a ->/data/media/", + "resource/audio/58.m4a ->/data/media/", + "resource/audio/59.m4a ->/data/media/", + "resource/audio/62.m4a ->/data/media/", + "resource/audio/64.mp4 ->/data/media/", + "resource/audio/65.mp4 ->/data/media/", + "resource/audio/66.mp4 ->/data/media/", + "resource/audio/67.mp4 ->/data/media/", + "resource/audio/92.mp4 ->/data/media/", + "resource/audio/93.mp4 ->/data/media/", + "resource/audio/94.mp4 ->/data/media/", + "resource/audio/96.mp4 ->/data/media/", + "resource/audio/97.mp4 ->/data/media/", + "resource/audio/98.mp4 ->/data/media/" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod -R 666 /data/media/*", + "setenforce 0" + ], + "teardown-command":[ + "setenforce 1" + ] + }, { "test-file-name": [ "AudioPlayerApiJsTest.hap" diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/config.json b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/config.json index 31b9a1b5a0f828e620d2db6f973f3f8266a176dd..fc4abfa015226d9502bf9201408d69efef9f7bc4 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/config.json +++ b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/config.json @@ -1,31 +1,31 @@ { "app": { - "bundleName": "ohos.acts.multimedia.audio.function", + "bundleName": "ohos.acts.multimedia.audio.audioplayerapi", "vendor": "acts", "version": { "code": 1000000, "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 } }, "deviceConfig": {}, "module": { - "package": "ohos.acts.multimedia.audio.function", + "package": "ohos.acts.multimedia.audio.audioplayerapi", "name": ".MyApplication", + "mainAbility": "ohos.acts.multimedia.audio.audioplayerapi.MainAbility", "deviceType": [ - "phone" + "phone", + "tablet", + "tv", + "wearable" ], "distro": { "deliveryWithInstall": true, "moduleName": "entry", - "moduleType": "entry" + "moduleType": "entry", + "installationFree": false }, "abilities": [ { - "visible": true, "skills": [ { "entities": [ @@ -36,10 +36,11 @@ ] } ], - "name": "ohos.acts.multimedia.audio.function.MainAbility", + "visible": true, + "name": "ohos.acts.multimedia.audio.audioplayerapi.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", - "label": "$string:app_name", + "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" } @@ -52,9 +53,9 @@ "name": "default", "window": { "designWidth": 720, - "autoDesignWidth": false + "autoDesignWidth": true } } ] } -} +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/java/ohos/acts/multimedia/audio/audioplayerapi/MainAbility.java b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/java/ohos/acts/multimedia/audio/audioplayerapi/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..7b949d26cba5398e3c33c4432ef88ff57e65ec98 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/java/ohos/acts/multimedia/audio/audioplayerapi/MainAbility.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2021 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.audioplayerapi; + +import ohos.ace.ability.AceAbility; +import ohos.aafwk.content.Intent; + +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/java/ohos/acts/multimedia/audio/audioplayerapi/MyApplication.java b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/java/ohos/acts/multimedia/audio/audioplayerapi/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..ed412a055822b52923eadbb16b9c7919c17556b6 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/java/ohos/acts/multimedia/audio/audioplayerapi/MyApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 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.audioplayerapi; + +import ohos.aafwk.ability.AbilityPackage; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/app.js index e0b2e05a461ecda7b070d1bb20829b7bde8d5a8a..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/app.js +++ b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/app.js @@ -13,8 +13,6 @@ * limitations under the License. */ -import device from '@system.device'; - export default { onCreate() { console.info('AceApplication onCreate'); diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/common/images/Wallpaper.png b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/common/images/Wallpaper.png differ diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/pages/index/index.css index 6fda792753f2e15f22b529c7b90a82185b2770bf..5bd7567028568bd522193b2519d545ca6dcf397d 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/pages/index/index.css +++ b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/pages/index/index.css @@ -2,8 +2,45 @@ flex-direction: column; justify-content: center; align-items: center; + width: 100%; + height: 100%; } .title { - font-size: 100px; + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("/common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } } diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/pages/index/index.js index 770b1218eb08c0c46fed349f0f5baff40c02f215..20a3cea29d30ad0acb89e4ccc9eece9a3652cbbc 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/pages/index/index.js +++ b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/pages/index/index.js @@ -13,11 +13,11 @@ * limitations under the License. */ +import file from '@system.file' import app from '@system.app' -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' export default { data: { @@ -32,12 +32,23 @@ export default { const expectExtend = new ExpectExtend({ 'id': 'extend' }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + const configService = core.getDefaultService('config') configService.setConfig(this) - require('../../test/List.test') + require('../../../test/List.test') core.execute() }, onReady() { diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/test/List.test.js b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/test/List.test.js old mode 100755 new mode 100644 similarity index 100% rename from multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/test/List.test.js rename to multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/test/List.test.js diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/test/PlayerLocalTestAudioAPI.test.js b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/test/PlayerLocalTestAudioAPI.test.js old mode 100755 new mode 100644 similarity index 99% rename from multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/test/PlayerLocalTestAudioAPI.test.js rename to multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/test/PlayerLocalTestAudioAPI.test.js index e8f05864085f1e1e05ac49059bb5051bab05b85f..6a91e1f0339b7d2b1ae2165dab6b1cd821aa7b88 --- a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/test/PlayerLocalTestAudioAPI.test.js +++ b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/test/PlayerLocalTestAudioAPI.test.js @@ -20,7 +20,7 @@ describe('PlayerLocalTestAudioAPI', function () { let audioPlayer = media.createAudioPlayer(); let loopValue = false; let isTimeOut = false; - const AUDIO_SOURCE = 'file://data/media/audio/01.mp3'; + const AUDIO_SOURCE = 'file://data/media/01.mp3'; const PLAY_TIME = 3000; const END_STATE = 0; const SRC_STATE = 1; @@ -34,7 +34,7 @@ describe('PlayerLocalTestAudioAPI', function () { const ERROR_STATE = 9; const FINISH_STATE = 10; const LOOP_STATE = 11; - const DURATION_TIME = 99432; + const DURATION_TIME = 219600; const SEEK_TIME = 5000; const DELTA_TIME = 1000; const SECOND_INDEX = 1; diff --git a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/resources/base/element/string.json index 2f9470d82c49675a64972657d8d367cd95e51c63..0bae6bd40f7360d5d818998221b199d3ec0f69c0 100755 --- a/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/resources/base/element/string.json +++ b/multimedia/audio/audio_js_standard/audioPlayer_API/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ { "string": [ { - "name": "app_name", - "value": "MyApplication" + "name": "entry_MainAbility", + "value": "entry_MainAbility" }, { "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" + "value": "JS_Empty Ability" } ] } \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRecorder/Test.json b/multimedia/audio/audio_js_standard/audioRecorder/Test.json index ea3e47996b3e015c77d3d17efbfa6ea200b68c8c..cff6cf481367feb76250a2ca96ffc2e8b3996eab 100644 --- a/multimedia/audio/audio_js_standard/audioRecorder/Test.json +++ b/multimedia/audio/audio_js_standard/audioRecorder/Test.json @@ -1,9 +1,9 @@ { - "description": "Configuration for audio manager Tests", + "description": "Configuration for audioRecorder Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.multimedia.audio.function", + "test-timeout": "3000000", + "package": "ohos.acts.multimedia.audio.audiorecorder", "shell-timeout": "60000" }, "kits": [ diff --git a/multimedia/audio/audio_js_standard/audioRecorder/signature/openharmony_sx.p7b b/multimedia/audio/audio_js_standard/audioRecorder/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioRecorder/signature/openharmony_sx.p7b differ diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/config.json b/multimedia/audio/audio_js_standard/audioRecorder/src/main/config.json index 31b9a1b5a0f828e620d2db6f973f3f8266a176dd..6c3df7f3ce0d57c72901e425cd713359e67be495 100644 --- a/multimedia/audio/audio_js_standard/audioRecorder/src/main/config.json +++ b/multimedia/audio/audio_js_standard/audioRecorder/src/main/config.json @@ -1,31 +1,31 @@ { "app": { - "bundleName": "ohos.acts.multimedia.audio.function", + "bundleName": "ohos.acts.multimedia.audio.audiorecorder", "vendor": "acts", "version": { "code": 1000000, "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 } }, "deviceConfig": {}, "module": { - "package": "ohos.acts.multimedia.audio.function", + "package": "ohos.acts.multimedia.audio.audiorecorder", "name": ".MyApplication", + "mainAbility": "ohos.acts.multimedia.audio.audiorecorder.MainAbility", "deviceType": [ - "phone" + "phone", + "tablet", + "tv", + "wearable" ], "distro": { "deliveryWithInstall": true, "moduleName": "entry", - "moduleType": "entry" + "moduleType": "entry", + "installationFree": false }, "abilities": [ { - "visible": true, "skills": [ { "entities": [ @@ -36,10 +36,11 @@ ] } ], - "name": "ohos.acts.multimedia.audio.function.MainAbility", + "visible": true, + "name": "ohos.acts.multimedia.audio.audiorecorder.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", - "label": "$string:app_name", + "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" } @@ -52,9 +53,9 @@ "name": "default", "window": { "designWidth": 720, - "autoDesignWidth": false + "autoDesignWidth": true } } ] } -} +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audiorecorder/MainAbility.java b/multimedia/audio/audio_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audiorecorder/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..0d28e799a5e65264fa1b8cad95eb1387b77fdb56 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audiorecorder/MainAbility.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2021 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.audiorecorder; + +import ohos.ace.ability.AceAbility; +import ohos.aafwk.content.Intent; + +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audiorecorder/MyApplication.java b/multimedia/audio/audio_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audiorecorder/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..5ef658c632a5340e6d16cc76b5a74a117b58b9c1 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audiorecorder/MyApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 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.audiorecorder; + +import ohos.aafwk.ability.AbilityPackage; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/app.js index e0b2e05a461ecda7b070d1bb20829b7bde8d5a8a..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 100644 --- a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/app.js +++ b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/app.js @@ -13,8 +13,6 @@ * limitations under the License. */ -import device from '@system.device'; - export default { onCreate() { console.info('AceApplication onCreate'); diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/common/images/Wallpaper.png b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/common/images/Wallpaper.png differ diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/i18n/zn-CN.json b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/i18n/zn-CN.json rename to multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/i18n/zh-CN.json diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/pages/index/index.css index 6fda792753f2e15f22b529c7b90a82185b2770bf..5bd7567028568bd522193b2519d545ca6dcf397d 100644 --- a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/pages/index/index.css +++ b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/pages/index/index.css @@ -2,8 +2,45 @@ flex-direction: column; justify-content: center; align-items: center; + width: 100%; + height: 100%; } .title { - font-size: 100px; + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("/common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } } diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/pages/index/index.js index 770b1218eb08c0c46fed349f0f5baff40c02f215..6033a1033ef272207575a988457b8425388bb69d 100644 --- a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/pages/index/index.js +++ b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/pages/index/index.js @@ -13,11 +13,11 @@ * limitations under the License. */ +import file from '@system.file' import app from '@system.app' -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' export default { data: { @@ -32,14 +32,25 @@ export default { const expectExtend = new ExpectExtend({ 'id': 'extend' }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + const configService = core.getDefaultService('config') configService.setConfig(this) - require('../../test/List.test') + require('../../../test/List.test') core.execute() }, onReady() { }, -} \ No newline at end of file +} diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/test/List.test.js b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/test/List.test.js similarity index 100% rename from multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/test/List.test.js rename to multimedia/audio/audio_js_standard/audioRecorder/src/main/js/test/List.test.js diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/test/RecorderLocalTestAudioAPI.test.js b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioAPI.test.js similarity index 100% rename from multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/test/RecorderLocalTestAudioAPI.test.js rename to multimedia/audio/audio_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioAPI.test.js diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/test/RecorderLocalTestAudioFUNC.test.js b/multimedia/audio/audio_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioFUNC.test.js similarity index 100% rename from multimedia/audio/audio_js_standard/audioRecorder/src/main/js/default/test/RecorderLocalTestAudioFUNC.test.js rename to multimedia/audio/audio_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioFUNC.test.js diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/audioRecorder/src/main/resources/base/element/string.json index 2f9470d82c49675a64972657d8d367cd95e51c63..0bae6bd40f7360d5d818998221b199d3ec0f69c0 100644 --- a/multimedia/audio/audio_js_standard/audioRecorder/src/main/resources/base/element/string.json +++ b/multimedia/audio/audio_js_standard/audioRecorder/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ { "string": [ { - "name": "app_name", - "value": "MyApplication" + "name": "entry_MainAbility", + "value": "entry_MainAbility" }, { "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" + "value": "JS_Empty Ability" } ] } \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRecorder/src/main/resources/base/media/icon.png b/multimedia/audio/audio_js_standard/audioRecorder/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioRecorder/src/main/resources/base/media/icon.png differ diff --git a/multimedia/media/media_cpp_test_standard/Test.json b/multimedia/media/media_cpp_test_standard/Test.json index d38c29a4cb4aa5f0fd252b5fe4170ea72990ef4b..224254e93036131f83dc98ceb21de91a5a85cf76 100755 --- a/multimedia/media/media_cpp_test_standard/Test.json +++ b/multimedia/media/media_cpp_test_standard/Test.json @@ -1,18 +1,34 @@ { - "kits": [ - { - "push": [ - "ActsMediaCppStandardTest->/data/local/tmp/ActsMediaCppStandardTest" - ], - "type": "PushKit" - } - ], + "description": "Configuration for ActsMediaCppStandardTest Tests", "driver": { - "native-test-timeout": "120000", + "native-test-timeout": "4800000", "type": "CppTest", "module-name": "ActsMediaCppStandardTest", "runtime-hint": "1s", "native-test-device-path": "/data/local/tmp" }, - "description": "Configuration for ActsMediaCppStandardTest Tests" + "kits": [ + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "ActsMediaCppStandardTest->/data/local/tmp/ActsMediaCppStandardTest", + "resource/media/1h264_320x240_60.3gp ->/data/media/", + "resource/media/h264_320x240_60.m4v ->/data/media/", + "resource/media/hevc_320x240_30.mp4 ->/data/media/", + "resource/media/hevc_320x240_60.mp4 ->/data/media/" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod -R 666 /data/media/*", + "setenforce 0" + ], + "teardown-command":[ + "setenforce 1" + ] + } + ] } \ No newline at end of file