提交 32febfd1 编写于 作者: D durui

新增枚举

Signed-off-by: Ndurui <durui15@huawei.com>
上级 9e4cd7aa
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:// www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import avSession from '@ohos.multimedia.avsession';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium';
import featureAbility from '@ohos.ability.featureAbility';
export default function AVSessionEnum() {
describe('AVSessionEnum', function () {
beforeAll(function () {
console.info('TestLog: Start Testing avSession Interfaces');
})
beforeEach(async function () {
console.info('TestLog: Init Session And Controller');
})
afterEach(async function (done) {
done();
})
afterAll(function () {
console.info('TestLog: End Testing avSession Interfaces');
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CONNECTION_STATE_ENUM_0100
* @tc.name : CONNECTION_STATE_ENUM_0100
* @tc.desc : Testing enum of CONNECTION_STATE
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVSESSION_CONNECTION_STATE_ENUM_0100', 0, async function (done) {
console.info(`ConnectionState STATE_CONNECTING is ${avSession.ConnectionState.STATE_CONNECTING}`);
expect(avSession.ConnectionState.STATE_CONNECTING).assertEqual(0);
console.info(`ConnectionState STATE_CONNECTED is ${avSession.ConnectionState.STATE_CONNECTED}`);
expect(avSession.ConnectionState.STATE_CONNECTED).assertEqual(1);
console.info(`ConnectionState STATE_DISCONNECTED is ${avSession.ConnectionState.STATE_DISCONNECTED}`);
expect(avSession.ConnectionState.STATE_DISCONNECTED).assertEqual(6);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_AVCAST_CATEGORY_ENUM_0100
* @tc.name : AVCAST_CATEGORY_ENUM_0100
* @tc.desc : Testing enum of AVCastCategory
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVSESSION_AVCAST_CATEGORY_ENUM_0100', 0, async function (done) {
console.info(`AVCastCategory CATEGORY_LOCAL is ${avSession.AVCastCategory.CATEGORY_LOCAL}`);
expect(avSession.AVCastCategory.CATEGORY_LOCAL).assertEqual(0);
console.info(`AVCastCategory CATEGORY_REMOTE is ${avSession.AVCastCategory.CATEGORY_REMOTE}`);
expect(avSession.AVCastCategory.CATEGORY_REMOTE).assertEqual(undefined);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_DEVICE_TYPE_ENUM_0100
* @tc.name : DEVICE_TYPE_ENUM_0100
* @tc.desc : Testing enum of DeviceType
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVSESSION_DEVICE_TYPE_ENUM_0100', 0, async function (done) {
console.info(`DeviceType DEVICE_TYPE_LOCAL is ${avSession.DeviceType.DEVICE_TYPE_LOCAL}`);
expect(avSession.DeviceType.DEVICE_TYPE_LOCAL).assertEqual(0);
console.info(`DeviceType DEVICE_TYPE_TV is ${avSession.DeviceType.DEVICE_TYPE_TV}`);
expect(avSession.DeviceType.DEVICE_TYPE_TV).assertEqual(2);
console.info(`DeviceType DEVICE_TYPE_SPEAKER is ${avSession.DeviceType.DEVICE_TYPE_SPEAKER}`);
expect(avSession.DeviceType.DEVICE_TYPE_SPEAKER).assertEqual(3);
console.info(`DeviceType DEVICE_TYPE_BLUETOOTH is ${avSession.DeviceType.DEVICE_TYPE_BLUETOOTH}`);
expect(avSession.DeviceType.DEVICE_TYPE_BLUETOOTH).assertEqual(10);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_PLAYBACKSTATE_ENUM_0100
* @tc.name : AVSESSION_PLAYBACKSTATE_ENUM_0100
* @tc.desc : Testing enum of PlaybackState
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVSESSION_PLAYBACKSTATE_ENUM_0100', 0, async function (done) {
console.info(`PlaybackState PLAYBACK_STATE_COMPLETED is ${avSession.PlaybackState.PLAYBACK_STATE_COMPLETED}`);
expect(avSession.PlaybackState.PLAYBACK_STATE_COMPLETED).assertEqual(7);
console.info(`PlaybackState PLAYBACK_STATE_RELEASED is ${avSession.PlaybackState.PLAYBACK_STATE_RELEASED}`);
expect(avSession.PlaybackState.PLAYBACK_STATE_RELEASED).assertEqual(8);
console.info(`PlaybackState PLAYBACK_STATE_ERROR is ${avSession.PlaybackState.PLAYBACK_STATE_ERROR}`);
expect(avSession.PlaybackState.PLAYBACK_STATE_ERROR).assertEqual(9);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ERROR_CODE_ENUM_0100
* @tc.name : AVSESSION_ERROR_CODE_ENUM_0100
* @tc.desc : Testing enum of AVSessionErrorCode
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
// it('SUB_MULTIMEDIA_AVSESSION_ERROR_CODE_ENUM_0100', 0, async function (done) {
// console.info(`AVSessionErrorCode ERR_CODE_DEVICE_CONNECTION_FAILED is ${avSession.AVSessionErrorCode.ERR_CODE_DEVICE_CONNECTION_FAILED}`);
// expect(avSession.AVSessionErrorCode.ERR_CODE_DEVICE_CONNECTION_FAILED).assertEqual(undefined);
// console.info(`AVSessionErrorCode ERR_CODE_REMOTE_CONNECTION_NOT_EXIST is ${avSession.AVSessionErrorCode.ERR_CODE_REMOTE_CONNECTION_NOT_EXIST}`);
// expect(avSession.AVSessionErrorCode.ERR_CODE_REMOTE_CONNECTION_NOT_EXIST).assertEqual(6600109);
// done();
// })
})
}
\ No newline at end of file
......@@ -29,7 +29,13 @@ export default function AVSessionManager() {
}
beforeAll(function () {
console.info('TestLog: Start Testing avSessionManager Interfaces');
console.info('TestLog: Init Session And Controller');
// avSession.createAVSession(context, tag, type).then((data) => {
// session = data;
// }).catch((err) => {
// console.info(`TestLog: Session create error: code: ${err.code}, message: ${err.message}`);
// expect(false).assertTrue();
// });
})
beforeEach(function () {
......@@ -41,7 +47,13 @@ export default function AVSessionManager() {
})
afterAll(function () {
console.info('TestLog: End Testing avSessionManager Interfaces');
console.info('TestLog: Destroy Session And Controller');
session.destroy().then(() => {
console.info('TestLog: Session destroy success');
}).catch((err) => {
console.info(`TestLog: Session destroy error: code: ${err.code}, message: ${err.message}`);
expect(false).assertTrue();
});
})
/* *
......@@ -108,6 +120,7 @@ export default function AVSessionManager() {
console.info(`TestLog: avSession create error: code: ${err.code}, message: ${err.message}`);
expect(true).assertTrue();
});
done();
})
......@@ -151,6 +164,7 @@ export default function AVSessionManager() {
}
}
await sleep(10000);
await currentAVSession.destroy();
done();
})
......@@ -186,6 +200,7 @@ export default function AVSessionManager() {
}
}
await sleep(10000);
await currentAVSession.destroy();
done();
})
......@@ -231,6 +246,7 @@ export default function AVSessionManager() {
}
await sleep(10000);
await currentAVSession.destroy();
done();
})
/* *
......@@ -268,6 +284,7 @@ export default function AVSessionManager() {
}
}
await sleep(10000);
await currentAVSession.destroy();
done();
})
/* *
......@@ -315,6 +332,7 @@ export default function AVSessionManager() {
}
}
await sleep(10000);
await currentAVSession.destroy();
done();
})
/* *
......@@ -360,7 +378,7 @@ export default function AVSessionManager() {
}
}
await sleep(10000);
await session.destroy();
await currentAVSession.destroy();
done();
})
})
......
......@@ -19,6 +19,7 @@ import AVSessionManagerCallback from './AVSessionManagerCallback.test.js';
import AVSessionErrorCode from './AVSessionErrorCode.test';
import AVSessionControllerJSTest from './AVSessionControllerJSTest.js';
import AVSessionJSTest from './AVSessionJSTest.js';
import AVSessionEnum from './AVSessionEnum.test.js'
export default function testsuite() {
AVSession()
......@@ -28,4 +29,5 @@ export default function testsuite() {
AVSessionErrorCode()
AVSessionJSTest ()
AVSessionControllerJSTest ()
AVSessionEnum()
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册