提交 aaa57390 编写于 作者: T tianfenxia

tianfenxia1@huawei.com

Signed-off-by: Ntianfenxia <tianfenxia1@huawei.com>
上级 b55d8074
......@@ -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 {
......
......@@ -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": [
......
{
"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
/*
* 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();
}
}
/*
* 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();
}
}
......@@ -13,8 +13,6 @@
* limitations under the License.
*/
import device from '@system.device';
export default {
onCreate() {
console.info('AceApplication onCreate');
......
......@@ -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;
}
}
......@@ -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() {
......
......@@ -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')
......
{
"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
{
"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
......
{
"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
/*
* 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();
}
}
/*
* 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();
}
}
......@@ -13,8 +13,6 @@
* limitations under the License.
*/
import device from '@system.device';
export default {
onCreate() {
console.info('AceApplication onCreate');
......
......@@ -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;
}
}
......@@ -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() {
......
......@@ -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;
......
/*
* 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);
})
})
{
"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
{
"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"
......
{
"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
/*
* 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();
}
}
/*
* 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();
}
}
......@@ -13,8 +13,6 @@
* limitations under the License.
*/
import device from '@system.device';
export default {
onCreate() {
console.info('AceApplication onCreate');
......
......@@ -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;
}
}
......@@ -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() {
......
......@@ -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;
......
{
"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
{
"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": [
......
{
"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
/*
* 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();
}
}
/*
* 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();
}
}
......@@ -13,8 +13,6 @@
* limitations under the License.
*/
import device from '@system.device';
export default {
onCreate() {
console.info('AceApplication onCreate');
......
......@@ -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;
}
}
......@@ -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
}
{
"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
{
"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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册