提交 0cec513f 编写于 作者: W wangzx0705

modify the error code

Signed-off-by: Nwangzx0705 <wangzx0705@thundersoft.com>
上级 7edefc44
......@@ -15,6 +15,7 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import audio from '@ohos.multimedia.audio';
import featureAbility from '@ohos.ability.featureAbility';
import * as env from './Const.ets';
export default function audioManagerTest() {
describe('adjustSystemVolumeByStep', function () {
......@@ -128,7 +129,7 @@ export default function audioManagerTest() {
await audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType[index], VOLUME_ADJUST_DOWN).then((data) => {
console.info(`####${index} adjustSystemVolumeByStep :SUCCESS ${data}`);
}).catch((error) => {
if(index == 'ALL' && error.code == 6800104){
if(index == 'ALL' && error.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####${index} adjustSystemVolumeByStep : error ${error.message} ${error.code}`);
}else{
expect(false).assertTrue();
......@@ -166,7 +167,7 @@ export default function audioManagerTest() {
await audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType[index], VOLUME_ADJUST_UP).then((data) => {
console.info(`####${index} adjustSystemVolumeByStep :SUCCESS ${data}`);
}).catch((error) => {
if(index == 'ALL' && error.code == 6800104){
if(index == 'ALL' && error.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####${index} adjustSystemVolumeByStep : data ${error.message} ${error.code}`);
}else{
expect(false).assertTrue();
......@@ -203,7 +204,7 @@ export default function audioManagerTest() {
await audioVolumeGroupManager.adjustSystemVolumeByStep(AUDIO_VLOUME_TYPE_ERROR, VOLUME_ADJUST_DOWN).then((data) => {
console.info(`####Unknown volume type, Set it to default MEDIA! adjustSystemVolumeByStep :SUCCESS ${data}`);
}).catch((error) => {
if(error.code == 6800104){
if(error.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${error.message}, code ${error.code}`);
}else{
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${error.message}, code ${error.code}`);
......@@ -242,7 +243,7 @@ export default function audioManagerTest() {
await audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType.MEDIA, VOLUME_ADJUST_ERROR).then((data) => {
console.info(`####adjustSystemVolumeByStep :SUCCESS ${data}`);
}).catch((error) => {
if(error.code == 6800104){
if(error.code == UNSUPORTED_OPTION_6800104){
console.info(`####adjustSystemVolumeByStep : ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......@@ -278,7 +279,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......@@ -310,7 +311,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......@@ -343,7 +344,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800104){
if(error.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......@@ -412,7 +413,7 @@ export default function audioManagerTest() {
await audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType[index], VOLUME_ADJUST_UP).then((data) => {
console.info(`####${index} adjustSystemVolumeByStep :SUCCESS ${data}`);
}).catch((error) => {
if(index == 'ALL' && error.code == 6800104){
if(index == 'ALL' && error.code == UNSUPORTED_OPTION_6800104){
console.info(`####${index} adjustSystemVolumeByStep: error ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......@@ -481,7 +482,7 @@ export default function audioManagerTest() {
}
done();
}catch (error){
if(type == 'ALL' && error.code == 6800301){
if(type == 'ALL' && error.code == UNSUPORTED_OPTION_6800104){
console.info(`####${type} adjustSystemVolumeByStep: error ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......@@ -604,7 +605,7 @@ export default function audioManagerTest() {
console.info(`####${index} setVolume :volome ${Vol}`);
await audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType[index], VOLUME_ADJUST_DOWN, (err,data) => {
if(err){
if(index == 'ALL' && err.code == 6800104){
if(index == 'ALL' && err.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####${index} adjustSystemVolumeByStep : error ${err.message}, code ${err.code}`);
}else{
console.log(`${TagFrmwk}: ####${index} adjustSystemVolumeByStep : error ${err.message}, code ${err.code}`);
......@@ -644,7 +645,7 @@ export default function audioManagerTest() {
console.info(`####${index} setVolume :volome ${Vol}`);
await audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType[index], VOLUME_ADJUST_UP, (err,data) => {
if(err){
if(index == 'ALL' && err.code == 6800104){
if(index == 'ALL' && err.code == UNSUPORTED_OPTION_6800104){
console.log(`####${index} adjustSystemVolumeByStep : error ${err.message}, code ${err.code}`);
}else{
console.log(`####${index} adjustSystemVolumeByStep : error ${err.message}, code ${err.code}`);
......@@ -682,7 +683,7 @@ export default function audioManagerTest() {
await audioVolumeGroupManager.setVolume(audio.AudioVolumeType.MEDIA, vol_MEDIA);
console.info(`####setVolume :volume ${vol_MEDIA}`);
await audioVolumeGroupManager.adjustSystemVolumeByStep(AUDIO_VOLUME_TYPE_ERROR, VOLUME_ADJUST_UP, (err,data) => {
if(err.code == 6800104){
if(err.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${err.message}, code ${err.code}`);
}else{
console.info(`####adjustSystemVolumeByStep :SUCCESS ${data}`);
......@@ -721,7 +722,7 @@ export default function audioManagerTest() {
try {
let VOLUME_ADJUST_TYPE_ERROR = 3;
await audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType.MEDIA, VOLUME_ADJUST_TYPE_ERROR, (err,data) => {
if(err.code == 6800104){
if(err.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${err.message}, code ${err.code}`);
expect(true).assertTrue();
done();
......@@ -749,8 +750,7 @@ export default function audioManagerTest() {
try {
let AUDIO_VOLUME_TYPE_ERROR = '123';
await audioVolumeGroupManager.adjustSystemVolumeByStep(AUDIO_VOLUME_TYPE_ERROR, VOLUME_ADJUST_DOWN, (err,data) => {
if(err.code == 6800101){
//error invalid parameter, code 6800101
if(err.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${err.message}, code ${err.code}`);
expect(true).assertTrue();
done();
......@@ -816,7 +816,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......@@ -849,7 +849,7 @@ export default function audioManagerTest() {
expect(true).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####adjustSystemVolumeByStep : error ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......@@ -884,7 +884,7 @@ export default function audioManagerTest() {
console.info(`####${index} set max Volume :volome ${maxVol}`);
await audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType[index], VOLUME_ADJUST_UP, (err,data) => {
if(err){
if(index == 'ALL' && err.code == 6800104){
if(index == 'ALL' && err.code == UNSUPORTED_OPTION_6800104){
console.info(`####${index} adjustSystemVolumeByStep: error ${err.message}, code ${err.code}`);
expect(true).assertTrue();
done();
......@@ -910,7 +910,7 @@ export default function audioManagerTest() {
}
done();
}catch (error){
if(type == 'ALL' && error.code == 6800104){
if(type == 'ALL' && error.code == UNSUPORTED_OPTION_6800104){
console.info(`####${type} adjustSystemVolumeByStep: error ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......@@ -960,7 +960,7 @@ export default function audioManagerTest() {
}
done();
}catch (error){
if(type == 'ALL' && error.code == 6800301){
if(type == 'ALL' && error.code == UNSUPORTED_OPTION_6800104){
console.info(`####${type} adjustSystemVolumeByStep: error ${error.message}, code ${error.code}`);
expect(true).assertTrue();
done();
......
......@@ -16,6 +16,7 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import audio from '@ohos.multimedia.audio';
import featureAbility from '@ohos.ability.featureAbility';
import * as env from './Const.ets';
export default function audioManagerTest() {
describe('adjustVolumeByStep', function () {
......@@ -158,7 +159,7 @@ export default function audioManagerTest() {
await audioVolumeGroupManager.adjustVolumeByStep(VOLUME_ADJUST_ERROR).then((data) => {
console.info(`####adjustVolumeByStep :SUCCESS ${data}`);
}).catch((error) => {
if(error.code == 6800104){
if(error.code == UNSUPORTED_OPTION_6800104){
console.log(`####adjustVolumeByStep : error.code ${error.code}, ${error.message}`);
}else{
console.log(`${TagFrmwk}: ####adjustVolumeByStep : error.code ${error.code}, ${error.message}`);
......@@ -193,7 +194,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####adjustVolumeByStep : error ${error.code}, message ${error.message}`);
expect(true).assertTrue();
done();
......@@ -224,7 +225,7 @@ export default function audioManagerTest() {
expect(true).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####adjustVolumeByStep : error ${error.code}, message ${error.message}`);
expect(true).assertTrue();
done();
......@@ -442,7 +443,7 @@ export default function audioManagerTest() {
await audioVolumeGroupManager.setVolume(audio.AudioVolumeType.MEDIA, Vol);
await audioVolumeGroupManager.adjustVolumeByStep(VOLUME_ADJUST_ERROR, (err,data) => {
if (err) {
if(err.code == 6800104){
if(err.code == UNSUPORTED_OPTION_6800104){
console.log(`####adjustVolumeByStep : error ${err.code}, message ${err.message}`);
}else{
console.log(`####adjustVolumeByStep : error ${err.code}, message ${err.message}`);
......@@ -475,7 +476,7 @@ export default function audioManagerTest() {
try {
let VOLUME_ADJUST_ERROR = '123';
await audioVolumeGroupManager.adjustVolumeByStep(VOLUME_ADJUST_ERROR, (err,data) => {
if(err.code == 6800101){
if(err.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####adjustVolumeByStep : error ${err.code}, message ${err.message}`);
expect(true).assertTrue();
done();
......@@ -512,7 +513,7 @@ export default function audioManagerTest() {
done();
}
}).catch ((error)=>{
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####adjustVolumeByStep : error ${error.code}, message ${error.message}`);
expect(true).assertTrue();
done();
......@@ -556,7 +557,7 @@ export default function audioManagerTest() {
expect(curVol).assertEqual(maxVol);
done();
}catch (error){
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.info(`####adjustVolumeByStep : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......@@ -596,7 +597,7 @@ export default function audioManagerTest() {
expect(curVol).assertEqual(minVol);
done();
}catch (error){
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.info(`####adjustVolumeByStep : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......
......@@ -16,6 +16,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import audio from '@ohos.multimedia.audio';
import featureAbility from '@ohos.ability.featureAbility';
import ArrayList from '@ohos.util.ArrayList';
import * as env from './Const.ets';
export default function audioManagerTest() {
describe('getDefaultVolume', function () {
......
......@@ -16,6 +16,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import audio from '@ohos.multimedia.audio';
import featureAbility from '@ohos.ability.featureAbility';
import ArrayList from '@ohos.util.ArrayList';
import * as env from './Const.ets';
export default function audioManagerTest() {
describe('getMax_Minvolume', function () {
......
......@@ -16,6 +16,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import audio from '@ohos.multimedia.audio';
import featureAbility from '@ohos.ability.featureAbility';
import ArrayList from '@ohos.util.ArrayList';
import * as env from './Const.ets';
export default function audioManagerTest() {
describe('getSystemVolumeInDb', function () {
......@@ -202,7 +203,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800104){
if(error.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......@@ -233,7 +234,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800104){
if(error.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......@@ -265,7 +266,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......@@ -322,7 +323,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......@@ -353,7 +354,7 @@ export default function audioManagerTest() {
expect(false).assertTrue();
done();
}).catch((error) => {
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......@@ -655,7 +656,7 @@ export default function audioManagerTest() {
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETSYSTEMVOLUMEINDB_CALLBACK_0500', 0, async function (done) {
try {
await audioVolumeGroupManager.getSystemVolumeInDb(-1, 3, audio.DeviceType.SPEAKER, (err,data) => {
if(err.code == 6800104){
if(err.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(true).assertTrue();
done();
......@@ -683,7 +684,7 @@ export default function audioManagerTest() {
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETSYSTEMVOLUMEINDB_CALLBACK_0600', 0, async function (done) {
try {
await audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, -1, audio.DeviceType.SPEAKER, (err,data) => {
if(err.code == 6800104){
if(err.code == UNSUPORTED_OPTION_6800104){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(true).assertTrue();
done();
......@@ -712,7 +713,7 @@ export default function audioManagerTest() {
try {
let maxVol = audioVolumeGroupManager.getMaxVolume(audio.AudioVolumeType.MEDIA);
await audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, maxVol+1, audio.DeviceType.SPEAKER, (err,data) => {
if(err.code == 6800101){
if(err.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(true).assertTrue();
done();
......@@ -768,7 +769,7 @@ export default function audioManagerTest() {
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETSYSTEMVOLUMEINDB_CALLBACK_0900', 0, async function (done) {
try {
await audioVolumeGroupManager.getSystemVolumeInDb('123', 3, audio.DeviceType.SPEAKER, (err,data) => {
if(err.code == 6800101){
if(err.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(true).assertTrue();
done();
......@@ -796,7 +797,7 @@ export default function audioManagerTest() {
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETSYSTEMVOLUMEINDB_CALLBACK_1000', 0, async function (done) {
try {
await audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, '123', audio.DeviceType.SPEAKER, (err,data) => {
if(err.code == 6800101){
if(err.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(true).assertTrue();
done();
......@@ -853,7 +854,7 @@ export default function audioManagerTest() {
try {
await audioVolumeGroupManager.getSystemVolumeInDb(3, audio.DeviceType.SPEAKER, (err,data) => {
if(err) {
if (err.code == 6800101) {
if (err.code == INVALID_INPUT_PARAMETER_6800101) {
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(true).assertTrue();
done();
......@@ -865,7 +866,7 @@ export default function audioManagerTest() {
}
});
}catch (error){
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......@@ -889,7 +890,7 @@ export default function audioManagerTest() {
try {
await audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, audio.DeviceType.SPEAKER, (err,data) => {
if(err){
if(err.code == 6800101){
if(err.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(true).assertTrue();
done();
......@@ -901,7 +902,7 @@ export default function audioManagerTest() {
}
});
}catch (error){
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......@@ -925,7 +926,7 @@ export default function audioManagerTest() {
try {
await audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, 3, (err,data) => {
if(err){
if(err.code == 6800101){
if(err.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(true).assertTrue();
done();
......@@ -937,7 +938,7 @@ export default function audioManagerTest() {
}
});
}catch (error){
if(error.code == 6800101){
if(error.code == INVALID_INPUT_PARAMETER_6800101){
console.log(`${TagFrmwk}: ####getSystemVolumeInDb : error ${error.message} ${error.code}`);
expect(true).assertTrue();
done();
......
......@@ -15,6 +15,7 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import audio from '@ohos.multimedia.audio';
import featureAbility from '@ohos.ability.featureAbility';
import * as env from './Const.ets';
export default function audioManagerTest() {
describe('isVolumeUnadjustable', function () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册