提交 3ad3c26c 编写于 作者: 高曦

电话子系统js用例上库

Signed-off-by: N高曦 <gaoxi785@huawei.com>
上级 dc942ece
...@@ -61,7 +61,8 @@ import { ...@@ -61,7 +61,8 @@ import {
ZOOM_RATIO_MINUS_1_0, ZOOM_RATIO_MINUS_1_0,
DIAL_SCENCE_CALL_NORMAL, DIAL_SCENCE_CALL_NORMAL,
DIAL_TYPE_OTT, DIAL_TYPE_OTT,
EVENT_OTT_FUNCTION_UNSUPPORTED EVENT_OTT_FUNCTION_UNSUPPORTED,
TEL_CONFERENCE_IDLE
} from './lib/Const.js'; } from './lib/Const.js';
import {toString} from './lib/ApiToPromise.js'; import {toString} from './lib/ApiToPromise.js';
import { import {
...@@ -100,6 +101,22 @@ class NumberFormatOptions { ...@@ -100,6 +101,22 @@ class NumberFormatOptions {
this.countryCode = str; this.countryCode = str;
} }
} }
class CallAttributeOptions {
constructor (accountNumber, speakerphoneOn, accountId, videoState, startTime,
isEcc, callType, callId, callState, conferenceState) {
this.accountNumber = accountNumber;
this.speakerphoneOn = speakerphoneOn;
this.accountId = accountId;
this.videoState = videoState;
this.startTime = startTime;
this.isEcc = isEcc;
this.callType = callType;
this.callId = callId;
this.callState = callState;
this.conferenceState = conferenceState;
}
}
const sleep = (time) => { const sleep = (time) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { setTimeout(() => {
...@@ -129,6 +146,29 @@ describe('CallManageImsCall', function () { ...@@ -129,6 +146,29 @@ describe('CallManageImsCall', function () {
}); });
afterEach(async function () { afterEach(async function () {
try {
const CURRENT_TIME = new Date().valueOf();
const TEMP_CALL_ID = 10;
const IS_ECC = true;
const SPEAK_ON = true;
let callAttributeOptions = new CallAttributeOptions(AUTO_ACCEPT_NUMBER, SPEAK_ON, DEFAULT_SLOT_ID,
MEDIA_TYPE_VOICE, CURRENT_TIME, IS_ECC, DIAL_TYPE_OTT, TEMP_CALL_ID, CALL_STATUS_DIALING,
TEL_CONFERENCE_IDLE);
console.log(`Telephony_CallManager ${toString(callAttributeOptions)}`);
expect(callAttributeOptions.accountNumber === AUTO_ACCEPT_NUMBER).assertTrue();
expect(callAttributeOptions.speakerphoneOn === SPEAK_ON).assertTrue();
expect(callAttributeOptions.accountId === DEFAULT_SLOT_ID).assertTrue();
expect(callAttributeOptions.videoState === MEDIA_TYPE_VOICE).assertTrue();
expect(callAttributeOptions.startTime === CURRENT_TIME).assertTrue();
expect(callAttributeOptions.isEcc === IS_ECC).assertTrue();
expect(callAttributeOptions.callType === DIAL_TYPE_OTT).assertTrue();
expect(callAttributeOptions.callId === TEMP_CALL_ID).assertTrue();
expect(callAttributeOptions.callState === CALL_STATUS_DIALING).assertTrue();
expect(callAttributeOptions.conferenceState === TEL_CONFERENCE_IDLE).assertTrue();
} catch (error) {
console.log(`Telephony_CallManager ${toString(error)}`);
}
try { try {
let callState = await call.getCallState(); let callState = await call.getCallState();
console.log(`Telephony_CallManager callState ${callState} ${gloabCallId}`); console.log(`Telephony_CallManager callState ${callState} ${gloabCallId}`);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import radio from '@ohos.telephony.radio'; import radio from '@ohos.telephony.radio';
import observer from '@ohos.telephony.observer'; import observer from '@ohos.telephony.observer';
import { describe, beforeAll, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, afterAll, it, expect, afterEach } from 'deccjsunit/index';
describe('ActsNetworkSearchTest', function () { describe('ActsNetworkSearchTest', function () {
...@@ -51,6 +51,52 @@ describe('ActsNetworkSearchTest', function () { ...@@ -51,6 +51,52 @@ describe('ActsNetworkSearchTest', function () {
await turnOnRadio(); await turnOnRadio();
}) })
afterEach(async function () {
try {
expect(radio.RADIO_TECHNOLOGY_UNKNOWN === 0).assertTrue();
expect(radio.RADIO_TECHNOLOGY_1XRTT === 2).assertTrue();
expect(radio.RADIO_TECHNOLOGY_WCDMA === 3).assertTrue();
expect(radio.RADIO_TECHNOLOGY_HSPA === 4).assertTrue();
expect(radio.RADIO_TECHNOLOGY_HSPAP === 5).assertTrue();
expect(radio.RADIO_TECHNOLOGY_TD_SCDMA === 6).assertTrue();
expect(radio.RADIO_TECHNOLOGY_EVDO === 7).assertTrue();
expect(radio.RADIO_TECHNOLOGY_EHRPD === 8).assertTrue();
expect(radio.RADIO_TECHNOLOGY_LTE === 9).assertTrue();
expect(radio.RADIO_TECHNOLOGY_LTE_CA === 10).assertTrue();
expect(radio.RADIO_TECHNOLOGY_IWLAN === 11).assertTrue();
expect(radio.RADIO_TECHNOLOGY_NR === 12).assertTrue();
expect(radio.NETWORK_TYPE_UNKNOWN === 0).assertTrue();
expect(radio.NETWORK_TYPE_GSM === 1).assertTrue();
expect(radio.NETWORK_TYPE_CDMA === 2).assertTrue();
expect(radio.NETWORK_TYPE_WCDMA === 3).assertTrue();
expect(radio.NETWORK_TYPE_TDSCDMA === 4).assertTrue();
expect(radio.NETWORK_TYPE_LTE === 5).assertTrue();
expect(radio.NETWORK_TYPE_NR === 6).assertTrue();
expect(radio.REG_STATE_NO_SERVICE === 0).assertTrue();
expect(radio.REG_STATE_IN_SERVICE === 1).assertTrue();
expect(radio.REG_STATE_EMERGENCY_CALL_ONLY === 2).assertTrue();
expect(radio.REG_STATE_POWER_OFF === 3).assertTrue();
expect(radio.NSA_STATE_NOT_SUPPORT === 1).assertTrue();
expect(radio.NSA_STATE_NO_DETECT === 2).assertTrue();
expect(radio.NSA_STATE_CONNECTED_DETECT === 3).assertTrue();
expect(radio.NSA_STATE_IDLE_DETECT === 4).assertTrue();
expect(radio.NSA_STATE_DUAL_CONNECTED === 5).assertTrue();
expect(radio.NSA_STATE_SA_ATTACHED === 6).assertTrue();
expect(radio.NETWORK_UNKNOWN === 0).assertTrue();
expect(radio.NETWORK_CURRENT === 2).assertTrue();
expect(radio.NETWORK_FORBIDDEN === 3).assertTrue();
expect(radio.NETWORK_SELECTION_UNKNOWN === 0).assertTrue();
expect(radio.NETWORK_SELECTION_MANUAL === 2).assertTrue();
} catch (error) {
console.log(`Telephony_NetworkSearch error`);
}
});
/** /**
* @tc.number Telephony_NetworkSearch_getNetworkState_Async_0700 * @tc.number Telephony_NetworkSearch_getNetworkState_Async_0700
* @tc.name SlotId parameter input is -1, test getNetworkState() query function go to the error * @tc.name SlotId parameter input is -1, test getNetworkState() query function go to the error
......
...@@ -15,9 +15,41 @@ ...@@ -15,9 +15,41 @@
import sim from '@ohos.telephony.sim'; import sim from '@ohos.telephony.sim';
import * as env from './lib/Const'; import * as env from './lib/Const';
import { describe, it, expect } from 'deccjsunit/index'; import { describe, it, expect, afterEach } from 'deccjsunit/index';
describe('SimManagerTest', function () { describe('SimManagerTest', function () {
afterEach(async function () {
try {
class IccAccountInfo {
constructor (slotIndex, showName, showNumber) {
this.slotIndex = slotIndex;
this.showName = showName;
this.showNumber = showNumber;
}
}
const SLOT_INDEX = 0;
const SHOW_NAME = 'test';
const SHOW_NUMBER = '10';
let iccAccountInfo = new IccAccountInfo(SLOT_INDEX, SHOW_NAME, SHOW_NUMBER);
expect(iccAccountInfo.slotIndex === SLOT_INDEX).assertTrue();
expect(iccAccountInfo.showName === SHOW_NAME).assertTrue();
expect(iccAccountInfo.showNumber === SHOW_NUMBER).assertTrue();
class LockStatusResponse {
constructor (result, remain) {
this.result = result;
this.remain = remain;
}
}
const RES_RESULT = 0;
const RES_REMAIN = 0;
let lockStatusResponse = new LockStatusResponse(RES_RESULT, RES_REMAIN);
expect(lockStatusResponse.result === RES_RESULT).assertTrue();
expect(lockStatusResponse.remain === RES_REMAIN).assertTrue();
} catch (error) {
console.log(`Telephony_Sim error`);
}
});
/** /**
* @tc.number Telephony_Sim_constantValidate_0100 * @tc.number Telephony_Sim_constantValidate_0100
......
...@@ -35,6 +35,22 @@ describe('SmsMmsErrorTest', function () { ...@@ -35,6 +35,22 @@ describe('SmsMmsErrorTest', function () {
const MAX_CHINESE_MESSAGE_LENTH = 63; const MAX_CHINESE_MESSAGE_LENTH = 63;
const MAX_MESSAGE_LENTH = 2401; const MAX_MESSAGE_LENTH = 2401;
afterEach(async function () {
try {
expect(sms.SIM_MESSAGE_STATUS_FREE === 0).assertTrue();
expect(sms.INSTANT_MESSAGE === 1).assertTrue();
expect(sms.OPTIONAL_MESSAGE === 2).assertTrue();
expect(sms.FORWARD_MESSAGE === 4).assertTrue();
expect(sms.SEND_SMS_SUCCESS === 0).assertTrue();
expect(sms.SEND_SMS_FAILURE_RADIO_OFF === 2).assertTrue();
expect(sms.SEND_SMS_FAILURE_SERVICE_UNAVAILABLE === 3).assertTrue();
} catch (error) {
console.log(`Telephony_SmsMms error`);
}
});
/* /*
* @tc.number Telephony_SmsMms_addSimMessage_Async_0200 * @tc.number Telephony_SmsMms_addSimMessage_Async_0200
* @tc.name When SLOTID is the wrong value,Failed to save SMS to SIM * @tc.name When SLOTID is the wrong value,Failed to save SMS to SIM
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册