提交 348d3087 编写于 作者: L lwx1121892

<liuxueqi3@huawei.com>

Signed-off-by: Nlwx1121892 <liuxueqi3@huawei.com>
上级 dcbec281
......@@ -13,7 +13,7 @@
],
"type": "AppInstallKit",
"run-command": [
"mkdir /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media"
"mkdir /data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media"
],
"cleanup-apps": true
},
......@@ -22,25 +22,25 @@
"pre-push": [
],
"push": [
"./resource/audio/audioManager/Believer.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/Believer60s.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-1C-8000-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-1C-16000-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-1C-32000-1SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-1C-64000-3SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-1C-96000-4SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-2C-11025-1SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-2C-12000-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files",
"./resource/audio/audioManager/Believer.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media",
"./resource/audio/audioManager/file_example_WAV_1MG.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media",
"./resource/audio/audioManager/safe_and_sound_32.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media",
"./resource/audio/audioManager/test.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media",
"./resource/audio/audioManager/test.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media"
"./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/Believer60s.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-8000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-16000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-32000-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-64000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-96000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-11025-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-12000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media",
"./resource/audio/audioManager/file_example_WAV_1MG.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media",
"./resource/audio/audioManager/safe_and_sound_32.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media",
"./resource/audio/audioManager/test.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media",
"./resource/audio/audioManager/test.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media"
]
}
]
......
......@@ -28,6 +28,8 @@ describe('audioRenderer_audo2', function () {
var mediaDir;
let fdRead;
let readpath;
let fdPath;
let filePath;
/*async function getPathName(){
var path1 = '/data/app/el1/bundle/public/';
var packageName;
......@@ -55,7 +57,7 @@ describe('audioRenderer_audo2', function () {
beforeAll(async function () {
await applyPermission();
console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level');
mediaDir = '/data/storage/el2/base/haps/entry/cache';
// mediaDir = '/data/storage/el2/base/haps/entry/cache';
})
beforeEach(async function () {
......@@ -75,18 +77,15 @@ describe('audioRenderer_audo2', function () {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function getFileDescriptor(fileName) {
let fileDescriptor = undefined;
await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.getRawFileDescriptor(fileName).then(value => {
fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length };
}).catch(error => {
console.log('AudioFrameworkRenderLog:case getRawFileDescriptor err: ' + error);
});
});
return fileDescriptor;
async function getAbilityInfo(fileName) {
let context = await featureAbility.getContext();
console.info("case0 context is " + context);
await context.getFilesDir().then((data) => {
console.info("case1 getFilesDir is path " + data);
mediaDir = data + '/' + fileName;
console.info('case2 mediaDir is ' + mediaDir);
})
}
async function closeFileDescriptor(fileName) {
await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.closeRawFileDescriptor(fileName).then(value => {
......@@ -96,17 +95,39 @@ describe('audioRenderer_audo2', function () {
});
});
}
async function getFdRead(pathName, done) {
await getFileDescriptor(pathName).then((res) => {
if (res == undefined) {
expect().assertFail();
console.info('AudioFrameworkRenderLog:case error fileDescriptor undefined, open file fail');
done();
} else {
fdRead = res.fd;
console.info("AudioFrameworkRenderLog:case 0 fdRead is: " + fdRead);
}
// async function getFdRead(pathName, done) {
// await getFileDescriptor(pathName).then((res) => {
// if (res == undefined) {
// expect().assertFail();
// console.info('AudioFrameworkRenderLog:case error fileDescriptor undefined, open file fail');
// done();
// } else {
// fdRead = res.fd;
// console.info("AudioFrameworkRenderLog:case 0 fdRead is: " + fdRead);
// }
// })
// }
async function getFdRead(pathName) {
let context = await featureAbility.getContext();
console.info("case0 context is " + context);
await context.getFilesDir().then((data) => {
console.info("case1 getFilesDir is path " + data);
filePath = data + '/' + pathName;
console.info('case4 filePath is ' + filePath);
})
fdPath = 'fd://';
await fileio.open(filePath).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber;
fdRead = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
console.info('[fileIO]case open fd success,fdRead is ' + fdRead);
}, (err) => {
console.info('[fileIO]case open fd failed');
}).catch((err) => {
console.info('[fileIO]case catch open fd failed');
});
}
async function applyPermission() {
......@@ -434,13 +455,13 @@ describe('audioRenderer_audo2', function () {
rendererInfo: AudioRendererInfo
}
readpath = 'StarWars10s-1C-44100-2SW.wav';
await getFdRead(readpath,done);
var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
// readpath = 'StarWars10s-1C-44100-2SW.wav';
await getFdRead("StarWars10s-1C-44100-2SW.wav");
var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
await closeFileDescriptor(filePath);
done();
})
......@@ -470,8 +491,9 @@ describe('audioRenderer_audo2', function () {
streamInfo: AudioStreamInfo,
capturerInfo: AudioCapturerInfo
}
var resultFlag = await recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await getAbilityInfo("capture_js-44100-2C-16B.pcm");
var resultFlag = await recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
// var resultFlag = await recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
......@@ -522,17 +544,17 @@ describe('audioRenderer_audo2', function () {
streamInfo: AudioStreamInfoRen,
rendererInfo: AudioRendererInfo
}
recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B-2.pcm', audio.AudioScene.AUDIO_SCENE_PHONE_CHAT);
await getAbilityInfo("capture_js-44100-2C-16B-2.pcm");
recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_PHONE_CHAT);
await sleep(500);
readpath = 'StarWars10s-1C-44100-2SW.wav';
await getFdRead(readpath,done);
await getFdRead(readpath);
var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath,done);
await closeFileDescriptor(readpath);
done();
})
......
......@@ -17,7 +17,7 @@
{
"type": "ShellKit",
"run-command": [
"mkdir /data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache/",
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache/",
"chmod -R 666 /data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache/*"
],
"teardown-command":[
......
/*
* 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.image;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
/*
* java MainAbility
*/
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* 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.image;
import ohos.aafwk.ability.AbilityPackage;
/*
* java MyApplication
*/
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
......@@ -2412,7 +2412,7 @@ describe('Image', function () {
expect(false).assertTrue();
done();
} else {
let packOpts = { format: ["image/jpeg"], quality: 99 }
let packOpts = { format: "image/jpeg", quality: 99 }
imagePackerApi.packing(imageSourceApi, packOpts)
.then(data => {
console.info('TC_062 success');
......@@ -2460,7 +2460,7 @@ describe('Image', function () {
expect(false).assertTrue();
done();
} else {
let packOpts = { format: ["image/jpeg"], quality: 1 }
let packOpts = { format: "image/jpeg", quality: 1 }
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
console.info('TC_062-1 success');
expect(data != undefined).assertTrue();
......@@ -2692,7 +2692,7 @@ describe('Image', function () {
expect(false).assertTrue();
done();
} else {
let packOpts = { format: ["image/jpeg"], quality: 100 }
let packOpts = { format: "image/jpeg", quality: 100 }
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
if (err) {
expect(false).assertTrue();
......@@ -2745,7 +2745,7 @@ describe('Image', function () {
expect(false).assertTrue();
done();
} else {
let packOpts = { format: ["image/jpeg"], quality: 0 }
let packOpts = { format: "image/jpeg", quality: 0 }
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
console.info('TC_062-8 success');
expect(data != undefined).assertTrue();
......@@ -2785,7 +2785,7 @@ describe('Image', function () {
expect(false).assertTrue();
done();
} else {
let packOpts = { format: ["image/jpeg"], quality: -1 }
let packOpts = { format: "image/jpeg", quality: -1 }
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
console.info('TC_062-9 success');
expect(data == undefined).assertTrue();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册