未验证 提交 244964ad 编写于 作者: O openharmony_ci 提交者: Gitee

!3085 电话系统api整改

Merge pull request !3085 from 高曦/OpenHarmony-3.1-Release
......@@ -23,7 +23,8 @@ group("telephonyjstest") {
"netmanager_http:ActsNetManagerHttpEtsTest",
"netmanager_socket:ActsNetManagerSocketEtsTest",
"network_search:network_search",
"new_add:ActsNewAddEtsTest",
"observer:ActsObserverEtsTest",
"radiostatistic:ActsRadiostatisticEtsTest",
"sim:sim",
"sms_mms:sms_mms",
]
......
......@@ -184,125 +184,6 @@ describe('CallManageImsCall', function () {
console.log('Telephony_CallManager all 54 case is over for callmanager CallManageImsCall');
});
/**
* @tc.number Telephony_CallManager_IMS_combineConference_Async_0100
* @tc.name Run the function combineConference by args callId CALL_ID_NOT_EXIST by callback,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_combineConference_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_combineConference_Async_0100';
call.combineConference(CALL_ID_NOT_EXIST, (error, data) => {
if (error) {
console.log(`${caseName} combineConference ${CALL_ID_NOT_EXIST} error,case success,error:${
toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} combineConference success,case failed,data:${toString(data)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_combineConference_Promise_0100
* @tc.name Run the function combineConference by args callId CALL_ID_NOT_EXIST by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_combineConference_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_combineConference_Promise_0100';
call.combineConference(CALL_ID_NOT_EXIST).then(data => {
expect().assertFail();
console.log(`${caseName} combineConference success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} combineConference ${CALL_ID_NOT_EXIST} error,case success,error:${
toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_separateConference_Async_0100
* @tc.name Run the function separateConference by args callId CALL_ID_NOT_EXIST by callback,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_separateConference_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_separateConference_Async_0100';
call.separateConference(CALL_ID_NOT_EXIST, (error, data) => {
if (error) {
console.log(`${caseName} separateConference ${CALL_ID_NOT_EXIST} error,case success,error:${
toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} separateConference success,case failed,data:${toString(data)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_separateConference_Promise_0100
* @tc.name Run the function separateConference by args callId CALL_ID_NOT_EXIST by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_separateConference_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_separateConference_Promise_0100';
call.separateConference(CALL_ID_NOT_EXIST).then(data => {
expect().assertFail();
console.log(`${caseName} separateConference success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} separateConference ${CALL_ID_NOT_EXIST} error,case success,error:${
toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_joinConference_Async_0100
* @tc.name Run the function joinConference by args mainCallId CALL_ID_NOT_EXIST,
* callNumberList PHONE_LIST2 by callback,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_joinConference_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_joinConference_Async_0100';
call.joinConference(CALL_ID_NOT_EXIST, PHONE_LIST2, (error, data) => {
if (error) {
console.log(`${caseName} joinConference ${CALL_ID_NOT_EXIST} error,case success,error:${
toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} joinConference success,case failed,data:${toString(data)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_joinConference_Promise_0100
* @tc.name Run the function joinConference by args mainCallId CALL_ID_NOT_EXIST,
* callNumberList PHONE_LIST2 by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_joinConference_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_joinConference_Promise_0100';
call.joinConference(CALL_ID_NOT_EXIST, PHONE_LIST2).then(data => {
expect().assertFail();
console.log(`${caseName} joinConference success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} joinConference ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400
* @tc.name Run the function enableLteEnhanceMode by args slotId SLOT_ID_INVALID,
......@@ -491,1112 +372,236 @@ describe('CallManageImsCall', function () {
});
});
/**
* @tc.number Telephony_CallManager_IMS_updateImsCallMode_Async_0700
* @tc.name Run function updateImsCallMode by args callId CALL_ID_NOT_EXIST,
* mode CALL_MODE_SEND_RECEIVE by callback,the function return error
* @tc.number Telephony_CallManager_controlCamera_Async_0200
* @tc.name Dial a call and after answering the call,run function controlCamera by
* args cameraId CARMER_ID_NOT_EXIT by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_updateImsCallMode_Async_0700', 0, async function (done) {
let caseName = 'Telephony_CallManager_IMS_updateImsCallMode_Async_0700';
call.updateImsCallMode(CALL_ID_NOT_EXIST, CALL_MODE_SEND_RECEIVE, (error, data) => {
it('Telephony_CallManager_controlCamera_Async_0200', 0, function (done) {
let caseName = 'Telephony_CallManager_controlCamera_Async_0200';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER2,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
let cameraId = CARMER_ID_NOT_EXIT;
call.controlCamera(cameraId, (error) => {
if (error) {
console.log(`${caseName} updateImsCallMode2 error,case success,error:${toString(error)}`);
done();
console.log(`${caseName} error,case success,error:${toString(error)}`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} case failed`);
expect().assertFail();
console.log(`${caseName} updateImsCallMode2 success,case failed,data:${toString(data)}`);
done();
});
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_IMS_updateImsCallMode_Promise_0700
* @tc.name Run function updateImsCallMode by args callId CALL_ID_NOT_EXIST,
* mode CALL_MODE_SEND_RECEIVE by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_updateImsCallMode_Promise_0700', 0, async function (done) {
let caseName = 'Telephony_CallManager_IMS_updateImsCallMode_Promise_0700';
call.updateImsCallMode(CALL_ID_NOT_EXIST, CALL_MODE_SEND_RECEIVE).then(data => {
expect().assertFail();
console.log(`${caseName} updateImsCallMode success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} updateImsCallMode error,case success,error:${toString(error)}`);
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_holdCall_Async_0100
* @tc.name Run the function holdCall by args callId CALL_ID_NOT_EXIST by callback,the function return error
* @tc.number Telephony_CallManager_controlCamera_Promise_0200
* @tc.name Dial a call and after answering the call,run function controlCamera by args cameraId
* CARMER_ID_NOT_EXIT by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_holdCall_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_holdCall_Async_0100';
call.holdCall(CALL_ID_NOT_EXIST, (error, data) => {
if (error) {
console.log(`${caseName} holdCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
it('Telephony_CallManager_controlCamera_Promise_0200', 0, async function (done) {
let caseName = 'Telephony_CallManager_controlCamera_Promise_0200';
let cameraId = CARMER_ID_NOT_EXIT;
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER2,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
await call.controlCamera(cameraId);
console.log(`${caseName} case failed`);
expect().assertFail();
console.log(`${caseName} holdCall success,case failed,data:${toString(data)}`);
done();
});
} catch (err) {
console.log(`${caseName} case success. error:${toString(err)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_IMS_holdCall_Promise_0100
* @tc.name Run the function holdCall by args callId CALL_ID_NOT_EXIST by promise,the function return error
* @tc.number Telephony_CallManager_setPreviewWindow_Async_0300
* @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
* x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_holdCall_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_holdCall_Promise_0100';
call.holdCall(CALL_ID_NOT_EXIST).then(data => {
it('Telephony_CallManager_setPreviewWindow_Async_0300', 0, function (done) {
let caseName = 'Telephony_CallManager_setPreviewWindow_Async_0300';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
call.setPreviewWindow(info, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} case faild`);
expect().assertFail();
console.log(`${caseName} holdCall success,case failed,data:${toString(data)}`);
done();
hangupCall2(caseName, done, callId);
});
}).catch(error => {
console.log(`${caseName} holdCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_unHoldCall_Async_0100
* @tc.name Run the function unHoldCall by args callId CALL_ID_NOT_EXIST by callback,the function return error
* @tc.number Telephony_CallManager_setPreviewWindow_Promise_0300
* @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
* x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_unHoldCall_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_unHoldCall_Async_0100';
call.unHoldCall(CALL_ID_NOT_EXIST, (error, data) => {
if (error) {
console.log(`${caseName} unHoldCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
it('Telephony_CallManager_setPreviewWindow_Promise_0300', 0, async function (done) {
let caseName = 'Telephony_CallManager_setPreviewWindow_Promise_0300';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
await call.setPreviewWindow(info);
console.log(`${caseName} case faild`);
expect().assertFail();
console.log(`${caseName} unHoldCall success,case failed,data:${toString(data)}`);
done();
});
} catch (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_IMS_unHoldCall_Promise_0100
* @tc.name Run the function unHoldCall by args callId CALL_ID_NOT_EXIST by promise,the function return error
* @tc.number Telephony_CallManager_setDisplayWindow_Async_0300
* @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
* x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_unHoldCall_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_unHoldCall_Promise_0100';
call.unHoldCall(CALL_ID_NOT_EXIST).then(data => {
expect().assertFail();
console.log(`${caseName} unHoldCall success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} unHoldCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
done();
it('Telephony_CallManager_setDisplayWindow_Async_0300', 0, async function (done) {
let caseName = 'Telephony_CallManager_setDisplayWindow_Async_0300';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
await call.setDisplayWindow(info);
console.log(`${caseName} case faild`);
expect().assertFail();
} catch (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_IMS_switchCall_Async_0100
* @tc.name Run the function switchCall by args callId CALL_ID_NOT_EXIST by callback,the function return error
* @tc.number Telephony_CallManager_setDisplayWindow_Promise_0300
* @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
* x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_switchCall_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_switchCall_Async_0100';
call.switchCall(CALL_ID_NOT_EXIST, (error, data) => {
if (error) {
console.log(`${caseName} switchCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
it('Telephony_CallManager_setDisplayWindow_Promise_0300', 0, async function (done) {
let caseName = 'Telephony_CallManager_setDisplayWindow_Promise_0300';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
await call.setDisplayWindow(info);
console.log(`${caseName} case faild`);
expect().assertFail();
console.log(`${caseName} switchCall ${CALL_ID_NOT_EXIST} success,case failed,data:${toString(data)}`);
done();
});
} catch (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_IMS_switchCall_Promise_0100
* @tc.name Run the function switchCall by args callId CALL_ID_NOT_EXIST by promise,the function return error
* @tc.number Telephony_CallManager_setCameraZoom_Async_0400
* @tc.name Dial a call and after answering the call,run function setCameraZoom by args
* zoomRatio ZOOM_RATIO_MINUS_1_0 by callback,the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_switchCall_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_switchCall_Promise_0100';
call.switchCall(CALL_ID_NOT_EXIST).then(data => {
it('Telephony_CallManager_setCameraZoom_Async_0400', 0, function (done) {
let caseName = 'Telephony_CallManager_setCameraZoom_Async_0400';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER2,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
call.setCameraZoom(ZOOM_RATIO_MINUS_1_0, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} case failed`);
expect().assertFail();
console.log(`${caseName} switchCall ${CALL_ID_NOT_EXIST} success,case failed,data:${toString(data)}`);
done();
hangupCall2(caseName, done, callId);
});
}).catch(error => {
console.log(`${caseName} switchCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_USSD_dial_Async_0600
* @tc.name Run the function dial by args phoneNumber COMMAND_CALL_ERROR options
* {accountId:DEFAULT_SLOT_ID,videoState:MEDIA_TYPE_VOICE,dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
* dialType:DIAL_CARRIER_TYPE} by callback,the function return true
* @tc.number Telephony_CallManager_setCameraZoom_Promise_0400
* @tc.name Dial a call and after answering the call,run function setCameraZoom by args
* zoomRatio ZOOM_RATIO_MINUS_1_0 by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_USSD_dial_Async_0600', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_USSD_dial_Async_0600';
call.dial(COMMAND_CALL_ERROR, {accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE}, (error, data) => {
if (error) {
expect().assertFail();
console.log(`${caseName} dial error,case failed,error:${toString(error)}`);
done();
return;
}
expect(data).assertTrue();
console.log(`${caseName} dial success,case ${data === true ? 'success' :
'failed'},data:${toString(data)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_USSD_dial_Promise_0600
* @tc.name Run the function dial by args phoneNumber COMMAND_CALL_ERROR4 options
* {accountId:DEFAULT_SLOT_ID,videoState:MEDIA_TYPE_VOICE,dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
* dialType:DIAL_CARRIER_TYPE} by promise,the function return true
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_USSD_dial_Promise_0600', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_USSD_dial_Promise_0600';
call.dial(COMMAND_CALL_ERROR4, {accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE}).then(data => {
expect(data).assertTrue();
console.log(`${caseName} dial success,case ${data === true ? 'success' : 'failed'},data:${toString(data)}`);
done();
}).catch(error => {
expect().assertFail();
console.log(`${caseName} dial error,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_enableImsSwitch_Async_0400
* @tc.name Run the function enableImsSwitch by args callId SLOT_ID_INVALID by callback,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_enableImsSwitch_Async_0400', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_enableImsSwitch_Async_0400';
call.enableImsSwitch(SLOT_ID_INVALID, (error, data) => {
if (error) {
console.log(`${caseName} enableImsSwitch error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} enableImsSwitch success,case failed,data:${toString(data)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_enableImsSwitch_Promise_0400
* @tc.name Run the function enableImsSwitch by args callId SLOT_ID_INVALID by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_enableImsSwitch_Promise_0400', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_enableImsSwitch_Promise_0400';
call.enableImsSwitch(SLOT_ID_INVALID).then(data => {
expect().assertFail();
console.log(`${caseName} enableImsSwitch success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} enableImsSwitch error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_disableImsSwitch_Async_0600
* @tc.name Run the function disableImsSwitch by args callId SLOT_ID_INVALID by callback,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_disableImsSwitch_Async_0600', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_disableImsSwitch_Async_0600';
call.disableImsSwitch(SLOT_ID_INVALID, (error, data) => {
if (error) {
console.log(`${caseName} disableImsSwitch error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} disableImsSwitch success,case failed,data:${toString(data)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_disableImsSwitch_Promise_0600
* @tc.name Run the function disableImsSwitch by args callId SLOT_ID_INVALID by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_disableImsSwitch_Promise_0600', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_disableImsSwitch_Promise_0600';
call.disableImsSwitch(SLOT_ID_INVALID).then(data => {
expect().assertFail();
console.log(`${caseName} disableImsSwitch success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} disableImsSwitch error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_isImsSwitchEnabled_Async_0500
* @tc.name Run the function isImsSwitchEnabled by args callId SLOT_ID_INVALID by callback,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_isImsSwitchEnabled_Async_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_isImsSwitchEnabled_Async_0500';
call.isImsSwitchEnabled(SLOT_ID_INVALID, (error, data) => {
if (error) {
console.log(`${caseName} isImsSwitchEnabled error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} isImsSwitchEnabled success,case failed,data:${toString(data)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_isImsSwitchEnabled_Promise_0500
* @tc.name Run the function isImsSwitchEnabled by args callId SLOT_ID_INVALID by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_isImsSwitchEnabled_Promise_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_isImsSwitchEnabled_Promise_0500';
call.isImsSwitchEnabled(SLOT_ID_INVALID).then(data => {
expect().assertFail();
console.log(`${caseName} isImsSwitchEnabled success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} isImsSwitchEnabled error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_setCallTransfer_Async_1300
* @tc.name Run function setCallTransfer by args slotId SLOT_ID_INVALID,settingType CALL_TRANSFER_DISABLE,
* type TRANSFER_TYPE_NO_REPLY,transferNum PHONE_NUMBER_LENGTH_11 by callback,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_setCallTransfer_Async_1300', 0, async function (done) {
let caseName = 'Telephony_CallManager_IMS_setCallTransfer_Async_1300';
call.setCallTransfer(SLOT_ID_INVALID, {
settingType:CALL_TRANSFER_DISABLE,
type:TRANSFER_TYPE_NO_REPLY,
transferNum:PHONE_NUMBER_LENGTH_11
}, (error, data) => {
if (error) {
console.log(`${caseName} case success, error:${toString(error)}`);
done();
return;
}
console.log(`${caseName} case failed,data:${toString(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_setCallTransfer_Promise_1300
* @tc.name Run function setCallTransfer by args slotId SLOT_ID_INVALID,settingType CALL_TRANSFER_DISABLE,
* type TRANSFER_TYPE_UNCONDITIONAL,transferNum PHONE_NUMBER_AREA_LAND by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_setCallTransfer_Promise_1300', 0, async function (done) {
let caseName = 'Telephony_CallManager_IMS_setCallTransfer_Promise_1300';
try {
let data = await call.setCallTransfer(SLOT_ID_INVALID, {
settingType:CALL_TRANSFER_DISABLE,
type:TRANSFER_TYPE_UNCONDITIONAL,
transferNum:PHONE_NUMBER_AREA_LAND
});
console.log(`${caseName} case failed,data:${toString(data)}`);
expect().assertFail();
} catch (err) {
console.log(`${caseName} case success, err:${toString(err)}`);
}
done();
});
/**
* @tc.number Telephony_CallManager_IMS_getCallTransferInfo_Async_1500
* @tc.name Run function getCallTransferInfo by args slotId SLOT_ID_INVALID,
* type TRANSFER_TYPE_UNCONDITIONAL by callback,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_getCallTransferInfo_Async_1500', 0, async function (done) {
let caseName = 'Telephony_CallManager_IMS_getCallTransferInfo_Async_1500';
call.getCallTransferInfo(SLOT_ID_INVALID, TRANSFER_TYPE_UNCONDITIONAL, (error, data) => {
if (error) {
console.log(`${caseName} getCallTransferInfo error, case success. error:${toString(error)}`);
done();
return;
}
console.log(`${caseName} getCallTransferInfo success,case failed,data:${toString(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_getCallTransferInfo_Promise_1500
* @tc.name Run function getCallTransferInfo by args slotId SLOT_ID_INVALID,
* type TRANSFER_TYPE_NOT_REACHABLE by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_getCallTransferInfo_Promise_1500', 0, async function (done) {
let caseName = 'Telephony_CallManager_IMS_getCallTransferInfo_Promise_1500';
try {
var data = await call.getCallTransferInfo(SLOT_ID_INVALID, TRANSFER_TYPE_NOT_REACHABLE);
console.log(`${caseName} case failed,data:${toString(data)}`);
expect().assertFail();
} catch (err) {
console.log(`${caseName} case success. error:${toString(err)}`);
}
done();
});
/**
* @tc.number Telephony_CallManager_IMS_setCallWaiting_Async_0700
* @tc.name Run the function setCallWaiting by args slotId SLOT_ID_INVALID activate true by callback to open,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_setCallWaiting_Async_0700', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_setCallWaiting_Async_0700';
call.setCallWaiting(SLOT_ID_INVALID, true, (error, data) => {
if (error) {
console.log(`${caseName} setCallWaiting error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} setCallWaiting success,case failed,data:${toString(data)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_setCallWaiting_Promise_0700
* @tc.name Run the function setCallWaiting by args slotId SLOT_ID_INVALID activate true by promise to open,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_setCallWaiting_Promise_0700', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_setCallWaiting_Promise_0700';
call.setCallWaiting(SLOT_ID_INVALID, true).then(data => {
expect().assertFail();
console.log(`${caseName} setCallWaiting success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} setCallWaiting error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_setCallRestriction_Async_1200
* @tc.name Run function setCallRestriction by callback
* by arg slotId SLOT_ID_INVALID type RESTRICTION_TYPE_ALL_INCOMING password RIGHT_PASSWORD
* mode RESTRICTION_MODE_ACTIVATION,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_setCallRestriction_Async_1200', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_setCallRestriction_Async_1200';
call.setCallRestriction(SLOT_ID_INVALID, {
type:RESTRICTION_TYPE_ALL_INCOMING,
password:RIGHT_PASSWORD,
mode:RESTRICTION_MODE_ACTIVATION
}, (error, data) => {
if (error) {
console.log(`${caseName} success,case ${error ? 'success' : 'failed'},error:${toString(error)}`);
expect(!!error).assertTrue();
done();
return;
}
console.log(`${caseName} error,case failed,data:${toString(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_setCallRestriction_Promise_1200
* @tc.name Run function setCallRestriction by promise
* by arg slotId SLOT_ID_INVALID type RESTRICTION_TYPE_ALL_INCOMING password RIGHT_PASSWORD
* mode RESTRICTION_MODE_ACTIVATION,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_setCallRestriction_Promise_1200', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_setCallRestriction_Promise_1200';
call.setCallRestriction(SLOT_ID_INVALID, {
type:RESTRICTION_TYPE_ALL_INCOMING,
password:RIGHT_PASSWORD,
mode:RESTRICTION_MODE_ACTIVATION
})
.then(data => {
console.log(`${caseName} error,case failed,data:${toString(data)}`);
expect().assertFail();
done();
})
.catch((error) => {
console.log(`${caseName} success,case ${error ? 'success' : 'failed'},error:${toString(error)}`);
expect(!!error).assertTrue();
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_getCallRestrictionStatus_Async_1100
* @tc.name Run function getCallRestrictionStatus by callback by arg slotId
* that is SLOT_ID_INVALID CallRestrictionType RESTRICTION_TYPE_ROAMING_INCOMING ,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_getCallRestrictionStatus_Async_1100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_getCallRestrictionStatus_Async_1100';
call.getCallRestrictionStatus(SLOT_ID_INVALID, RESTRICTION_TYPE_ROAMING_INCOMING, (error, data) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
return;
}
console.log(`${caseName} success,case faild,data:${toString(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_getCallRestrictionStatus_Promise_1100
* @tc.name Run function getCallRestrictionStatus by promise by arg slotId (that is at SLOT_ID_INVALID)
* CallRestrictionType RESTRICTION_TYPE_ROAMING_INCOMING ,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_getCallRestrictionStatus_Promise_1100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_getCallRestrictionStatus_Promise_1100';
call.getCallRestrictionStatus(SLOT_ID_INVALID, RESTRICTION_TYPE_ROAMING_INCOMING)
.then(data => {
console.log(`${caseName} success,case failed,data:${toString(data)}`);
expect().assertFail();
done();
})
.catch(error => {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_getCallWaitingStatus_Async_0500
* @tc.name Run the function getCallWaitingStatus by args slotId SLOT_ID_INVALID by callback,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_getCallWaitingStatus_Async_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_getCallWaitingStatus_Async_0500';
call.getCallWaitingStatus(SLOT_ID_INVALID, (error, data) => {
if (error) {
console.log(`${caseName} getCallWaitingStatus error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} getCallWaitingStatus success,case failed,data:${toString(data)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_getCallWaitingStatus_Promise_0500
* @tc.name Run the function getCallWaitingStatus by args slotId SLOT_ID_INVALID by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_getCallWaitingStatus_Promise_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_getCallWaitingStatus_Promise_0500';
call.getCallWaitingStatus(SLOT_ID_INVALID).then(data => {
expect().assertFail();
console.log(`${caseName} getCallWaitingStatus success,case failed,data:${toString(data)}`);
done();
}).catch(error => {
console.log(`${caseName} getCallWaitingStatus error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_controlCamera_Async_0200
* @tc.name Dial a call and after answering the call,run function controlCamera by
* args cameraId CARMER_ID_NOT_EXIT by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_controlCamera_Async_0200', 0, function (done) {
let caseName = 'Telephony_CallManager_controlCamera_Async_0200';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER2,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
let cameraId = CARMER_ID_NOT_EXIT;
call.controlCamera(cameraId, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} case failed`);
expect().assertFail();
hangupCall2(caseName, done, callId);
});
}).catch(error => {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_controlCamera_Promise_0200
* @tc.name Dial a call and after answering the call,run function controlCamera by args cameraId
* CARMER_ID_NOT_EXIT by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_controlCamera_Promise_0200', 0, async function (done) {
let caseName = 'Telephony_CallManager_controlCamera_Promise_0200';
let cameraId = CARMER_ID_NOT_EXIT;
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER2,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
await call.controlCamera(cameraId);
console.log(`${caseName} case failed`);
expect().assertFail();
} catch (err) {
console.log(`${caseName} case success. error:${toString(err)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_setPreviewWindow_Async_0300
* @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
* x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setPreviewWindow_Async_0300', 0, function (done) {
let caseName = 'Telephony_CallManager_setPreviewWindow_Async_0300';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
call.setPreviewWindow(info, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} case faild`);
expect().assertFail();
hangupCall2(caseName, done, callId);
});
}).catch(error => {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_setPreviewWindow_Promise_0300
* @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
* x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setPreviewWindow_Promise_0300', 0, async function (done) {
let caseName = 'Telephony_CallManager_setPreviewWindow_Promise_0300';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
await call.setPreviewWindow(info);
console.log(`${caseName} case faild`);
expect().assertFail();
} catch (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_setDisplayWindow_Async_0300
* @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
* x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setDisplayWindow_Async_0300', 0, async function (done) {
let caseName = 'Telephony_CallManager_setDisplayWindow_Async_0300';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
await call.setDisplayWindow(info);
console.log(`${caseName} case faild`);
expect().assertFail();
} catch (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_setDisplayWindow_Promise_0300
* @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
* x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setDisplayWindow_Promise_0300', 0, async function (done) {
let caseName = 'Telephony_CallManager_setDisplayWindow_Promise_0300';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
await call.setDisplayWindow(info);
console.log(`${caseName} case faild`);
expect().assertFail();
} catch (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_setCameraZoom_Async_0400
* @tc.name Dial a call and after answering the call,run function setCameraZoom by args
* zoomRatio ZOOM_RATIO_MINUS_1_0 by callback,the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setCameraZoom_Async_0400', 0, function (done) {
let caseName = 'Telephony_CallManager_setCameraZoom_Async_0400';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER2,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
call.setCameraZoom(ZOOM_RATIO_MINUS_1_0, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} case failed`);
expect().assertFail();
hangupCall2(caseName, done, callId);
});
}).catch(error => {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_setCameraZoom_Promise_0400
* @tc.name Dial a call and after answering the call,run function setCameraZoom by args
* zoomRatio ZOOM_RATIO_MINUS_1_0 by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setCameraZoom_Promise_0400', 0, async function (done) {
let caseName = 'Telephony_CallManager_setCameraZoom_Promise_0400';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
await call.setCameraZoom(ZOOM_RATIO_MINUS_1_0);
console.log(`${caseName} case failed`);
expect().assertFail();
} catch (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_setPausePicture_Async_0500
* @tc.name Dial a call and after answering the call,run function setPausePicture by args
* path IMAGE_LOCAL_ERROR_PATH by callback,the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setPausePicture_Async_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_setPausePicture_Async_0500';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
call.setPausePicture(IMAGE_LOCAL_ERROR_PATH, (error) => {
if (error) {
console.log(`${caseName} case success,error:${toString(error)}`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} success,case failed`);
hangupCall2(caseName, done, callId);
});
}).catch(error => {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_setPausePicture_Promise_0500
* @tc.name Dial a call and after answering the call,run function setPausePicture
* by args path IMAGE_LOCAL_ERROR_PATH by promise,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setPausePicture_Promise_0500', 0, async function (done) {
let caseName = 'Telephony_CallManager_setPausePicture_Promise_0500';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
await call.setPausePicture(IMAGE_LOCAL_ERROR_PATH);
console.log(`${caseName} success,case failed`);
} catch (error) {
console.log(`${caseName} case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_setDeviceDirection_Async_0500
* @tc.name Dial a call and after answering the call,run function setDeviceDirection
* by args rotation ROTATION_MINUS_1 by callback,the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setDeviceDirection_Async_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_setDeviceDirection_Async_0500';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
call.setDeviceDirection(ROTATION_MINUS_1, (error) => {
if (error) {
console.log(`${caseName} success, case success`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} error,case failed,error:${toString(error)}`);
expect().assertFail();
hangupCall2(caseName, done, callId);
});
}).catch(error => {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_setDeviceDirection_Promise_0500
* @tc.name Dial a call and after answering the call,run function setDeviceDirection
* by args rotation ROTATION_MINUS_1 by promise,the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setDeviceDirection_Promise_0500', 0, async function (done) {
let caseName = 'Telephony_CallManager_setDeviceDirection_Promise_0500';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER2,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
try {
await call.setDeviceDirection(ROTATION_MINUS_1);
console.log(`${caseName} success,case error`);
expect().assertFail();
} catch (error) {
console.log(`${caseName} case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_IMS_dial_Async_0600
* @tc.name Dial a call by function dial by args phoneNumber NULL_PHONE_NUMBER options
* {accountId: DEFAULT_SLOT_ID, videoState: MEDIA_TYPE_VOICE, dialScene: DIAL_SCENCE_CALL_PRIVILEGED,
* dialType:DIAL_CARRIER_TYPE} by callback,the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_dial_Async_0600', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_dial_Async_0600';
let flag = true;
reachState(caseName, CALL_STATUS_DIALING, '', false).then(data => {
callId = data.callId;
console.log(`${caseName} reachState success,case failed,data:${toString(data)}`);
expect().assertFail();
hangupCall2(caseName, done, callId);
}).catch(error => {
console.log(`${caseName} reachState error,case ${flag ? 'success' : 'failed'},error:${toString(error)}`);
expect(flag).assertTrue();
done();
});
let obj = {accountId: DEFAULT_SLOT_ID, videoState: MEDIA_TYPE_VOICE,
dialScene: DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE};
call.dial(NULL_PHONE_NUMBER, obj, (error, data) => {
if (error) {
console.log(`${caseName} dial error,error:${toString(error)}`);
flag = true;
return;
}
flag = false;
});
});
/**
* @tc.number Telephony_CallManager_IMS_dial_Promise_0100
* @tc.name Dial a call by function dial by args phoneNumber PHONE_NUMBER_LONG by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_dial_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_dial_Promise_0100';
let flag = true;
reachState(caseName, CALL_STATUS_DIALING, '', false).then(data => {
callId = data.callId;
console.log(`${caseName} reachState success,case failed,data:${toString(data)}`);
expect().assertFail();
hangupCall2(caseName, done, callId);
}).catch(error => {
console.log(`${caseName} reachState error,case ${flag ? 'success' : 'failed'},error:${toString(error)}`);
expect(flag).assertTrue();
done();
});
call.dial(PHONE_NUMBER_LONG).then(data => {
flag = false;
}).catch(error => {
console.log(`${caseName} dial error,error:${toString(error)}`);
flag = true;
});
});
/**
* @tc.number Telephony_CallManager_IMS_answer_Async_0100
* @tc.name Run function answer by args callId BOUNDARY_NUMBER_INT by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_answer_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_answer_Async_0100';
call.answer(BOUNDARY_NUMBER_INT, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_answer_Promise_0100
* @tc.name Run function answer by args callId CALL_ID_NOT_EXIST by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_answer_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_answer_Promise_0100';
call.answer(CALL_ID_NOT_EXIST).then(() => {
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
}).catch(error => {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_reject_Async_0100
* @tc.name Run function reject by args callId BOUNDARY_NUMBER_INT by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_reject_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_reject_Async_0100';
call.reject(BOUNDARY_NUMBER_INT, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_reject_Promise_0100
* @tc.name Run function reject by args callId CALL_ID_NOT_EXIST by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_reject_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_reject_Promise_0100';
call.reject(CALL_ID_NOT_EXIST).then(() => {
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
}).catch(error => {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_reject_Promise_0400
* @tc.name Test the function runs 10 times, stability test
* @tc.desc Function test
*/
it('Telephony_CallManager_reject_Promise_0400', 0, async function (done) {
let caseName = 'Telephony_CallManager_reject_Promise_0400';
let callId = null;
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
try {
data = await call.reject(callId, new RejectMessageOptions(REJECT_MESSAGE_STR));
console.log(`${caseName} reject success,case failed,data:${toString(data)}`);
done();
} catch (err) {
console.log(`${caseName} reject error,case success,err:${toString(err)}`);
done();
}
} catch (error) {
console.log(`${caseName} scenceInCalling error,case failed,error:${toString(error)}`);
done();
}
});
/**
* @tc.number Telephony_CallManager_reject_Async_0400
* @tc.name Test the function runs 10 times, stability test
* @tc.desc Function test
*/
it('Telephony_CallManager_reject_Async_0400', 0, async function (done) {
let caseName = 'Telephony_CallManager_reject_Async_0400';
let callId = null;
it('Telephony_CallManager_setCameraZoom_Promise_0400', 0, async function (done) {
let caseName = 'Telephony_CallManager_setCameraZoom_Promise_0400';
try {
let data = await scenceInCalling({
caseName:caseName,
......@@ -1604,380 +609,138 @@ describe('CallManageImsCall', function () {
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
call.reject(callId, new RejectMessageOptions(REJECT_MESSAGE_NUM), (err, data) => {
if (err) {
console.log(`${caseName} reject error,case success,err:${toString(err)}`);
done();
return;
}
console.log(`${caseName} reject success,case failed,data:${toString(data)}`);
done();
});
} catch (error) {
console.log(`${caseName} scenceInCalling error,case failed,error:${toString(error)}`);
done();
}
});
/**
* @tc.number Telephony_CallManager_IMS_hangup_Async_0100
* @tc.name Run function hangup by args callId BOUNDARY_NUMBER_INT by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_hangup_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_hangup_Async_0100';
call.hangup(BOUNDARY_NUMBER_INT, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_hangup_Promise_0100
* @tc.name Run function hangup by args callId CALL_ID_NOT_EXIST by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_hangup_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_hangup_Promise_0100';
call.hangup(CALL_ID_NOT_EXIST).then(() => {
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
}).catch(error => {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_startDTMF_Async_1300
* @tc.name Run function startDTMF by args callId MINUS_VALUE character C by callback,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_startDTMF_Async_1300', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_startDTMF_Async_1300';
call.startDTMF(MINUS_VALUE, SENT_STRING_C, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_startDTMF_Promise_1300
* @tc.name Dial a call by function dial by args phoneNumber PHONE_NUMBER_LENGTH_11 when before being accepted,
* run function startDTMF by args callId BOUNDARY_NUMBER_INT character C by promise,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_startDTMF_Promise_1300', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_startDTMF_Promise_1300';
scenceInCalling({
caseName:caseName,
phoneNumber:PHONE_NUMBER_LENGTH_11,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
call.startDTMF(BOUNDARY_NUMBER_INT, SENT_STRING_C).then(data => {
console.log(`${caseName} success,case error,data:${toString(data)}`);
expect().assertFail();
hangupCall2(caseName, done, callId);
}).catch(error => {
console.log(`${caseName} case success`);
hangupCall2(caseName, done, callId);
});
}).catch(error => {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_stopDTMF_Async_0100
* @tc.name Run function stopDTMF by args callId CALL_ID_NOT_EXIST by callback,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_stopDTMF_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_stopDTMF_Async_0100';
call.stopDTMF(CALL_ID_NOT_EXIST, (error, data) => {
if (error) {
console.log(`${caseName} case success`);
done();
return;
}
console.log(`${caseName} success,case error,data:${toString(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_CallManager_IMS_stopDTMF_Promise_0100
* @tc.name Run function stopDTMF by args callId BOUNDARY_NUMBER_INT by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_stopDTMF_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_stopDTMF_Promise_0100';
call.stopDTMF(BOUNDARY_NUMBER_INT).then(data => {
console.log(`${caseName} success,case error,data:${toString(data)}`);
expect().assertFail();
done();
}).catch(error => {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_muteRinger_Async_0100
* @tc.name Unwanted state,run function muteRinger by callback,the function return void
* @tc.desc Function test
*/
it('Telephony_CallManager_muteRinger_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_muteRinger_Async_0100';
call.muteRinger((error, data) => {
if (error) {
console.log(`${caseName} error,case failed,error:${toString(error)}`);
expect().assertFail();
done();
return;
}
console.log(`${caseName} success,case success`);
done();
});
});
/**
* @tc.number Telephony_CallManager_muteRinger_Promise_0100
* @tc.name Unwanted state,run function muteRinger by promise,the function return void
* @tc.desc Function test
*/
it('Telephony_CallManager_muteRinger_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_muteRinger_Promise_0100';
call.muteRinger()
.then(data => {
console.log(`${caseName} success,case success`);
done();
})
.catch((error) => {
console.log(`${caseName} error,case failed,error:${toString(error)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_CallManager_setAudioDevice_Async_0500
* @tc.name Unwanted state,run function setAudioDevice by callback and by arg DEVICE_EARPIECE,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setAudioDevice_Async_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_setAudioDevice_Async_0500';
call.setAudioDevice(DEVICE_EARPIECE, (error, data) => {
if (error) {
console.log(`${caseName} success,case ${error ? 'success' : 'failed'},error:${toString(error)}`);
expect(!!error).assertTrue();
done();
return;
}
console.log(`${caseName} error,case failed,data:${toString(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_CallManager_setAudioDevice_Promise_0500
* @tc.name Unwanted state,run function setAudioDevice by promise and by arg DEVICE_EARPIECE,
* the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setAudioDevice_Promise_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_setAudioDevice_Promise_0500';
call.setAudioDevice(DEVICE_EARPIECE)
.then(data => {
console.log(`${caseName} error,case failed,data:${toString(data)}`);
try {
await call.setCameraZoom(ZOOM_RATIO_MINUS_1_0);
console.log(`${caseName} case failed`);
expect().assertFail();
done();
})
.catch(error => {
console.log(`${caseName} success,case ${error ? 'success' : 'failed'},error:${toString(error)}`);
expect(!!error).assertTrue();
done();
});
});
/**
* @tc.number Telephony_CallManager_setMuted_Async_0300
* @tc.name Unwanted state,run function setMuted by callback,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setMuted_Async_0300', 0, function (done) {
let caseName = 'Telephony_CallManager_setMuted_Async_0300';
call.setMuted((error, data) => {
if (error) {
} catch (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
expect(!!error).assertTrue();
done();
return;
}
console.log(`${caseName} success,case failed,data:${toString(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_CallManager_setMuted_Promise_0300
* @tc.name Unwanted state,run function setMuted by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_setMuted_Promise_0300', 0, function (done) {
let caseName = 'Telephony_CallManager_setMuted_Promise_0300';
call.setMuted()
.then(data => {
console.log(`${caseName} success,case failed,data:${toString(data)}`);
expect().assertFail();
done();
})
.catch(error => {
console.log(`${caseName} error,case success,error:${toString(error)}`);
expect(!!error).assertTrue();
done();
});
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_cancelMuted_Async_0300
* @tc.name Unwanted state,run function cancelMuted by callback,the function return error
* @tc.number Telephony_CallManager_setPausePicture_Async_0500
* @tc.name Dial a call and after answering the call,run function setPausePicture by args
* path IMAGE_LOCAL_ERROR_PATH by callback,the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_cancelMuted_Async_0300', 0, function (done) {
let caseName = 'Telephony_CallManager_cancelMuted_Async_0300';
call.cancelMuted((error, data) => {
it('Telephony_CallManager_setPausePicture_Async_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_setPausePicture_Async_0500';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
call.setPausePicture(IMAGE_LOCAL_ERROR_PATH, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
console.log(`${caseName} case success,error:${toString(error)}`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} success,case failed,data:${toString(data)}`);
expect().assertFail();
done();
});
console.log(`${caseName} success,case failed`);
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_cancelMuted_Promise_0300
* @tc.name Unwanted state,run function cancelMuted by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_cancelMuted_Promise_0300', 0, function (done) {
let caseName = 'Telephony_CallManager_cancelMuted_Promise_0300';
call.cancelMuted()
.then(data => {
console.log(`${caseName} success,case failed,data:${toString(data)}`);
expect().assertFail();
done();
})
.catch(error => {
console.log(`${caseName} error,case success,error:${toString(error)}`);
}).catch(error => {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_isNewCallAllowed_Async_0200
* @tc.name Unwanted state ,run the function isNewCallAllowed by callback ,the function return true
* @tc.number Telephony_CallManager_setPausePicture_Promise_0500
* @tc.name Dial a call and after answering the call,run function setPausePicture
* by args path IMAGE_LOCAL_ERROR_PATH by promise,
* the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_isNewCallAllowed_Async_0200', 0, function (done) {
let caseName = 'Telephony_CallManager_isNewCallAllowed_Async_0200';
call.isNewCallAllowed(function (error, data) {
if (error) {
console.log(`${caseName} error,case failed,error:${toString(error)}`);
expect().assertFail();
it('Telephony_CallManager_setPausePicture_Promise_0500', 0, async function (done) {
let caseName = 'Telephony_CallManager_setPausePicture_Promise_0500';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
console.log(`${caseName} success,case ${data === true ? 'success' : 'failed'},data:${toString(data)}`);
expect(data === true).assertTrue();
done();
});
try {
await call.setPausePicture(IMAGE_LOCAL_ERROR_PATH);
console.log(`${caseName} success,case failed`);
} catch (error) {
console.log(`${caseName} case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
* @tc.number Telephony_CallManager_isNewCallAllowed_Promise_0200
* @tc.name Unwanted state ,run the function isNewCallAllowed by promise ,the function return true
* @tc.number Telephony_CallManager_setDeviceDirection_Async_0500
* @tc.name Dial a call and after answering the call,run function setDeviceDirection
* by args rotation ROTATION_MINUS_1 by callback,the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_isNewCallAllowed_Promise_0200', 0, function (done) {
let caseName = 'Telephony_CallManager_isNewCallAllowed_Promise_0200';
call.isNewCallAllowed()
.then(data => {
console.log(`${caseName} success,case ${data === true ? 'success' : 'failed'},data:${toString(data)}`);
expect(data === true).assertTrue();
done();
})
.catch(error => {
it('Telephony_CallManager_setDeviceDirection_Async_0500', 0, function (done) {
let caseName = 'Telephony_CallManager_setDeviceDirection_Async_0500';
scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
}).then(data => {
callId = data.callId;
call.setDeviceDirection(ROTATION_MINUS_1, (error) => {
if (error) {
console.log(`${caseName} success, case success`);
hangupCall2(caseName, done, callId);
return;
}
console.log(`${caseName} error,case failed,error:${toString(error)}`);
expect().assertFail();
hangupCall2(caseName, done, callId);
});
}).catch(error => {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_isRinging_Async_0100
* @tc.name Unwanted state ,run the function isRinging by callback ,the function return false
* @tc.number Telephony_CallManager_setDeviceDirection_Promise_0500
* @tc.name Dial a call and after answering the call,run function setDeviceDirection
* by args rotation ROTATION_MINUS_1 by promise,the callback function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_isRinging_Async_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_isRinging_Async_0100';
call.isRinging(function (error, data) {
if (error) {
console.log(`${caseName} error,case failed,error:${toString(error)}`);
expect().assertFail();
it('Telephony_CallManager_setDeviceDirection_Promise_0500', 0, async function (done) {
let caseName = 'Telephony_CallManager_setDeviceDirection_Promise_0500';
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER2,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
} catch (error) {
console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
done();
return;
}
console.log(`${caseName} success,case ${data === false ? 'success' : 'failed'},data:${toString(data)}`);
expect(data === false).assertTrue();
done();
});
});
/**
* @tc.number Telephony_CallManager_isRinging_Promise_0100
* @tc.name Unwanted state ,run the function isRinging by promise ,the function return false
* @tc.desc Function test
*/
it('Telephony_CallManager_isRinging_Promise_0100', 0, function (done) {
let caseName = 'Telephony_CallManager_isRinging_Promise_0100';
call.isRinging()
.then(data => {
console.log(`${caseName} success,case ${data === false ? 'success' : 'failed'},data:${toString(data)}`);
expect(data === false).assertTrue();
done();
})
.catch(error => {
console.log(`${caseName} error,case failed,error:${toString(error)}`);
try {
await call.setDeviceDirection(ROTATION_MINUS_1);
console.log(`${caseName} success,case error`);
expect().assertFail();
done();
});
} catch (error) {
console.log(`${caseName} case success,error:${toString(error)}`);
}
hangupCall2(caseName, done, callId);
});
/**
......@@ -2058,120 +821,6 @@ describe('CallManageImsCall', function () {
}
});
/**
* @tc.number Telephony_CallManager_getSubCallIdList_Async_0100
* @tc.name If callId is 999, call getSubCallIdList() to get the call list of subcalls and return the empty list
* @tc.desc Function test
*/
it('Telephony_CallManager_getSubCallIdList_Async_0100', 0, async function (done) {
call.getSubCallIdList(CALL_ID_NOT_EXIST, (err, data) => {
if (err) {
expect().assertFail();
console.log('Telephony_CallManager_getSubCallIdList_Async_0100 fail');
done();
return;
}
expect(data.length === 0).assertTrue();
console.log(`Telephony_CallManager_getSubCallIdList_Async_0100 finish data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_getSubCallIdList_Promise_0100
* @tc.name If callId is 999, call getSubCallIdList() to get the sub-call list
* @tc.desc Function test
*/
it('Telephony_CallManager_getSubCallIdList_Promise_0100', 0, async function (done) {
try {
var data = await call.getSubCallIdList(CALL_ID_NOT_EXIST);
expect(data.length === 0).assertTrue();
console.log(`Telephony_CallManager_getSubCallIdList_Promise_0100 finish data = ${data}`);
done();
} catch (err) {
console.log('Telephony_CallManager_getSubCallIdList_Promise_0100 fail');
expect().assertFail();
done();
}
});
/**
* @tc.number Telephony_CallManager_getCallIdListForConference_Async_0100
* @tc.name CallId for 999, the callback call getCallIdListForConference () to obtain a list all the phone call
* in the conference call, returns an empty list
* @tc.desc Function test
*/
it('Telephony_CallManager_getCallIdListForConference_Async_0100', 0, async function (done) {
call.getCallIdListForConference(CALL_ID_NOT_EXIST, (err, data) => {
if (err) {
console.log('Telephony_CallManager_getCallIdListForConference_Async_0100 fail');
expect().assertFail();
done();
return;
}
expect(data.length === 0).assertTrue();
console.log(`Telephony_CallManager_getCallIdListForConference_Async_0100 finish data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_getCallIdListForConference_Promise_0100
* @tc.name GetCallIdListForConference callId for 999, call () to obtain a list all the phone call in the
* conference call, returns an empty list
* @tc.desc Function test
*/
it('Telephony_CallManager_getCallIdListForConference_Promise_0100', 0, async function (done) {
try {
var data = await call.getCallIdListForConference(CALL_ID_NOT_EXIST);
expect(data.length === 0).assertTrue();
console.log(`Telephony_CallManager_getCallIdListForConference_Promise_0100 finish data = ${data}`);
done();
} catch (err) {
console.log('Telephony_CallManager_getCallIdListForConference_Promise_0100 fail');
done();
}
});
/**
* @tc.number Telephony_CallManager_getMainCallId_Async_0100
* @tc.name If the mainCallId is 999, call getMainCallId() to get the call and return -1
* @tc.desc Function test
*/
it('Telephony_CallManager_getMainCallId_Async_0100', 0, async function (done) {
call.getMainCallId(CALL_ID_NOT_EXIST, (err, data) => {
if (err) {
expect().assertFail();
console.log('Telephony_CallManager_getMainCallId_Async_0100 fail');
done();
return;
}
expect(data === GETMAIN_CALLID_ERRO).assertTrue();
console.log(`Telephony_CallManager_getMainCallId_Async_0100 finish data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_getMainCallId_Promise_0100
* @tc.name If mainCallId is 999, call getMainCallId() to get the call and return -1
* @tc.desc Function test
*/
it('Telephony_CallManager_getMainCallId_Promise_0100', 0, async function (done) {
try {
var data = await call.getMainCallId(CALL_ID_NOT_EXIST);
expect(data === GETMAIN_CALLID_ERRO).assertTrue();
console.log(`Telephony_CallManager_getMainCallId_Promise_0100 finish data = ${data}`);
done();
} catch (err) {
expect().assertFail();
console.log(`Telephony_CallManager_getMainCallId_Promise_0100 finish data = ${data}`);
done();
}
});
/**
* @tc.number Telephony_CallManager_formatPhoneNumber_Async_0100
* @tc.name PhoneNumber is 100000000000. Call formatPhoneNumber() to format the number.
......@@ -2293,157 +942,4 @@ describe('CallManageImsCall', function () {
done();
}
});
/**
* @tc.number Telephony_CallManager_isInEmergencyCall_Async_0200
* @tc.name Dial an emergency number (THE_THREE_NUMBER) and call isInEmergencyCall() to determine whether
* an emergency call is made, returning true
* @tc.desc Function test
*/
it('Telephony_CallManager_isInEmergencyCall_Async_0200', 0, async function (done) {
const options = {accountId:SLOTID, videoState:MEDIA_TYPE_VOICE, dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
dialType:DIAL_CARRIER_TYPE};
call.dial(THE_THREE_NUMBER, options, async (err, data) => {
if (err) {
console.log(`Telephony_CallManager_isInEmergencyCall_Async_0200 dial fail : err = ${err}`);
done();
return;
}
console.log(`Telephony_CallManager_isInEmergencyCall_Async_0200 dial finish : data = ${data}`);
const startTime = new Date().getTime();
while (true) {
if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE ||
callState === call.CALL_STATUS_ALERTING) {
call.isInEmergencyCall((err, data) => {
if (err) {
console.log(
`Telephony_CallManager_isInEmergencyCall_Async_0200 isInEmrgencyCall fail : err = ${
err}`
);
done();
return;
}
console.log(
`Telephony_CallManager_isInEmergencyCall_Async_0200 isInEmrgencyCall finish : data = ${
data}`
);
done();
});
return;
}
await sleep(WAITING_TIME);
endTime = new Date().getTime();
timing = endTime - startTime;
if (timing > TIME_OUT) {
done();
break;
}
}
});
});
/**
* @tc.number Telephony_CallManager_isInEmergencyCall_Promise_0200
* @tc.name Dial an emergency number (THE_THREE_NUMBER) and call isInEmergencyCall() to determine whether
* an emergency call is made. The return value is true
* @tc.desc Function test
*/
it('Telephony_CallManager_isInEmergencyCall_Promise_0200', 0, async function (done) {
try {
const options = {accountId:SLOTID, videoState:MEDIA_TYPE_VOICE, dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
dialType:DIAL_CARRIER_TYPE};
var data = await call.dial(THE_THREE_NUMBER, options);
console.log(`Telephony_CallManager_isInEmergencyCall_Promise_0200 dial finish : data = ${data}`);
const startTime = new Date().getTime();
while (true) {
if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE ||
callState === call.CALL_STATUS_ALERTING) {
try {
var data = await call.isInEmergencyCall();
console.log(`Telephony_CallManager_isInEmergencyCall_Promise_0200 finish : data = ${data}`);
done();
} catch (err) {
console.log(`Telephony_CallManager_isInEmergencyCall_Promise_0200 fail : err = ${err}`);
done();
return;
}
return;
}
await sleep(WAITING_TIME);
endTime = new Date().getTime();
timing = endTime - startTime;
if (timing > TIME_OUT) {
done();
break;
}
}
} catch (err) {
console.log(`Telephony_CallManager_isInEmergencyCall_Promise_0200 dial fail : err = ${err}`);
done();
}
});
/**
* @tc.number Telephony_CallManager_IMS_dial_Promise_0900
* @tc.name Dial a call by function dial by args phoneNumber PHONE_NUMBER_LENGTH_11 options
* {accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE, dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
* dialType:DIAL_TYPE_ERR_CALL} by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_dial_Promise_0900', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_dial_Promise_0900';
let flag = true;
reachState(caseName, CALL_STATUS_DIALING, '', false).then(data => {
callId = data.callId;
console.log(`${caseName} reachState success,case failed,data:${toString(data)}`);
hangupCall2(caseName, done, callId);
}).catch(error => {
console.log(`${caseName} reachState error,case ${flag ? 'success' : 'failed'},error:${toString(error)}`);
done();
});
let obj = {accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_TYPE_ERR_CALL};
call.dial(PHONE_NUMBER_LENGTH_11, obj).then(data => {
flag = false;
}).catch(error => {
console.log(`${caseName} dial error,error:${toString(error)}`);
flag = true;
});
});
/**
* @tc.number Telephony_CallManager_on_0900
* @tc.name Dial a call by number AUTO_ACCEPT_NUMBER options {accountId: DEFAULT_SLOT_ID,
* videoState: MEDIA_TYPE_VOICE,dialScene: DIAL_SCENCE_CALL_NORMAL, dialType:DIAL_TYPE_OTT}
* and before being accepted,the callEventChange event get EVENT_OTT_FUNCTION_UNSUPPORTED
* @tc.desc Function test
*/
it('Telephony_CallManager_on_0900', 0, function (done) {
let caseName = 'Telephony_CallManager_on_0900';
let callId = null;
reachCallEventState(EVENT_OTT_FUNCTION_UNSUPPORTED).then(data => {
console.log(`${caseName} reachCallEventState success,case ${
data.eventId === EVENT_OTT_FUNCTION_UNSUPPORTED ?
'success' : 'failed'},data:${toString(data)}`);
done();
}).catch(error => {
if (callId) {
console.log(`${caseName} reachCallEventState error,case failed,error:${toString(error)}`);
done();
} else {
console.log(`${caseName} scenceInCalling error,case failed,error:${toString(error)}`);
done();
}
});
let options = {accountId: DEFAULT_SLOT_ID, videoState: MEDIA_TYPE_VOICE,
dialScene: DIAL_SCENCE_CALL_NORMAL, dialType:DIAL_TYPE_OTT};
call.dial(AUTO_ACCEPT_NUMBER, options, (err, data) => {
if (err) {
console.log(`${caseName} dial err:${err}`);
return;
}
console.log(`${caseName} dial success data:${data}`);
});
});
});
\ No newline at end of file
......@@ -57,82 +57,6 @@ describe("ActsCellularDataAbnormalTest", function () {
})
})
/*
* @tc.number Telephony_CellularData_enableCellularData_Async_0100
* @tc.name Open the data switch and query the switch status and data status
* @tc.desc Function test
*/
it("Telephony_CellularData_enableCellularData_Async_0100", 0, async function (done) {
cellular.enableCellularData((err) => {
if (err) {
console.log("Telephony_CellularData_enableCellularData_Async_0100 enableCellularData finish");
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_enableCellularData_Async_0100 enableCellularData fail");
done();
})
})
/*
* @tc.number Telephony_CellularData_disableCellularData_Async_0100
* @tc.name Turn off the data switch and query the switch status and data status
* @tc.desc Function test
*/
it("Telephony_CellularData_disableCellularData_Async_0100", 0, async function (done) {
cellular.disableCellularData((err) => {
if (err) {
console.log("Telephony_CellularData_disableCellularData_Async_0100 disableCellularData finish");
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_disableCellularData_Async_0100 disableCellularData fail");
done();
})
})
/*
* @tc.number Telephony_CellularData_enableCellularDataRoaming_Async_0300
* @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3),
* to check the correction results
* @tc.desc Function test
*/
it("Telephony_CellularData_enableCellularDataRoaming_Async_0300", 0, async function (done) {
cellular.enableCellularDataRoaming(ERR_SLOT_ID, (err) => {
if (err) {
console.log("Telephony_CellularData_enableCellularDataRoaming_Async_0300 enableCellularData finish");
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_enableCellularDataRoaming_Async_0300 enableCellularData fail");
done();
})
})
/*
* @tc.number Telephony_CellularData_disableCellularDataRoaming_Async_0300
* @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3), to check the
* correction results
* @tc.desc Function test
*/
it("Telephony_CellularData_disableCellularDataRoaming_Async_0300", 0, async function (done) {
cellular.disableCellularDataRoaming(ERR_SLOT_ID, (err) => {
if (err) {
console.log(
"Telephony_CellularData_disableCellularDataRoaming_Async_0300 disableCellularDataRoaming finish"
);
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_disableCellularDataRoaming_Async_0300 disableCellularDataRoaming fail");
done();
})
})
/*
* @tc.number Telephony_CellularData_getCellularDataFlowType_Async_0100
* @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
......@@ -171,25 +95,6 @@ describe("ActsCellularDataAbnormalTest", function () {
})
})
/*
* @tc.number Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500
* @tc.name Call setDefaultCellularDataSlotId() interface, set the default card slot to the number of exceptions
* (-1), and verify whether the setting failed (Async)
* @tc.desc Function test
*/
it("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500", 0, async function (done) {
cellular.setDefaultCellularDataSlotId(ERR_SLOT_ID, (err) => {
if (err) {
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 finish");
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 fail");
done();
})
})
/*
* @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500
* @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
......@@ -244,76 +149,6 @@ describe("ActsCellularDataAbnormalTest", function () {
}
})
/*
* @tc.number Telephony_CellularData_enableCellularData_Promise_0100
* @tc.name Open the data switch and query the switch status and data status
* @tc.desc Function test
*/
it("Telephony_CellularData_enableCellularData_Promise_0100", 0, async function (done) {
try {
await cellular.enableCellularData();
expect().assertFail();
console.log("Telephony_CellularData_enableCellularData_Promise_0100 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_enableCellularData_Promise_0100 finish");
done();
}
})
/*
* @tc.number Telephony_CellularData_disableCellularData_Promise_0100
* @tc.name Turn off the data switch and query the switch status and data status
* @tc.desc Function test
*/
it("Telephony_CellularData_disableCellularData_Promise_0100", 0, async function (done) {
try {
await cellular.disableCellularData();
expect().assertFail();
console.log("Telephony_CellularData_disableCellularData_Promise_0100 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_disableCellularData_Promise_0100 finish");
done();
}
})
/*
* @tc.number Telephony_CellularData_enableCellularDataRoaming_Promise_0300
* @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3),
* to check the correction results
* @tc.desc Function test
*/
it("Telephony_CellularData_enableCellularDataRoaming_Promise_0300", 0, async function (done) {
try {
await cellular.enableCellularDataRoaming(ERR_SLOT_ID);
expect().assertFail();
console.log("Telephony_CellularData_enableCellularDataRoaming_Promise_0300 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_enableCellularDataRoaming_Promise_0300 finish");
done();
}
})
/*
* @tc.number Telephony_CellularData_disableCellularDataRoaming_Promise_0300
* @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3), to check the
* correction results
* @tc.desc Function test
*/
it("Telephony_CellularData_disableCellularDataRoaming_Promise_0300", 0, async function (done) {
try {
await cellular.disableCellularDataRoaming(ERR_SLOT_ID);
expect().assertFail();
console.log("Telephony_CellularData_disableCellularDataRoaming_Promise_0300 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_disableCellularDataRoaming_Promise_0300 finish");
done();
}
})
/*
* @tc.number Telephony_CellularData_getCellularDataFlowType_Promise_0100
* @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
......@@ -350,24 +185,6 @@ describe("ActsCellularDataAbnormalTest", function () {
}
})
/*
* @tc.number Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500
* @tc.name Call setDefaultCellularDataSlotId() interface, set the default card slot to the number of exceptions
* (-1), and verify whether the setting failed (Async)
* @tc.desc Function test
*/
it("Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500", 0, async function (done) {
try {
await cellular.setDefaultCellularDataSlotId(ERR_SLOT_ID);
expect().assertFail();
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500 finish");
done();
}
})
/*
* @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500
* @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
......
......@@ -116,13 +116,11 @@ export default function httpRequestJsunit() {
}
});
/**
* @tc.number Telephony_http_HttpRequest_destroy_0100
* @tc.name httprequest::destroy
* @tc.desc Test Test httprequest property.
*/
it("Telephony_http_HttpRequest_destroy_0100", 0, async function (done) {
var casename = "Telephony_http_HttpRequest_0200"
console.log("-----------------------HttpRequest_destroy Test is starting-----------------------");
......@@ -163,7 +161,6 @@ export default function httpRequestJsunit() {
* @tc.name httprequest::on_headerReceive
* @tc.desc Test Test httprequest property.
*/
it("Telephony_http_HttpRequest_on_headerReceive_0100", 0, async function (done) {
var casename = "Telephony_http_HttpRequest_0300"
console.log("-----------------------HttpRequest_on_headerReceive Test is starting-----------------------");
......
......@@ -55,8 +55,6 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_http_HttpRequestOptions_method_0200
* @tc.name HttpRequestOptions::method
......@@ -94,7 +92,6 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_extraData_0100
* @tc.name HttpRequestOptions::extraData
......@@ -137,8 +134,6 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_extraData_0200
* @tc.name HttpRequestOptions::extraData
......@@ -184,13 +179,11 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_header_0100
* @tc.name HttpRequestOptions::header
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_header_0100", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0300';
console.log("-----------------------HttpRequestOptions_header Test is starting-----------------------");
......@@ -232,7 +225,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::header
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_header_0200", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0300';
console.log("-----------------------HttpRequestOptions_header_01 Test is starting-----------------------");
......@@ -281,7 +273,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::header
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_header_0300", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0300';
console.log("-----------------------HttpRequestOptions_header_02 Test is starting-----------------------");
......@@ -323,7 +314,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::header
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_header_0400", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0300';
console.log("-----------------------HttpRequestOptions_header_03 Test is starting-----------------------");
......@@ -364,10 +354,6 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_readTimeout_0100
* @tc.name HttpRequestOptions::readTimeout
......@@ -408,7 +394,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::readTimeout
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_readTimeout_0200", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0400';
console.log("-----------------------HttpRequestOptions_readTimeout_01 Test is starting-----------------------");
......@@ -441,13 +426,11 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_connectTimeout_0100
* @tc.name HttpRequestOptions::connectTimeout
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_connectTimeout_0100", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0500';
console.log("-----------------------HttpRequestOptions_connectTimeout Test is starting-----------------------");
......@@ -483,7 +466,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::connectTimeout
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_connectTimeout_0200", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0500';
console.log("-----------------------HttpRequestOptions_connectTimeout_01 Test is starting-----------------------");
......
......@@ -331,16 +331,12 @@ export default function httpResponseJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpResponse_cookies_0100
* @tc.name HttpResponse::cookies
* @tc.desc Test Test HttpResponse property.
*/
it("Telephony_Http_HttpResponse_cookies_0100", 0, async function (done) {
var casename = 'Telephony_Http_HttpResponse_0400';
console.log("-----------------------HttpResponse cookies Test is starting-----------------------");
......@@ -378,7 +374,6 @@ export default function httpResponseJsunit() {
* @tc.desc Test Test HttpResponse property.
*/
it("Telephony_Http_HttpResponse_cookies_0200", 0, async function (done) {
var casename = 'Telephony_Http_HttpResponse_0400';
console.log("-----------------------HttpResponse cookies_01 Test is starting-----------------------");
......@@ -402,15 +397,12 @@ export default function httpResponseJsunit() {
});
/**
* @tc.number Telephony_Http_HttpResponse_cookies_0300
* @tc.name HttpResponse::cookies
* @tc.desc Test Test HttpResponse property.
*/
it("Telephony_Http_HttpResponse_cookies_0300", 0, async function (done) {
var casename = 'Telephony_Http_HttpResponse_0400';
console.log("-----------------------HttpResponse cookies_02 Test is starting-----------------------");
......
......@@ -417,11 +417,6 @@ export default function requestMethodJsunit() {
}
});
})
};
......
......@@ -544,7 +544,6 @@ export default function responseCodeJsunit() {
});
/**
* @tc.number Telephony_Http_ResponseCode_CONFLICT_0100
* @tc.name ResponseCode::CONFLICT
......@@ -564,8 +563,6 @@ export default function responseCodeJsunit() {
});
/**
* @tc.number Telephony_Http_ResponseCode_GONE_0100
* @tc.name ResponseCode::GONE
......
......@@ -407,80 +407,6 @@ export default function connectionJsunit() {
done();
});
/*
* @tc.number : Telephony_Connection_Connection_enableAirplaneMode_0100
* @tc.name : enableAirplaneMode
* @tc.desc : Enables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_enableAirplaneMode_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0100 Test start*************");
connection.enableAirplaneMode((error, data) => {
if (error) {
expect(true).assertTrue();
done();
return;
}
expect().assertFail();
done();
});
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0100 Test end*************");
done();
});
/*
* @tc.number : Telephony_Connection_Connection_enableAirplaneMode_0200
* @tc.name : enableAirplaneMode
* @tc.desc : Enables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_enableAirplaneMode_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0200 Test start*************");
connection.enableAirplaneMode().then(data => {
expect(true).assertTrue();
}).catch(err => {
expect().assertFail();
});
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0200 Test end*************");
done();
});
/*
* @tc.number : Telephony_Connection_Connection_disableAirplaneMode_0100
* @tc.name : disableAirplaneMode
* @tc.desc : Disables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_disableAirplaneMode_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_disableAirplaneMode_0100 Test start*************");
connection.disableAirplaneMode((error, data) => {
if (error) {
expect(true).assertTrue();
done();
return;
}
expect().assertFail();
done();
});
console.log("************* Telephony_Connection_Connection_disableAirplaneMode_0100 Test end*************");
done();
});
/*
* @tc.number : Telephony_Connection_Connection_disableAirplaneMode_0200
* @tc.name : disableAirplaneMode
* @tc.desc : Disables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_disableAirplaneMode_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetConnected_0200 Test start*************");
connection.disableAirplaneMode().then(data => {
expect(true).assertTrue();
}).catch(err => {
expect().assertFail();
});
console.log("************* Telephony_Connection_Connection_disableAirplaneMode_0200 Test end*************");
done();
});
/*
* @tc.number : Telephony_Connection_Connection_reportNetConnected_0100
* @tc.name : reportNetConnected
......
......@@ -16,13 +16,13 @@
//other import
import connectionJsunit from './ConnectionJsunit.test.ets';
import socketJsunit from './SocketJsunit.test.ets';
//import webSocketJsunit from './WebSocketJsunit.test.ets';
import webSocketJsunit from './WebSocketJsunit.test.ets';
import connectionSecondJsUnit from './ConnectionSecondJsUnit.test.ets';
export default function testsuite() {
//other
socketJsunit();
//webSocketJsunit();
webSocketJsunit();
connectionJsunit();
connectionSecondJsUnit();
}
\ No newline at end of file
......@@ -240,105 +240,9 @@ describe('ActsNetworkSearchTest', function () {
done();
});
/**
* @tc.number Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700
* @tc.name SlotId parameter input is -1, test setNetworkSelectionMode() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700', 0, async function (done) {
let networkSMode = {
slotId: 55, //set the error slot id is 55
selectMode: radio.NETWORK_SELECTION_AUTOMATIC,
networkInformation: {
operatorName: '',
operatorNumeric: '',
state: radio.NETWORK_AVAILABLE,
radioTech: radio.RADIO_TECHNOLOGY_GSM.toString(),
},
resumeSelection: false,
};
console.log(
`Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700 networkSMode:${JSON.stringify(networkSMode)}`)
radio.setNetworkSelectionMode(networkSMode, (err) => {
if (err) {
console.log('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700 set finish');
done();
return;
}
console.log('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700 set not go to err');
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0700
* @tc.name SlotId parameter input is -1, test setNetworkSelectionMode() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0700', 0, async function (done) {
let networkSMode = {
slotId: 55, //set the error slot id is 55
selectMode: radio.NETWORK_SELECTION_AUTOMATIC,
networkInformation: {
operatorName: '',
operatorNumeric: '',
state: radio.NETWORK_AVAILABLE,
radioTech: radio.RADIO_TECHNOLOGY_GSM.toString(),
},
resumeSelection: false,
};
console.log(
`Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0700 networkSMode:${JSON.stringify(networkSMode)}`)
try {
await radio.setNetworkSelectionMode(networkSMode);
console.log('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0200 set fail');
expect().assertFail();
done();
} catch (err) {
console.log('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0200 set finish');
done();
};
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkSearchInformation_Async_0400
* @tc.name SlotId parameter input is -1, test getNetworkSearchInformation() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0400', 0, async function (done) {
radio.getNetworkSearchInformation(SLOT_2, (err, data) => {
if (err) {
expect(data.isNetworkSearchSuccess != true).assertTrue();
expect(data.networkSearchResult != undefined).assertTrue();
console.log('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0400 finish');
done();
} else {
console.log('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0400 fail not go to err');
expect().assertFail();
}
});
done();
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkSearchInformation_Promise_0400
* @tc.name SlotId parameter input is -1, test getNetworkSearchInformation() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkSearchInformation_Promise_0400', 0, async function (done) {
try {
await radio.getNetworkSearchInformation(SLOT_2);
console.log('Telephony_NetworkSearch_getNetworkSearchInformation_Promise_0400 fail not go to err');
expect().assertFail();
done();
return;
} catch (err) {
console.log(`Telephony_NetworkSearch_getNetworkSearchInformation_Promise_0400 finish err: ${err}`);
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkState_Promise_0700
......@@ -433,390 +337,6 @@ describe('ActsNetworkSearchTest', function () {
}
})
/**
* @tc.number Telephony_NetworkSearch_getPreferredNetwork_Async_0700
* @tc.name Verify the abnormal input of "slotId", test getPreferredNetwork() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getPreferredNetwork_Async_0700', 0, async function (done) {
radio.getPreferredNetwork(SLOT_2, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getPreferredNetwork_Async_0700 get PASS err: ${err}`);
done();
return;
}
console.log(`Telephony_NetworkSearch_getPreferredNetwork_Async_0700 fail not into err data: ${data}`);
expect().assertFail();
done();
})
})
/**
* @tc.number Telephony_NetworkSearch_getPreferredNetwork_Promise_0700
* @tc.name Verify the abnormal input of "slotId", test getPreferredNetwork() to view the return result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getPreferredNetwork_Promise_0700', 0, async function (done) {
try {
let data = await radio.getPreferredNetwork(SLOT_2);
console.log(`Telephony_NetworkSearch_getPreferredNetwork_Promise_0700 fail data: ${data}`);
expect().assertFail();
done();
return;
} catch (err) {
console.log(`Telephony_NetworkSearch_getPreferredNetwork_Promise_0700 finish err: ${err}`);
done();
}
})
/**
* @tc.number Telephony_NetworkSearch_setPreferredNetwork_Async_0100
* @tc.name Verify the abnormal input of "preferredNetworkMode",
* test setPreferredNetwork() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_setPreferredNetwork_Async_0100', 0, async function (done) {
radio.setPreferredNetwork(SLOT_0, PREFERRED_MODE_ERR2, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0100 set err: ${err}`);
radio.getPreferredNetwork(SLOT_0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0100 get fail err: ${err}`);
done();
return;
}
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0100 finish data: ${data}`);
expect(data === radio.PREFERRED_NETWORK_MODE_AUTO).assertTrue();
done();
})
} else {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0100 fail err: ${data}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkSearch_setPreferredNetwork_Async_0600
* @tc.name Verify the "slotId" abnormal input, test setPreferredNetwork() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_setPreferredNetwork_Async_0600', 0, async function (done) {
radio.setPreferredNetwork(SLOT_2, radio.PREFERRED_NETWORK_MODE_GSM, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0600 finish err: ${err}`);
radio.getPreferredNetwork(SLOT_0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0600 get fail err: ${err}`);
done();
return;
}
console.log(
`Telephony_NetworkSearch_setPreferredNetwork_Async_0600 finish data: ${JSON.stringify(data)}`);
expect(data === radio.PREFERRED_NETWORK_MODE_AUTO).assertTrue();
done();
})
} else {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0600 fail: not go to err ${data}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkSearch_setPreferredNetwork_Promise_0100
* @tc.name Verify the abnormal input of "preferredNetworkMode",
* test setPreferredNetwork() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_setPreferredNetwork_Promise_0100', 0, async function (done) {
try {
await radio.setPreferredNetwork(SLOT_0, PREFERRED_MODE_ERR2);
console.log('Telephony_NetworkSearch_setPreferredNetwork_Promise_0100 set fail: not go to err');
expect().assertFail();
done();
} catch (err) {
try {
let data = await radio.getPreferredNetwork(SLOT_0);
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0100 finish data: ${data}`);
expect(data === radio.PREFERRED_NETWORK_MODE_AUTO).assertTrue();
done();
} catch (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0100 fail err: ${err}`);
done();
}
}
});
/**
* @tc.number Telephony_NetworkSearch_setPreferredNetwork_Promise_0600
* @tc.name Verify the abnormal input of "slotId", test setPreferredNetwork() return result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_setPreferredNetwork_Promise_0600', 0, async function (done) {
try {
await radio.setPreferredNetwork(SLOT_2, radio.PREFERRED_NETWORK_MODE_GSM);
console.log('Telephony_NetworkSearch_setPreferredNetwork_Promise_0600 set fail: not go to err');
expect().assertFail();
done();
} catch (err) {
try {
let data = await radio.getPreferredNetwork(SLOT_0);
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0600 finish data: ${data}`);
expect(data === radio.PREFERRED_NETWORK_MODE_AUTO).assertTrue();
done();
} catch (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0600 fail err: ${err}`);
done();
}
}
});
/**
* @tc.number Telephony_NetworkSearch_getCellInformation_Async_0500
* @tc.name Test getCellInformation() with anomalous soltId(-1) to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getCellInformation_Async_0500', 0, async function (done) {
radio.getCellInformation(SLOT_2, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getCellInformation_Async_0500 fail: ${err}`);
expect().assertFail();
done();
return;
}
console.log(`Telephony_NetworkSearch_getCellInformation_Async_0500 end data: ${JSON.stringify(data)}`);
expect(data !== '' && data != undefined && data != null).assertTrue();
expect(data.length).assertEqual(0);
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getCellInformation_Promise_0500
* @tc.name Test getCellInformation() with anomalous soltId(-1) to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getCellInformation_Promise_0500', 0, async function (done) {
radio.getCellInformation(SLOT_2).then(data => {
console.log(`Telephony_NetworkSearch_getCellInformation_Promise_0500 end data: ${JSON.stringify(data)}`);
expect(data !== '' && data != undefined && data != null).assertTrue();
expect(data.length).assertEqual(0);
done();
}).catch(err => {
console.log(`Telephony_NetworkSearch_getCellInformation_Promise_0500 fail: ${err}`);
expect().assertFail();
done();
})
});
/**
* @tc.number Telephony_NetworkSearch_sendUpdateCellLocationRequest_Async_0100
* @tc.name Test sendUpdateCellLocationRequest() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_sendUpdateCellLocationRequest_Async_0100', 0, async function (done) {
radio.sendUpdateCellLocationRequest((err) => {
if (err) {
console.log(`Telephony_NetworkSearch_sendUpdateCellLocationRequest_Async_0100 fail: ${err}`);
done();
return;
}
console.log(`Telephony_NetworkSearch_sendUpdateCellLocationRequest_Async_0100 success`)
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_sendUpdateCellLocationRequest_Promise_0100
* @tc.name Test sendUpdateCellLocationRequest() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_sendUpdateCellLocationRequest_Promise_0100', 0, async function (done) {
radio.sendUpdateCellLocationRequest().then(data => {
console.log(`Telephony_NetworkSearch_sendUpdateCellLocationRequest_Promise_0100 end data: ${data}`);
done();
}).catch(err => {
console.log(`Telephony_NetworkSearch_sendUpdateCellLocationRequest_Promise_0100 fail: ${err}`);
done();
})
});
/**
* @tc.number Telephony_NetworkSearch_getIMEI_Async_0500
* @tc.name Test getIMEI(-1) to check the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getIMEI_Async_0500', 0, async function (done) {
radio.getIMEI(SLOT_2, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getIMEI_Async_0500 fail: ${err}`);
expect().assertFail();
done();
return;
}
console.log(`Telephony_NetworkSearch_getIMEI_Async_0500 end data: ${data}`);
expect(data === '').assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getIMEI_Promise_0500
* @tc.name Test getIMEI(-1) to check the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getIMEI_Promise_0500', 0, async function (done) {
radio.getIMEI(SLOT_2).then(data => {
console.log(`Telephony_NetworkSearch_getIMEI_Promise_0500 end data: ${data}`);
expect(data === '').assertTrue();
done();
}).catch(err => {
console.log(`Telephony_NetworkSearch_getIMEI_Promise_0500 fail: ${err}`);
expect().assertFail();
done();
})
});
/**
* @tc.number Telephony_NetworkSearch_getUniqueDeviceId_Async_0500
* @tc.name Test getUniqueDeviceId(-1) to check the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getUniqueDeviceId_Async_0500', 0, async function (done) {
radio.getUniqueDeviceId(SLOT_2, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getUniqueDeviceId_Async_0500 fail: ${err}`);
expect().assertFail();
done();
return;
}
console.log(`Telephony_NetworkSearch_getUniqueDeviceId_Async_0500 end data: ${data}`);
expect(data === '').assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getUniqueDeviceId_Promise_0500
* @tc.name Test getUniqueDeviceId(-1) to check the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getUniqueDeviceId_Promise_0500', 0, async function (done) {
radio.getUniqueDeviceId(SLOT_2).then(data => {
console.log(`Telephony_NetworkSearch_getUniqueDeviceId_Promise_0500 end data: ${data}`);
expect(data === '').assertTrue();
done();
}).catch(err => {
console.log(`Telephony_NetworkSearch_getUniqueDeviceId_Promise_0500 fail: ${err}`);
expect().assertFail();
done();
})
});
/**
* @tc.number Telephony_NetworkSearch_getNrOptionMode_Async_0500
* @tc.name Test getNrOptionMode(-1) to check the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNrOptionMode_Async_0500', 0, async function (done) {
radio.getNrOptionMode(SLOT_2, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getNrOptionMode_Async_0500 get fail err: ${err}`);
expect().assertFail();
done();
return;
}
console.log(`Telephony_NetworkSearch_getNrOptionMode_Async_0500 end data: ${JSON.stringify(data)}`);
expect(data === radio.NR_OPTION_UNKNOWN).assertTrue();
done();
});
})
/**
* @tc.number Telephony_NetworkSearch_getNrOptionMode_Promise_0500
* @tc.name Test getNrOptionMode(-1) to check the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNrOptionMode_Promise_0500', 0, async function (done) {
radio.getNrOptionMode(SLOT_2).then(data => {
console.log(`Telephony_NetworkSearch_getNrOptionMode_Promise_0500 end data: ${data}`);
expect(data === radio.NR_OPTION_UNKNOWN).assertTrue();
done();
}).catch(err => {
console.log(`Telephony_NetworkSearch_getNrOptionMode_Promise_0500 fail: ${err}`);
expect().assertFail();
done();
})
});
/**
* @tc.number Telephony_NetworkSearch_turnOnRadio_Async_0200
* @tc.name Test The function turnOnRadio
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_turnOnRadio_Async_0200', 0, async function (done) {
radio.turnOnRadio((err) => {
if (err) {
console.log(`Telephony_NetworkSearch_turnOnRadio_Async_0200 turnOn fail: ${err}`);
done();
return;
}
console.log('Telephony_NetworkSearch_turnOnRadio_Async_0200 turnOn finish');
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_turnOnRadio_Promise_0200
* @tc.name Test The function turnOnRadio
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_turnOnRadio_Promise_0200', 0, async function (done) {
try {
await radio.turnOnRadio();
console.log('Telephony_NetworkSearch_turnOnRadio_Promise_0200 success');
done();
} catch (err) {
console.log(`Telephony_NetworkSearch_turnOnRadio_Promise_0200 fail ${err}`);
done();
}
});
/**
* @tc.number Telephony_NetworkSearch_turnOffRadio_Async_0200
* @tc.name Test The function turnOffRadio
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_turnOffRadio_Async_0200', 0, async function (done) {
radio.turnOffRadio((err) => {
if (err) {
console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0200 turnOff fail: ${err}`);
done();
return;
}
console.log('Telephony_NetworkSearch_turnOffRadio_Async_0200 turnOff finish');
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_turnOffRadio_Promise_0200
* @tc.name Test The function turnOffRadio
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_turnOffRadio_Promise_0200', 0, async function (done) {
try {
await radio.turnOffRadio();
console.log('Telephony_NetworkSearch_turnOffRadio_Promise_0200 success');
done();
} catch (err) {
console.log(`Telephony_NetworkSearch_turnOffRadio_Promise_0200 fail ${err}`);
done();
}
});
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0200
......
// @ts-nocheck
/**
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import sim from '@ohos.telephony.sim';
import * as env from './lib/Const.js';
import utils from './Utils.ets'
export default function simJsunit() {
describe('appInfoTest', function () {
console.log("************* sim Test start*************");
/**
* @tc.number Telephony_Sim_getOperatorConfigs_Async_0100
* @tc.name The slotId parameter is 0 and the OperatorConfig structure is not expected to be empty
* @tc.desc Function test
*/
it('Telephony_Sim_getOperatorConfigs_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
console.log('Telephony_Sim_getOperatorConfigs_Async_0100 start');
let containerIsEmpty = 0;
sim.getOperatorConfigs(env.DEFAULT_SLOTID, (err, data) => {
console.log('Telephony_Sim_getOperatorConfigs_Async_0100 result');
if (err) {
console.log(`Telephony_Sim_getOperatorConfigs_Async_0100 fail, err : ${err.message}`);
done();
return;
}
expect(Object.keys(data).length !== containerIsEmpty).assertTrue();
expect(data.field !== containerIsEmpty).assertTrue();
expect(data.value !== containerIsEmpty).assertTrue();
console.log('Telephony_Sim_getOperatorConfigs_Async_0100 finish');
done();
});
});
/**
* @tc.number Telephony_Sim_getSimAccountInfo_Async_0100
* @tc.name Get the return value by calling the GetSimAccountInfo interface SIM ID input parameter 0.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimAccountInfo_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
const CASE_NAME = 'Telephony_Sim_getSimAccountInfo_Async_0100';
let iccIdValue;
sim.getSimAccountInfo(env.DEFAULT_SLOTID, (err, info) => {
if (err) {
console.log(`${CASE_NAME} fail ,err : ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} getSimAccountInfo: ${JSON.stringify(info)}`);
expect(info.slotIndex === env.DEFAULT_SLOTID
&& info.isEsim === false
&& info.isActive === true
&& info.iccId === iccIdValue
&& info.showName === env.SIM_SLOT_NAME
&& info.showNumber === env.SIM_SLOT_NUMBER
&& info.simId === "simId"
).assertTrue();
console.log(`${CASE_NAME} finish`);
done();
});
});
/**
* @tc.number Telephony_Sim_unlockPin_Async_0100
* @tc.name Test the unlockPin interface when the card status is ready state.
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPin_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
let PIN = '1234';
sim.unlockPin(env.DEFAULT_SLOTID, PIN, (err, data) => {
if (err) {
console.log(`Telephony_Sim_unlockPin_Async_0100 fail, err: ${err.message}`);
done();
return;
}
expect(data.result === env.OTHER_ABNORMAL).assertTrue();
console.log('Telephony_Sim_unlockPin_Async_0100 finish');
done();
});
});
/**
* @tc.number Telephony_Sim_addIccDiallingNumbers_Async_0100
* @tc.name Test sim.addIccDiallingNumbers(soltId: -1, type: 1, diallingNumbers:
* {recordNumber: 1, alphaTag: 'test', number: '12345678', pin2: '123@#ABCD'},
* callback: AsyncCallback<void>) async callback interface, expect enter error.
* @tc.desc Function test
*/
const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
const GENERAL_CONTACT_INFO = Object.assign({}, { 'pin2': env.INCORRECT_PIN2 }, CONTACT_INFO);
it('Telephony_Sim_addIccDiallingNumbers_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
const CASE_NAME = 'Telephony_Sim_addIccDiallingNumbers_Async_0100';
var number = env.SLOTID_MINUS1;
sim.addIccDiallingNumbers(number,
sim.GENERAL_CONTACT,
GENERAL_CONTACT_INFO,
error => {
if (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} finish.`);
} else {
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
}
done();
});
});
/**
* @tc.number Telephony_Sim_SetLockState_Async_0100
* @tc.name Test the SetLockState async callback interface to open the PIN lock and check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_SetLockState_Async_0100', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_SetLockState_Async_0100';
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
const lockInfo = { lockType: sim.PIN_LOCK, state: sim.LOCK_ON, password: env.CORRECT_PIN };
await setPinLockState(sim.LOCK_OFF);
sim.setLockState(env.DEFAULT_SLOTID, lockInfo, (error, lockStatusResponse) => {
if (error) {
console.log(`${CASE_NAME} setLockState error: ${error.message}`);
expect().assertFail();
done();
return;
}
if (lockStatusResponse.result !== env.LOCK_RESULT.SUCCESS) {
console.log(`${CASE_NAME} setLockState failure, lock status response: ${lockStatusResponse.result}`);
expect().assertFail();
done();
return;
}
});
});
console.log("************* sim Test end*************");
})
}
// @ts-nocheck
/**
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import mms from '@ohos.telephony.sms';
import utils from './Utils.ets'
export default function smsUiJsunit() {
describe('appInfoTest', function () {
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0100
* @tc.name SendReq type MMS, encoding after decoding, the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
let mmsType = {
"from": {
address: '+861381234****/TYPE=PLMN', charset: mms.UTF_8
},
to: [{
address: '+861388888****/TYPE=PLMN', charset: mms.UTF_8
}],
transactionId: '2077.1427358451410',
version: mms.MMS_VERSION_1_2,
date: 1639378126,
cc: [{
address: "+861381111****/TYPE=PLMN", charset: mms.UTF_8
}],
bcc: [{
address: "+861382222****/TYPE=PLMN", charset: mms.UTF_8
}],
subject: "Test mms",
messageClass: 130,
expiry: 1639378126,
priority: mms.MMS_LOW,
senderVisibility: 129,
deliveryReport: 128,
readReport: 129,
contentType: "application/vnd.wap.multipart.related",
};
let attachment = [
{
path: '/data/telephony/enSrc/content.text',
fileName: 'content.text',
contentId: '<content.text>',
contentLocation: 'content.text',
contentDisposition: mms.FROM_DATA,
contentTransferEncoding: 'base64',
contentType: 'text/plain',
isSmil: false,
inBuff: [],
charset: mms.UTF_8
},
{
path: '/data/telephony/enSrc/618C0A89.smil',
fileName: '618C0A89.smil',
contentId: '<0000>',
contentLocation: '618C0A89.smil',
contentDisposition: mms.ATTACHMENT,
contentTransferEncoding: 'base64',
contentType: 'application/smil',
isSmil: true,
inBuff: [],
charset: mms.UTF_8
},
{
path: '/data/telephony/enSrc/picture.gif',
fileName: 'picture.gif',
contentId: '<picture.gif>',
contentLocation: 'picture.gif',
contentDisposition: mms.INLINE,
contentTransferEncoding: 'base64',
contentType: 'image/gif',
isSmil: false,
inBuff: [],
charset: mms.UTF_8
}];
mms.encodeMms({
messageType: mms.TYPE_MMS_SEND_REQ, mmsType, attachment
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0100 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0100 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0100 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_SEND_REQ).assertTrue();
expect(data.mmsType.from.address === '+861381234****/TYPE=PLMN').assertTrue();
expect(data.mmsType.from.charset === mms.UTF_8).assertTrue();
expect(data.mmsType.to.length > 0).assertTrue();
expect(data.mmsType.to[0].address === '+861388888****/TYPE=PLMN').assertTrue();
expect(data.mmsType.to[0].charset === mms.UTF_8).assertTrue();
expect(data.mmsType.transactionId === '2077.1427358451410').assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_2).assertTrue();
expect(data.mmsType.date > 0).assertTrue();
expect(data.mmsType.cc.length > 0).assertTrue();
expect(data.mmsType.cc[0].address === '+861381111****/TYPE=PLMN').assertTrue();
expect(data.mmsType.cc[0].charset === mms.UTF_8).assertTrue();
expect(data.mmsType.bcc.length > 0).assertTrue();
expect(data.mmsType.bcc[0].address === '+861382222****/TYPE=PLMN').assertTrue();
expect(data.mmsType.bcc[0].charset === mms.UTF_8).assertTrue();
expect(data.mmsType.subject === 'Test mms').assertTrue();
expect(data.mmsType.messageClass === 130).assertTrue();
expect(data.mmsType.expiry !== 0).assertTrue();
expect(data.mmsType.priority === mms.MMS_LOW).assertTrue();
expect(data.mmsType.senderVisibility === 129).assertTrue();
expect(data.mmsType.deliveryReport === 128).assertTrue();
expect(data.mmsType.readReport === 129).assertTrue();
expect(data.mmsType.contentType === 'application/vnd.wap.multipart.related').assertTrue();
if (data.attachment != null) {
expect(data.attachment.length > 0).assertTrue();
expect(data.attachment[0].path === '').assertTrue();
expect(data.attachment[0].fileName === '618C0A89.smil').assertTrue();
expect(data.attachment[0].contentId === '<0000>').assertTrue();
expect(data.attachment[0].contentLocation === '618C0A89.smil').assertTrue();
expect(data.attachment[0].contentDisposition === mms.ATTACHMENT).assertTrue();
expect(data.attachment[0].contentTransferEncoding === 'base64').assertTrue();
expect(data.attachment[0].contentType === 'application/smil').assertTrue();
expect(data.attachment[0].isSmil).assertTrue();
expect(data.attachment[0].inBuff.length > 0).assertTrue();
expect(data.attachment[0].charset === mms.UTF_8).assertTrue();
expect(data.attachment[1].path === '').assertTrue();
expect(data.attachment[1].fileName === 'content.text').assertTrue();
expect(data.attachment[1].contentId === '<content.text>').assertTrue();
expect(data.attachment[1].contentLocation === 'content.text').assertTrue();
expect(data.attachment[1].contentDisposition === mms.FROM_DATA).assertTrue();
expect(data.attachment[1].contentTransferEncoding === 'base64').assertTrue();
expect(data.attachment[1].contentType === 'text/plain').assertTrue();
expect(data.attachment[1].isSmil).assertFalse();
expect(data.attachment[1].inBuff.length > 0).assertTrue();
expect(data.attachment[1].charset === mms.UTF_8).assertTrue();
expect(data.attachment[2].path === '').assertTrue();
expect(data.attachment[2].fileName === 'picture.gif').assertTrue();
expect(data.attachment[2].contentId === '<picture.gif>').assertTrue();
expect(data.attachment[2].contentLocation === 'picture.gif').assertTrue();
expect(data.attachment[2].contentDisposition === mms.INLINE).assertTrue();
expect(data.attachment[2].contentTransferEncoding === 'base64').assertTrue();
expect(data.attachment[2].contentType === 'image/gif').assertTrue();
expect(data.attachment[2].isSmil).assertFalse();
expect(data.attachment[2].inBuff.length > 0).assertTrue();
expect(data.attachment[2].charset === mms.UTF_8).assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0100 finish');
}
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0200
* @tc.name SendConf type MMS, encoding after decoding, the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0200', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
let mmsType = {
responseState: 128,
transactionId: '2077.1427358451410',
version: mms.MMS_VERSION_1_1,
messageId: '0001',
};
mms.encodeMms({
messageType: mms.TYPE_MMS_SEND_CONF, mmsType
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0200 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0200 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0200 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_SEND_CONF).assertTrue();
expect(data.mmsType.responseState === 128).assertTrue();
expect(data.mmsType.transactionId === '2077.1427358451410').assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_1).assertTrue();
expect(data.mmsType.messageId === '0001').assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0200 finish');
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0300
* @tc.name NotificationInd type MMS, encoding after decoding,
* the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0300', 0, async function (done) {
let mmsType = {
transactionId: "2080.142730",
messageClass: 128,
messageSize: 12345678,
expiry: 1639378126,
version: mms.MMS_VERSION_1_3,
"from": {
address: '+861381234****/TYPE=PLMN', charset: mms.UTF_8
},
subject: "Test mms",
deliveryReport: 128,
contentLocation: "Test",
contentClass: 128,
};
mms.encodeMms({
messageType: mms.TYPE_MMS_NOTIFICATION_IND, mmsType
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0300 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0300 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0300 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_NOTIFICATION_IND).assertTrue();
expect(data.mmsType.transactionId === '2080.142730').assertTrue();
expect(data.mmsType.messageClass === 128).assertTrue();
expect(data.mmsType.messageSize === 12345678).assertTrue();
expect(data.mmsType.expiry !== 0).assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_3).assertTrue();
expect(data.mmsType.from.address.length > 0).assertTrue();
expect(data.mmsType.from.charset === mms.UTF_8).assertTrue();
expect(data.mmsType.subject === 'Test mms').assertTrue();
expect(data.mmsType.deliveryReport === 128).assertTrue();
expect(data.mmsType.contentLocation === 'Test').assertTrue();
expect(data.mmsType.contentClass === 128).assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0300 finish');
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0400
* @tc.name NotifyRespInd type MMS, encoding after decoding,the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0400', 0, async function (done) {
let mmsType = {
transactionId: '2920.1410',
status: 128,
version: mms.MMS_VERSION_1_0,
reportAllowed: mms.MMS_YES,
};
mms.encodeMms({
messageType: mms.TYPE_MMS_RESP_IND, mmsType
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0400 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0400 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0400 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_RESP_IND).assertTrue();
expect(data.mmsType.transactionId === '2920.1410').assertTrue();
expect(data.mmsType.status === 128).assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_0).assertTrue();
expect(data.mmsType.reportAllowed === mms.MMS_YES).assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0400 finish');
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0500
* @tc.name RetrieveConf type MMS, encoding after decoding, the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0500', 0, async function (done) {
let mmsType = {
transactionId: "3077.142410",
messageId: "0001",
date: 1639378126,
version: mms.MMS_VERSION_1_2,
to: [{
address: "+861388888****/TYPE=PLMN", charset: mms.UTF_8
}],
"from": {
address: '+861381234****/TYPE=PLMN', charset: mms.UTF_8
},
cc: [{
address: '+861381111****/TYPE=PLMN', charset: mms.UTF_8
}],
subject: "Test mms",
priority: mms.MMS_HIGH,
deliveryReport: 128,
readReport: 128,
retrieveStatus: 128,
retrieveText: "0002",
contentType: "application/vnd.wap.multipart.related",
};
mms.encodeMms({
messageType: mms.TYPE_MMS_RETRIEVE_CONF, mmsType
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0500 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0500 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0500 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_RETRIEVE_CONF).assertTrue();
expect(data.mmsType.transactionId === '3077.142410').assertTrue();
expect(data.mmsType.messageId === '0001').assertTrue();
expect(data.mmsType.date > 0).assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_2).assertTrue();
expect(data.mmsType.to.length > 0).assertTrue();
expect(data.mmsType.to[0].address.length > 0).assertTrue();
expect(data.mmsType.to[0].charset === mms.UTF_8).assertTrue();
expect(data.mmsType.from.address.length > 0).assertTrue();
expect(data.mmsType.from.charset === mms.UTF_8).assertTrue();
expect(data.mmsType.cc.length > 0).assertTrue();
expect(data.mmsType.cc[0].address.length > 0).assertTrue();
expect(data.mmsType.cc[0].charset == mms.UTF_8).assertTrue();
expect(data.mmsType.subject === 'Test mms').assertTrue();
expect(data.mmsType.priority === mms.MMS_HIGH).assertTrue();
expect(data.mmsType.deliveryReport === 128).assertTrue();
expect(data.mmsType.readReport === 128).assertTrue();
expect(data.mmsType.retrieveStatus === 128).assertTrue();
expect(data.mmsType.retrieveText === '0002').assertTrue();
expect(data.mmsType.contentType === 'application/vnd.wap.multipart.related').assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0500 finish');
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0600
* @tc.name AcknowledgeInd type MMS, encoding after decoding,
* the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0600', 0, async function (done) {
let mmsType = {
transactionId: "27.14210",
version: mms.MMS_VERSION_1_2,
reportAllowed: mms.MMS_NO,
};
mms.encodeMms({
messageType: mms.TYPE_MMS_ACKNOWLEDGE_IND, mmsType
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0600 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0600 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0600 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_ACKNOWLEDGE_IND).assertTrue();
expect(data.mmsType.transactionId === '27.14210').assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_2).assertTrue();
expect(data.mmsType.reportAllowed === mms.MMS_NO).assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0600 finish');
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0700
* @tc.name DeliveryInd type MMS, encoding after decoding, the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0700', 0, async function (done) {
let mmsType = {
messageId: "0001",
date: 1639378126,
to: [{
address: "+861388888****/TYPE=PLMN", charset: mms.UTF_8
}],
status: 134,
version: mms.MMS_VERSION_1_2,
};
mms.encodeMms({
messageType: mms.TYPE_MMS_DELIVERY_IND, mmsType
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0700 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0700 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0700 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_DELIVERY_IND).assertTrue();
expect(data.mmsType.messageId === '0001').assertTrue();
expect(data.mmsType.date > 0).assertTrue();
expect(data.mmsType.to.length > 0).assertTrue();
expect(data.mmsType.to[0].address.length > 0).assertTrue();
expect(data.mmsType.to[0].charset === mms.UTF_8).assertTrue();
expect(data.mmsType.status === 134).assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_2).assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0700 finish');
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0800
* @tc.name ReadRecInd type MMS, encoding after decoding, the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0800', 0, async function (done) {
let mmsType = {
version: mms.MMS_VERSION_1_0,
messageId: "0001",
to: [{
address: "+861388888****/TYPE=PLMN", charset: mms.UTF_8
}],
"from": {
address: "+861381234****/TYPE=PLMN", charset: mms.UTF_8
},
date: 1639378126,
readStatus: 128,
};
mms.encodeMms({
messageType: mms.TYPE_MMS_READ_REC_IND, mmsType
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0800 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0800 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0800 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_READ_REC_IND).assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_0).assertTrue();
expect(data.mmsType.messageId === '0001').assertTrue();
expect(data.mmsType.to.length > 0).assertTrue();
expect(data.mmsType.to[0].address.length > 0).assertTrue();
expect(data.mmsType.to[0].charset === mms.UTF_8).assertTrue();
expect(data.mmsType.from.address.length > 0).assertTrue();
expect(data.mmsType.from.charset === mms.UTF_8).assertTrue();
expect(data.mmsType.readStatus === 128).assertTrue();
expect(data.mmsType.date > 0).assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0800 finish');
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0900
* @tc.name ReadOrigInd type MMS, encoding after decoding, the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0900', 0, async function (done) {
let mmsType = {
version: mms.MMS_VERSION_1_1,
messageId: "0001",
to: [{
address: "+861388888****/TYPE=PLMN", charset: mms.UTF_8
}],
"from": {
address: "+861381234****/TYPE=PLMN", charset: mms.UTF_8
},
readStatus: 129,
date: 1639378126,
};
mms.encodeMms({
messageType: mms.TYPE_MMS_READ_ORIG_IND, mmsType
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0900 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0900 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0900 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_READ_ORIG_IND).assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_1).assertTrue();
expect(data.mmsType.messageId === '0001').assertTrue();
expect(data.mmsType.to.length > 0).assertTrue();
expect(data.mmsType.to[0].address.length > 0).assertTrue();
expect(data.mmsType.to[0].charset === mms.UTF_8).assertTrue();
expect(data.mmsType.from.address.length > 0).assertTrue();
expect(data.mmsType.from.charset === mms.UTF_8).assertTrue();
expect(data.mmsType.date > 0).assertTrue();
expect(data.mmsType.readStatus === 129).assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0900 finish');
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0900
* @tc.name RetrieveConf type MMS, encoding after decoding, the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0900', 0, async function (done) {
let mmsType = {
transactionId: "3077.142410",
messageId: "0001",
date: 1639378126,
version: mms.MMS_VERSION_1_2,
to: [{
address: "+861388888****/TYPE=PLMN", charset: mms.UTF_8
}],
"from": {
address: '+861381234****/TYPE=PLMN', charset: mms.UTF_8
},
cc: [{
address: '+861381111****/TYPE=PLMN', charset: mms.UTF_8
}],
subject: "Test mms",
priority: mms.MMS_NORMAL,
deliveryReport: 128,
readReport: 128,
retrieveStatus: 128,
retrieveText: "0002",
contentType: "application/vnd.wap.multipart.related",
};
mms.encodeMms({
messageType: mms.TYPE_MMS_RETRIEVE_CONF, mmsType
}, (err, encodeData) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0900 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0900 encodeMms finish');
mms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0500 fail');
done();
return;
}
expect(data.messageType === mms.TYPE_MMS_RETRIEVE_CONF).assertTrue();
expect(data.mmsType.transactionId === '3077.142410').assertTrue();
expect(data.mmsType.messageId === '0001').assertTrue();
expect(data.mmsType.date > 0).assertTrue();
expect(data.mmsType.version === mms.MMS_VERSION_1_2).assertTrue();
expect(data.mmsType.to.length > 0).assertTrue();
expect(data.mmsType.to[0].address.length > 0).assertTrue();
expect(data.mmsType.to[0].charset === mms.UTF_8).assertTrue();
expect(data.mmsType.from.address.length > 0).assertTrue();
expect(data.mmsType.from.charset === mms.UTF_8).assertTrue();
expect(data.mmsType.cc.length > 0).assertTrue();
expect(data.mmsType.cc[0].address.length > 0).assertTrue();
expect(data.mmsType.cc[0].charset == mms.UTF_8).assertTrue();
expect(data.mmsType.subject === 'Test mms').assertTrue();
expect(data.mmsType.priority === mms.MMS_NORMAL).assertTrue();
expect(data.mmsType.deliveryReport === 128).assertTrue();
expect(data.mmsType.readReport === 128).assertTrue();
expect(data.mmsType.retrieveStatus === 128).assertTrue();
expect(data.mmsType.retrieveText === '0002').assertTrue();
expect(data.mmsType.contentType === 'application/vnd.wap.multipart.related').assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0500 finish');
done();
});
});
});
const SMS_SEND_DST_NUMBER = '';
const TRUE_SLOT_ID = 0;
const FALSE_SLOT_ID = 9;
const OTHER_SLOT_ID = 1;
const SECOND_SLOT_ID = 2;
const IDENTIFIER_MIN = 0;
const IDENTIFIER_MAX = 0xFFFF;
const RANTYPE_GSM = 1;
const RANTYPE_CDMA = 2;
const RANTYPE_ERROR = 3;
var rawArray = [
0x08, 0x91, 0x68, 0x31, 0x08, 0x20, 0x00, 0x75, 0xF4, 0x24, 0x0D, 0x91,
0x68, 0x81, 0x29, 0x56, 0x29, 0x83, 0xF6, 0x00, 0x00, 0x12, 0x40, 0x80,
0x01, 0x02, 0x14, 0x23, 0x02, 0xC1, 0x30
]
/**
* @tc.number Telephony_SmsMms_setCBConfig_Async_0100
* @tc.name Set "StartMessageld" to minimum(0x0000) and "EndMessageld" to minimum(0x0000) for cell broadcast,
* Configure a cell broadcast for an identity.
* @tc.desc Function test
*/
it('Telephony_SmsMms_setCBConfig_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
let data = {
slotId: TRUE_SLOT_ID,
enable: true,
startMessageId: IDENTIFIER_MIN,
endMessageId: IDENTIFIER_MIN,
ranType: RANTYPE_GSM
};
sms.setCBConfig(data, (err) => {
if (err) {
expect().assertFail();
console.log('Telephony_SmsMms_setCBConfig_Async_0100 fail');
done();
return;
}
console.log('Telephony_SmsMms_setCBConfig_Async_0100 finish');
done();
});
});
/**
* @tc.number Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100
* @tc.name When SLOTID is the correct value,Query all SMS records of the SIM card.
* @tc.desc Function test
*/
it('Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: CORRECT_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_SENT
};
sms.addSimMessage(data, (adderr) => {
if (adderr) {
expect().assertFail();
console.log('Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100 add fail');
done();
return;
}
console.log('Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100 finish ');
sms.getAllSimMessages(TRUE_SLOT_ID, (geterr, getresult) => {
if (geterr) {
expect().assertFail();
console.log('Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100 get fail');
done();
return;
}
expect(getresult.length > 0).assertTrue();
let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu);
let isAdd = (addOfPdu === CORRECT_SMS_PDU &&
getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT);
expect(isAdd).assertTrue();
console.log('Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100 getAllSimMessages cur finish');
sms.delSimMessage(TRUE_SLOT_ID, getresult[0].indexOnSim, (delerr) => {
if (delerr) {
expect().assertFail();
console.log('Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100 del fail');
done();
return;
}
console.log('Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100 delSimMessage finish');
sms.getAllSimMessages(TRUE_SLOT_ID, (geterr, getresult) => {
if (geterr) {
expect().assertFail();
console.log('Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100 get 2 fail');
done();
return;
}
expect(getresult.length === 0).assertTrue();
console.log('Telephony_SmsMms_getAllSimMessages_CDMA_Async_0100 getAllSimMessages cur finish');
done();
});
});
});
});
});
/*
* @tc.number Telephony_SmsMms_createMessage_Async_0100
* @tc.name Call interface CreateMessage,
* pass in the PDU(rawArray) in line with the coding specification, the specification is 3GPP,
* shortMessage Don't empty
* @tc.desc Function test
*/
it('Telephony_SmsMms_createMessage_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp', (err, shortMessage) => {
if (err) {
expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Async_0100 fail');
done();
return;
}
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue();
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue();
expect(shortMessage.protocolId === 0).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue();
expect(shortMessage.isReplaceMessage).assertFalse();
expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue();
expect(shortMessage.status === 0).assertTrue();
expect(shortMessage.isSmsStatusReportMessage).assertTrue();
console.log('Telephony_SmsMms_createMessage_Async_0100 finish');
done();
});
});
/*
* @tc.number Telephony_SmsMms_sendMessage_0100
* @tc.name Call the interface sendMessage, set the card slot parameter "slotId" to 1,
* and send SMS successfully
* @tc.desc Function test
*/
it('Telephony_SmsMms_sendMessage_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.sendMessage({
slotId: TRUE_SLOT_ID,
destinationHost: SMS_SEND_DST_NUMBER,
content: '111111',
sendCallback: (err, value) => {
if (err) {
expect().assertFail();
console.log('Telephony_SmsMms_sendMessage_0100 sendCallback fail');
done();
return;
}
expect(value.result === sms.SEND_SMS_SUCCESS).assertTrue();
console.log('Telephony_SmsMms_sendMessage_0100 sendCallback finish');
done()
},
deliveryCallback: (err, value) => {
if (err) {
expect().assertFail();
console.log('Telephony_SmsMms_sendMessage_0100 deliveryCallback fail');
done();
return;
}
expect(value.pdu.length !== 0).assertTrue();
console.log('Telephony_SmsMms_sendMessage_0100 deliveryCallback finish');
done();
}
});
});
/*
* @tc.number Telephony_SmsMms_getSmsSegmentsInfo_Async_0100
* @tc.name set message to plain Chinese with a length of MAX_CHINESE_MESSAGE_LENTH(63) characters,
* and view the result
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSmsSegmentsInfo_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
let message = '';
for (let index = 0;index < MAX_CHINESE_MESSAGE_LENTH; index++) {
message += '中';
}
let force7BitCode = true;
sms.getSmsSegmentsInfo(TRUE_SLOT_ID, message, force7BitCode, (error, result) => {
if (error) {
console.log("Telephony_SmsMms_getSmsSegmentsInfo_Async_0100 getSmsSegmentsInfoon error " + error.message);
console.log('Telephony_SmsMms_getSmsSegmentsInfo_Async_0100 fail');
expect().assertFail();
} else {
console.log("Telephony_SmsMms_getSmsSegmentsInfo_Async_0100 splitCount " + result.splitCount);
console.log("Telephony_SmsMms_getSmsSegmentsInfo_Async_0100 encodeCount " + result.encodeCount);
console.log("Telephony_SmsMms_getSmsSegmentsInfo_Async_0100 encodeCountRemaining " +
result.encodeCountRemaining);
console.log("Telephony_SmsMms_getSmsSegmentsInfo_Async_0100 scheme " + result.scheme);
expect(result.splitCount === DIVIDE_MESSAGE_INTO_1).assertTrue();
expect(result.encodeCount === MAX_CHINESE_MESSAGE_LENTH).assertTrue();
let remaining = result.splitCount * MAX_CHAR_MESSAGE_LENTH - result.encodeCount;
console.log("Telephony_SmsMms_getSmsSegmentsInfo_Async_0100 remaining " + remaining);
expect(result.encodeCountRemaining === remaining).assertTrue();
expect(result.scheme === sms.SMS_ENCODING_7BIT).assertTrue();
console.log('Telephony_SmsMms_getSmsSegmentsInfo_Async_0100 finish');
}
done();
});
});
/*
* @tc.number Telephony_SmsMms_getSmsEncodingScheme_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSmsEncodingScheme_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.SMS_ENCODING_UNKNOWN == 0).assertTrue();
expect(sms.SMS_ENCODING_7BIT == 1).assertTrue();
expect(sms.SMS_ENCODING_8BIT == 2).assertTrue();
expect(sms.SMS_ENCODING_16BIT == 3).assertTrue();
done();
});
/*
* @tc.number Telephony_SmsMms_getSendSmsResult_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSendSmsResult_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.SEND_SMS_FAILURE_RADIO_OFF == 0).assertTrue();
expect(sms.SEND_SMS_FAILURE_SERVICE_UNAVAILABLE == 1).assertTrue();
expect(sms.SIM_MESSAGE_STATUS_FREE == 0).assertTrue();
expect(sms.INSTANT_MESSAGE == 1).assertTrue();
expect(sms.OPTIONAL_MESSAGE == 2).assertTrue();
done();
});
/*
* @tc.number Telephony_SmsMms_ShortMessageClass_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_ShortMessageClass_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.SIM_MESSAGE_STATUS_FREE == 0).assertTrue();
expect(sms.INSTANT_MESSAGE == 1).assertTrue();
expect(sms.OPTIONAL_MESSAGE == 2).assertTrue();
done();
});
/*
* @tc.number Telephony_SmsMms_getMmsCharSets_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getMmsCharSets_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.BIG5 == 0X07EA).assertTrue();
expect(sms.ISO_10646_UCS_2 == 0X03E8).assertTrue();
expect(sms.ISO_8859_1 == 0X04).assertTrue();
expect(sms.ISO_8859_2 == 0X05).assertTrue();
expect(sms.ISO_8859_3 == 0X06).assertTrue();
expect(sms.ISO_8859_4 == 0X07).assertTrue();
expect(sms.ISO_8859_5 == 0X08).assertTrue();
expect(sms.ISO_8859_6 == 0X09).assertTrue();
expect(sms.ISO_8859_7 == 0X10).assertTrue();
expect(sms.ISO_8859_8 == 0X12).assertTrue();
expect(sms.ISO_8859_9 == 0X13).assertTrue();
expect(sms.SHIFT_JIS == 0X11).assertTrue();
expect(sms.US_ASCII == 0X03).assertTrue();
expect(sms.UTF_8 == 0X6A).assertTrue();
done();
});
})
}
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNewAddEtsTest") {
ohos_js_hap_suite("ActsObserverEtsTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_demo_ets_assets",
......@@ -21,7 +21,7 @@ ohos_js_hap_suite("ActsNewAddEtsTest") {
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsNewAddEtsTest"
hap_name = "ActsObserverEtsTest"
}
ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
......
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1500000",
"package": "com.ohos.observer",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsObserverEtsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.newadd",
"bundleName": "com.ohos.observer",
"vendor": "open",
"version": {
"code": 1000000,
......@@ -14,7 +14,7 @@
},
"deviceConfig": {},
"module": {
"package": "com.ohos.newadd",
"package": "com.ohos.observer",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "MainAbility",
......
/**
* 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.
*/
//other import
import observer from './ObserverJsunit.test.ets'
export default function testsuite() {
observer();
}
\ No newline at end of file
......@@ -191,58 +191,7 @@ export default function observerJsunit() {
done()
})
/*
* @tc.number : Telephony_observer_observer_on_cellInfoChange_0100
* @tc.name : on_cellInfoChange
* @tc.desc : call the on method of cellInfoChange
*/
it('Telephony_observer_observer_on_cellInfoChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_cellInfoChange_0100 Test start *************")
observer.on('cellInfoChange', (cellInformation) => {
expect().assertFail()
done()
return
})
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_cellInfoChange_0100 Test end *************")
done()
})
/*
* @tc.number : Telephony_observer_observer_on_cellInfoChange_0200
* @tc.name : on_cellInfoChange
* @tc.desc : call the on method of cellInfoChange
*/
it('Telephony_observer_observer_on_cellInfoChange_0200', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_cellInfoChange_0200 Test start *************")
observer.on('cellInfoChange', {
slotId: SLOT_0
}, (cellInformation) => {
expect().assertFail()
done()
return
})
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_cellInfoChange_0200 Test end *************")
done()
})
/*
* @tc.number : Telephony_observer_observer_off_cellInfoChange_0100
* @tc.name : off_cellInfoChange
* @tc.desc : call the off method of cellInfoChange
*/
it('Telephony_observer_observer_off_cellInfoChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_off_cellInfoChange_0100 Test start *************")
observer.off('cellInfoChange', (cellInformation) => {
expect().assertFail()
done()
return
})
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_off_cellInfoChange_0100 Test end *************")
done()
})
/*
* @tc.number : Telephony_observer_observer_on_cellularDataConnectionStateChange_0100
......
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsRadiostatisticEtsTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_demo_ets_assets",
":ace_demo_ets_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsRadiostatisticEtsTest"
}
ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("ace_demo_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -3,13 +3,13 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "2000000",
"package": "com.ohos.newadd",
"package": "com.ohos.radiostatistic",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsNewAddEtsTest.hap"
"ActsRadiostatisticEtsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
{
"app": {
"bundleName": "com.ohos.radiostatistic",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.radiostatistic",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
},
{
"name":"ohos.permission.SET_TELEPHONY_STATE",
"reason":"need use ohos.permission.SET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.GET_TELEPHONY_STATE",
"reason":"need use ohos.permission.GET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.PLACE_CALL",
"reason":"need use ohos.permission.PLACE_CALL"
},
{
"name":"ohos.permission.READ_CONTACTS",
"reason":"need use ohos.permission.READ_CONTACTS"
},
{
"name":"ohos.permission.WRITE_CONTACTS",
"reason":"need use ohos.permission.WRITE_CONTACTS"
},
{
"name":"ohos.permission.SEND_MESSAGES",
"reason":"need use ohos.permission.SEND_MESSAGES"
},
{
"name":"ohos.permission.RECEIVE_SMS",
"reason":"need use ohos.permission.RECEIVE_SMS"
},
{
"name":"ohos.permission.READ_CALL_LOG",
"reason":"need use ohos.permission.READ_CALL_LOG"
},
{
"name":"ohos.permission.GET_NETWORK_INFO",
"reason":"need use ohos.permission.GET_NETWORK_INFO"
},
{
"name":"ohos.permission.INTERNET",
"reason":"need use ohos.permission.INTERNET"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/Button",
"pages/Blank",
"pages/DataPanel",
"pages/Divider",
"pages/Text",
"pages/RowSplit",
"pages/Scroll",
"pages/Stack",
"pages/Image",
"pages/Progress",
"pages/Qrcode",
"pages/Rating",
"pages/Span",
"pages/Slider",
"pages/Badge",
"pages/Column",
"pages/ColumnSplit",
"pages/Counter",
"pages/Flex",
"pages/GridContainer"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ 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.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ 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.
*/
@Entry
@Component
struct badge {
@State counts: number = 33
@State message: string = 'new'
@State active: boolean = false
private content: string = "badge Page";
onPageShow() {
console.info('badge page show called');
}
onBuildDone() {
console.info('badge page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Badge({
count: this.counts,
position: BadgePosition.Right,
maxCount: 99,
style: { color: 0xFFFFFF, fontSize: 16, badgeSize: 20, badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(100).height(50).backgroundColor(0x317aff)
}
.width(100)
.height(50)
.key('badge')
Text("BadgePosition.RightTop").fontSize(16)
Badge({
count: this.counts,
position: BadgePosition.RightTop,
maxCount: 99,
style: { color: 0xFFFFFF, fontSize: '16', badgeSize: '20', badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(100).height(50).backgroundColor(0x317aff)
}
.width(100)
.height(50)
.key('badge1')
Text("BadgePosition.Left").fontSize(16)
Badge({
count: this.counts,
position: BadgePosition.Left,
maxCount: 99,
style: { color: Color.Pink, fontSize: 16, badgeSize: 20, badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(100).height(50).backgroundColor(0x317aff)
}
.width(100)
.height(50)
.key('badge2')
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct blank_testcase {
@State Color: Color = Color.Pink
@State active: boolean = false
private content: string = "Blank Page"
onPageShow() {
console.info('Blank page show called');
}
onBuildDone() {
console.info('Blank page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Blank(100)
.color(this.Color)
.key('blank')
Text('on/off').fontSize(18).height(60)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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 router from '@system.router'
@Entry
@Component
struct button_testcase {
@State stateEffect: boolean = true
@State ButtonType: ButtonType = ButtonType.Circle
private content: string = "Button Page";
onPageShow() {
console.info('Button page show called');
}
onBuildDone() {
console.info('Button page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button('1.value', { type: ButtonType.Circle, stateEffect: this.stateEffect })
.fontSize(12)
.fontWeight(FontWeight.Bold)
.fontColor(0xCCCCCC)
.height(40)
.width(40)
.key('button')
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
.padding(10)
Button() {
Text("2.Capsule")
}
.type(ButtonType.Capsule)
.stateEffect(false)
.backgroundColor('#0D9FFB')
.padding(10)
.key('button1')
Button() {
Text("3.Normal")
}.type(ButtonType.Normal)
.backgroundColor('#0D9FFB')
.key('button2')
}.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct column {
@State active: boolean = false
private content: string = "Column Page"
onPageShow() {
console.info('Column page show called');
}
onBuildDone() {
console.info('Column page build done called');
}
build() {
Column({ space: 5 }) {
Text('alignItems(Center)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.Center).width('90%').border({ width: 1 }).key('column')
Text('alignItems(Start)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column({ space: '5' }) {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.Start).width('90%').border({ width: 1 }).key('column1')
Text('alignItems(End)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.End).width('90%').border({ width: 1 }).key('column2')
}.width('100%').padding({ top: 5 })
}
}
/*
* 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.
*/
@Entry
@Component
struct columnSplit {
private content: string = "ColumnSplit Page"
onPageShow() {
console.info('ColumnSplit page show called');
}
onBuildDone() {
console.info('ColumnSplit page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column() {
Text('ColumnSplit').fontSize(9).fontColor(0xCCCCCC).width('90%')
ColumnSplit() {
Text('1').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('2').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('3').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.key('columnSplit')
.resizeable(true)
.width('90%').height('60%')
}.width("100%")
Column() {
Text('ColumnSplit1').fontSize(9).fontColor(0xCCCCCC).width('90%')
ColumnSplit() {
Text('1').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('2').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('3').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.key('columnSplit1')
.resizeable(false)
.width('90%').height('60%')
}.width("100%")
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct counter {
@State value: number = 0
@State active: boolean = false
private content: string = "Counter Page"
onPageShow() {
console.info('Counter page show called');
}
onBuildDone() {
console.info('Counter page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Counter() {
Text(this.value.toString())
}.margin(100)
.key('counter')
.onInc(() => {
this.value++
})
.onDec(() => {
this.value--
})
}.width("100%")
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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 router from '@system.router'
@Entry
@Component
struct dataPanel_testcase {
@State width: string= "200"
@State height: string= "100"
@State active: boolean = false
private content: string = "DataPanel Page"
onPageShow() {
console.info('Blank page show called');
}
onBuildDone() {
console.info('Blank page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Line })
.width(this.width)
.height(this.height)
.key('DataPanel')
.onClick(() => {
router.back()
})
.closeEffect(false)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Circle})
.width(this.width)
.height(this.height)
.key('DataPanel2')
.onClick(() => {
router.back()
})
.closeEffect(true)
DataPanel({ values: [20, 40, 20], max: 100})
.width(this.width)
.height(this.height)
.key('DataPanel3')
.onClick(() => {
router.back()
})
.closeEffect(false)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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 router from '@system.router'
@Entry
@Component
struct divider_textcase {
@State vertical: boolean = true
@State color: Color = Color.Red
@State strokeWidth: number = 7
@State lineCap: LineCapStyle = LineCapStyle.Butt
@State active: boolean = false
private content: string = "Divider Page";
onPageShow() {
console.info('Button page show called');
}
onBuildDone() {
console.info('Button page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
Divider()
.lineCap(LineCapStyle.Butt)
.strokeWidth(this.strokeWidth)
.color(this.color)
.vertical(this.vertical)
.height(150)
.key('divider')
.onClick(() => {
router.back()
})
Divider()
.lineCap(LineCapStyle.Round)
.vertical(false)
.color(Color.Green)
.strokeWidth(10)
.height(150)
.key('divider1')
Divider()
.lineCap(LineCapStyle.Square)
.color(Color.Green)
.vertical(true)
.strokeWidth(10)
.height(150)
.key('divider2')
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct flex {
private content: string = "Flex Page"
onPageShow() {
console.info('Flex page show called');
}
onBuildDone() {
console.info('Flex page build done called');
}
build() {
Column() {
Column({ space : 2 }) {
Text('direction:Column').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.Column,
wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.Center,
alignItems:ItemAlign.Start,
alignContent: FlexAlign.Start,
}) {
Text('1').width('100%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('100%').height(20).backgroundColor(0xD2B48C)
Text('3').width('100%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('direction:Row').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
justifyContent: FlexAlign.Start,
alignItems:ItemAlign.Start,
alignContent: FlexAlign.Center,
}) {
Text('1').width('20%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('20%').height(20).backgroundColor(0xD2B48C)
Text('3').width('20%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex1')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.RowReverse,
wrap: FlexWrap.Wrap,
justifyContent: FlexAlign.End,
alignItems:ItemAlign.End,
alignContent: FlexAlign.End,
}) {
Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
Text('3').width('50%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex2')
.height(90)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('justifyContent:SpaceBetween').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
justifyContent: FlexAlign.SpaceBetween,
wrap: FlexWrap.Wrap,
}) {
Text('1').width('100%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('100%').height(20).backgroundColor(0xD2B48C)
Text('3').width('100%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex3')
.height(100)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('justifyContent AND alignContent').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
justifyContent: FlexAlign.SpaceEvenly,
alignContent: FlexAlign.SpaceEvenly,
wrap: FlexWrap.Wrap,
}) {
Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
Text('3').width('50%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex4')
.height(90)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('justifyContent AND alignContent').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
justifyContent: FlexAlign.SpaceAround,
alignContent: FlexAlign.SpaceAround,
wrap: FlexWrap.Wrap,
}) {
Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
Text('3').width('50%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex5')
.height(90)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
}.width('100%').margin({ top: 5 })
}.width('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct gridContainer {
@State sizeType: SizeType = SizeType.XS
@State active: boolean = false
private content: string = "GridContainer Page"
onPageShow() {
console.info('GridContainer page show called');
}
onBuildDone() {
console.info('GridContainer page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Scroll() {
Column({ space: 5 }) {
GridContainer({ columns: 12, sizeType: this.sizeType, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer')
.width('90%')
.alignItems(HorizontalAlign.Start)
Text('Click Simulate to change the device width').fontSize(9).width('90%').fontColor(0xCCCCCC)
Row() {
Button('XS')
.onClick(() => {
this.sizeType = SizeType.XS
}).backgroundColor(0x317aff)
Button('SM')
.onClick(() => {
this.sizeType = SizeType.SM
}).backgroundColor(0x317aff)
Button('MD')
.onClick(() => {
this.sizeType = SizeType.MD
}).backgroundColor(0x317aff)
Button('LG')
.onClick(() => {
this.sizeType = SizeType.LG
}).backgroundColor(0x317aff)
}
GridContainer({ columns: "auto", sizeType: SizeType.MD, gutter: '10', margin: '20' }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer1')
.width('90%')
.alignItems(HorizontalAlign.Center)
GridContainer({ columns: 12, sizeType: SizeType.SM, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer2')
.width('90%')
.alignItems(HorizontalAlign.End)
GridContainer({ columns: 12, sizeType: SizeType.LG, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer3')
.width('90%')
.alignItems(HorizontalAlign.End)
GridContainer({ columns: 12, sizeType: SizeType.Auto, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer4')
.width('90%')
.alignItems(HorizontalAlign.End)
}.width('100%').margin({ top: 5 })
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct image_textcase {
@State Width: number = 0
@State height: number = 0
onPageShow() {
console.info('Image page show called');
}
onBuildDone() {
console.info('Image page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Image page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Image("/resources/rawfile/hand.png")
.matchTextDirection(false)
.fitOriginalSize(false)
.fillColor(0xCCCCCC)
.objectFit(ImageFit.Cover)
.objectRepeat(ImageRepeat.NoRepeat)
.interpolation(ImageInterpolation.None)
.renderMode(ImageRenderMode.Original)
.autoResize(false)
.syncLoad(false)
.sourceSize({ width: 200, height: 100 })
.alt("/resources/rawfile/person.png")
.key('image1')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Contain)
.objectRepeat(ImageRepeat.X)
.interpolation(ImageInterpolation.High)
.renderMode(ImageRenderMode.Template)
.key('image2')
.height(180)
.width(180)
.onComplete((msg: {
width: number,
height: number
}) => {
this.Width = msg.width
this.height = msg.height
console.info('Width ----' + this.Width)
console.info('height ----' + this.height)
})
.onError(() => {
console.info('load image fail')
})
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Fill)
.objectRepeat(ImageRepeat.Y)
.interpolation(ImageInterpolation.Low)
.key('image3')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.None)
.objectRepeat(ImageRepeat.XY)
.interpolation(ImageInterpolation.Medium)
.key('image4')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.ScaleDown)
.key('image5')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(4)
}
}
}
/*
* 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.
*/
@Entry
@Component
struct navigator_testcase {
@State active: boolean = false
@State params: Object = { text: 'news' }
onPageShow() {
console.info('Navigator page show called');
}
onBuildDone() {
console.info('Navigator page build done called');
}
build() {
Column() {
Navigator({ target: "pages/index", type: NavigationType.Back }) {
Text('Navigator test in Navigator,back')
}.active(this.active)
.key('navigator')
.params({
data: 24
})
Navigator({ target: "pages/index", type: NavigationType.Push }) {
Text('Navigator test in Navigator,push')
}.active(this.active)
.key('navigator2')
.params({
data: 24
})
Navigator({ target: "pages/index", type: NavigationType.Replace }) {
Text('Navigator test in Navigator,replace')
}.active(this.active)
.key('navigator3')
.params({
data: 24
})
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
/*
* 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.
*/
@Entry
@Component
struct PanelExample {
@State show: boolean = true
onPageShow() {
console.info('Panel page show called');
}
onBuildDone() {
console.info('Panel page build done called');
}
build() {
Column() {
Text('2021-09-30 Today Calendar: 1.afternoon......Click for details')
.width('90%')
.height(50)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
.padding({ left: 20 })
.onClick(() => {
this.show = !this.show
})
Panel(this.show) {
Column() {
Text('Today Calendar')
Divider()
Text('1. afternoon 4:00 The project meeting')
}
}
.key('panel')
.type(PanelType.Foldable)
.mode(PanelMode.Half)
.dragBar(true)
.fullHeight(500)
.halfHeight(250)
.miniHeight(100)
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
})
Panel(this.show) {
Column() {
Text('Today Calendar')
Divider()
Text('1. afternoon 4:00 The project meeting')
}
}
.key('panel2')
.type(PanelType.Minibar)
.mode(PanelMode.Mini)
.dragBar(true)
.fullHeight(500)
.halfHeight(250)
.miniHeight(100)
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
})
Panel(false) {
Column() {
Text('Today Calendar')
Divider()
Text('1. afternoon 4:00 The project meeting')
}
}
.key('panel3')
.type(PanelType.Temporary)
.mode(PanelMode.Full)
.dragBar(true)
.fullHeight(500)
.halfHeight(250)
.miniHeight(100)
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
})
}.width('100%').height('50%').backgroundColor(0xDCDCDC).padding({ top: 5 })
}
}
\ 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.
*/
@Entry
@Component
struct progress_testcase {
onPageShow() {
console.info('Progress page show called');
}
onBuildDone() {
console.info('Progress page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Progress page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Progress({ value: 20, total: 40, style: ProgressStyle.Linear })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress')
Progress({ value: 20, total: 40, style: ProgressStyle.Eclipse })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress2')
Progress({ value: 20, total: 40, style: ProgressStyle.Ring })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress3')
Progress({ value: 20, total: 40, style: ProgressStyle.ScaleRing })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress4')
Progress({ value: 20, total: 40, style: ProgressStyle.Capsule })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress5')
}
.width(400)
.height(400)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
/*
* 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.
*/
@Entry
@Component
struct qrcode_textcase {
@State Color: Color = Color.Pink
onPageShow() {
console.info('Qrcode page show called');
}
onBuildDone() {
console.info('Qrcode page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`Qrcode page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
QRCode('hello world')
.color("#FFFFC0CB")
.backgroundColor(this.Color)
.width("200")
.height("100")
.key('qrcode')
}
}
}
/*
* 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.
*/
@Entry
@Component
struct rating_testcase {
@State rating: number = 2
onPageShow() {
console.info('Rating page show called');
}
onBuildDone() {
console.info('Rating page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Rating page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Rating({ rating: 2, indicator: false })
.stepSize(0.5)
.stars(5)
.starStyle({
backgroundUri: '/resources/rawfile/star-1-1.png',
foregroundUri: '/resources/rawfile/star-1-3.png',
secondaryUri: '/resources/rawfile/star-1-2.png'
})
.onChange((value: number) => {
this.rating = value
})
.key('rating1')
Rating({ rating: 2, indicator: true })
.stepSize(0.5)
.stars(5)
.starStyle({
backgroundUri: '/resources/rawfile/star-1-1.png',
foregroundUri: '/resources/rawfile/star-1-3.png',
secondaryUri: '/resources/rawfile/star-1-2.png'
})
.key('rating2')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
/*
* 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 router from '@system.router'
@Entry
@Component
struct rowSplit_testcase {
@State resizeable: boolean = false
private content: string = "rowSplit Page";
onPageShow() {
console.info('RowSplit page show called');
}
onBuildDone() {
console.info('RowSplit page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
RowSplit() {
Column() {
Text('Demo1.RowSplit')
.fontSize(15)
.fontWeight(FontWeight.Bold)
}
Column() {
Text('Demo2.RowSplit')
.fontSize(15)
.fontWeight(FontWeight.Bold)
}
}
.height(100)
.key('rowSplit')
.resizeable(this.resizeable)
.onClick(() => {
router.back()
})
RowSplit() {
Column() {
Text('Demo3.RowSplit')
.fontSize(15)
.fontWeight(FontWeight.Bold)
}
Column() {
Text('Demo4.RowSplit')
.fontSize(15)
.fontWeight(FontWeight.Bold)
}
}.height(100)
.key('rowSplit1')
.resizeable(true)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct scroll_testcase {
@State scrollBarWidth: number = 20
@State scrollable: ScrollDirection = ScrollDirection.None
@State scrollBarColor: Color = Color.Pink
@State scrollBar: BarState= BarState.On
private value1: Array<number> = [1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
@State edge: Edge= Edge.Top
private content: string = "Scroll Page";
scroller: Scroller = new Scroller();
onPageShow() {
console.info('Button page show called');
}
onBuildDone() {
console.info('Button page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Scroll(this.scroller) {
Column() {
ForEach(
this.value1,
item => {
Text(`${item}`)
.fontSize(15)
.width(400)
.margin(10)
.height(70)
.backgroundColor(0xfff5deb3)
},
item => item
)
}
}
.scrollable(ScrollDirection.Vertical)
.scrollBar(this.scrollBar)
.scrollBarColor(this.scrollBarColor)
.scrollBarWidth(this.scrollBarWidth)
.key('scroll')
.width(400)
.height(200)
.onScroll((xOffset: number, yOffset: number) => {
console.info(` current offset is ${xOffset} ${yOffset}`)
})
.onScrollEnd(() => {
console.info(` now on scroll end`)
})
.onScrollEdge((side: Edge) => {
console.info(`To the edge`)
})
Scroll() {
Row() {
Text('scroll uppppp')
.width(60)
.height(100)
.backgroundColor(Color.Yellow)
.margin({
right: 5,
left: 5
})
.key('text')
Text('scroll to')
.width(60)
.height(100)
.backgroundColor(Color.Green)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollTo({
xOffset: 100,
yOffset: 100,
})
})
Text('scroll page')
.width(60)
.height(100)
.backgroundColor(Color.Blue)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollPage({
next: true
})
})
Text('scroll Edge')
.width(60)
.height(100)
.backgroundColor(Color.Blue)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollEdge(Edge.Top)
})
Text('scroll Edge')
.width(60)
.height(100)
.backgroundColor(Color.Blue)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.currentOffset()
})
Text('scroll to index')
.width(60)
.height(100)
.backgroundColor(Color.Blue)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollToIndex(0)
console.info(` now on scroll end`)
})
}
}
.key('scroll1')
.height(100)
.scrollable(ScrollDirection.Horizontal)
Scroll() {
Column() {
Text("start").fontSize(30)
Text("scrollable1")
Text("scrollable2")
Text("scrollable3")
Text("scrollable4")
Text("scrollable1")
Text("scrollable2")
Text("scrollable3")
Text("scrollable4")
}
}
.padding(10)
.scrollable(ScrollDirection.None)
.scrollBar(BarState.Off)
.scrollBarColor(Color.Red)
.scrollBarWidth(5)
.width(300)
.height(200)
.key('scroll2')
Scroll() {
Column() {
Text("start").fontSize(30)
Text("scrollable1")
Text("scrollable2")
Text("scrollable3")
Text("scrollable4")
Text("scrollable1")
Text("scrollable2")
Text("scrollable3")
Text("scrollable4")
}
}
.padding(10)
.scrollable(ScrollDirection.Free)
.scrollBar(BarState.Off)
.scrollBarColor(Color.Red)
.scrollBarWidth(5)
.width(300)
.height(200)
.key('scroll3')
}
.key('flex')
}
}
/*
* 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.
*/
@Entry
@Component
struct slider {
@State inSetValue: number= 40
@State outSetValue: number= 40
@State direction: Axis= Axis.Horizontal
@State Begin: number = SliderChangeMode.Begin
onPageShow() {
console.info('Slider page show called');
}
onBuildDone() {
console.info('Slider page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Slider page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Slider({
value: this.outSetValue,
min: 0,
max: 100,
step: 1,
direction: Axis.Horizontal,
reverse: false,
style: SliderStyle.OutSet
})
.blockColor('#FFFF0000')
.selectedColor('#FF0000FF')
.trackColor('#FF808080')
.minLabel('10')
.maxLabel('10')
.showTips(false)
.showSteps(false)
.onChange((value: number, mode: SliderChangeMode) => {
this.outSetValue = value
this.Begin = mode
console.info('value: ' + value + '---mode: ' + mode)
})
.width("100")
.height("100")
.key('slider1')
Slider({
value: 40,
min: 0,
max: 100,
step: 1,
style: SliderStyle.InSet
})
.blockColor(Color.Red)
.selectedColor(Color.Blue)
.trackColor(Color.Gray)
.showTips(true)
.showSteps(true)
.key('slider2')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
/*
* 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.
*/
@Entry
@Component
struct span_textcase {
onPageShow() {
console.info('Span page show called');
}
onBuildDone() {
console.info('Span page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text() {
Span('Test Span demo')
.decoration({ type: TextDecorationType.LineThrough, "color": Color.Red })
.textCase(TextCase.UpperCase)
.fontColor(Color.Blue)
.fontSize("20fp")
.letterSpacing(5)
.fontFamily("sans-serif")
.fontWeight(FontWeight.Bold)
.fontStyle(FontStyle.Italic)
.key('span1')
Span('The second test Span demo')
.textCase(TextCase.LowerCase)
.fontColor(Color.Black)
.letterSpacing('5')
.fontSize(30)
.key('span2')
Span('The third test Span demo')
.textCase(TextCase.Normal)
.fontColor(Color.Yellow)
.fontSize("30fp")
.key('span3')
}
}
.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(4)
}
}
}
/*
* 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 router from '@system.router'
@Entry
@Component
struct stack_testcase {
@State alignContent: Alignment = Alignment.Bottom
private content: string = "Stack Page";
onPageShow() {
console.info('Stack page show called');
}
onBuildDone() {
console.info('Stack page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Stack({ alignContent: this.alignContent }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}
.width('100%')
.height(80)
.margin({ top: 5 })
.key('stack')
.onClick(() => {
router.back()
})
Stack({ alignContent: Alignment.BottomStart }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack1')
Stack({ alignContent: Alignment.BottomEnd }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack2')
Stack({ alignContent: Alignment.Start }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack3')
Stack({ alignContent: Alignment.Center }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack4')
Stack({ alignContent: Alignment.End }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack5')
Stack({ alignContent: Alignment.Top }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(60).margin({ top: 5 })
.key('stack6')
Stack({ alignContent: Alignment.TopStart }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(60).margin({ top: 5 })
.key('stack7')
Stack({ alignContent: Alignment.TopEnd }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(60).margin({ top: 5 })
.key('stack8')
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
// @ts-nocheck
import router from '@system.router'
var paramInfo = router.getParams()
console.info("cd paramInfo" + JSON.stringify(paramInfo))
@Entry
@Component
struct text_textcase {
@State textAlign: TextAlign= TextAlign.End
@State lineHeight: string= '15fp'
@State overflow: TextOverflow = TextOverflow.Ellipsis
@State textOverflow: textOverflow<{ "overflow": TextOverflow }> = { "overflow": this.overflow }
@State maxLines: number = 2
@State baselineOffset: number = 0
@State textCase: TextCase= TextCase.Normal
@State decoration: decoration<{
type: TextDecorationType,
color: Color
}> = { type: TextDecorationType.Underline, color: Color.Red }
@State color: Color = Color.Red
@State width: string= "200"
@State height: string= "100"
@State size: size = { width: 200, height: 100 }
@State marginBottom: string = "10px"
@State marginTop: string = "10px"
@State marginLeft: string = "10px"
@State marginRingt: string= "10px"
@State paddingBottom: string= "5"
@State paddingTop: string= "5"
@State paddingLeft: string= "5"
@State paddingRingt: string= "5"
@State constraintSize: constraintSize = { minWidth: 20, maxWidth: 200, minHeight: 0, maxHeight: 50 }
@State layoutPriority: string= "9px"
@State layoutWeight: string = "10px"
@State align: Alignment = Alignment.Center
@State direction: Direction = Direction.Auto
@State position: position<{
x: string,
y: string
}> = { x: "50", y: "50" }
@State markAnchor: markAnchor<{
x: string,
y: string
}> = { x: "50", y: "50" }
@State offset: offset<{
x: string,
y: string
}> = { x: "50", y: "50" }
@State flexGrow: number = 5
@State flexShrink: number = 2
@State flexBasis: number = 0
@State alignSelf: ItemAlign = ItemAlign.Auto
@State borderStyle: BorderStyle = BorderStyle.Dashed
@State borderRadius: number = 10
@State borderWidth: string= "4px"
@State borderColor: Color= Color.Blue
@State backgroundColor: Color = Color.Pink
@State backgroundImageSize: ImageSize = ImageSize.Cover
@State backgroundImagePosition: Alignment= Alignment.Center
@State opacity: number= 1
@State visibility: Visibility= Visibility.Visible
@State enabled: boolean = false
@State zIndex: number = 1
@State fontStyle: FontStyle = FontStyle.Italic
@State fontSize: number = 15
@State minFontSize: number = 15
@State maxFontSize: number = 15
@State letterSpacing: number= 10
@State fontWeight: FontWeight= FontWeight.Bold
@State fontColor: Color= Color.Black
@State active: boolean = false
private content: string = "Text Page";
onPageShow() {
console.info('Text page show called');
}
onBuildDone() {
console.info('Text page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text('Text Anto test,Text Anto test,Text Anto test,Text Anto test,test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test')
.width(this.width)
.height(this.height)
.padding({ bottom: this.paddingBottom, top: this.paddingTop, right: this.paddingRingt, left: this.paddingLeft })
.margin({ bottom: this.marginBottom, top: this.marginTop, right: this.marginRingt, left: this.marginLeft })
.constraintSize(this.constraintSize)
.layoutWeight(this.layoutWeight)
.align(this.align)
.direction(this.direction)
.position(this.position)
.markAnchor(this.markAnchor)
.offset(this.offset)
.flexBasis(this.flexBasis)
.flexGrow(this.flexGrow)
.flexShrink(this.flexShrink)
.alignSelf(this.alignSelf)
.borderStyle(this.borderStyle)
.borderRadius(this.borderRadius)
.borderWidth(this.borderWidth)
.borderColor(this.borderColor)
.backgroundColor(this.backgroundColor)
.opacity(this.opacity)
.visibility(this.visibility)
.enabled(this.enabled)
.zIndex(this.zIndex)
.fontColor(this.fontColor)
.fontSize(this.fontSize)
.minFontSize(this.minFontSize)
.letterSpacing(this.letterSpacing)
.maxFontSize(this.maxFontSize)
.fontWeight(this.fontWeight)
.fontStyle(this.fontStyle)
.fontFamily("sans-serif")
.textAlign(this.textAlign)
.textOverflow(this.textOverflow)
.lineHeight(this.lineHeight)
.baselineOffset(this.baselineOffset)
.maxLines(2)
.textCase(this.textCase)
.decoration(this.decoration)
.aspectRatio(1)
.fontColor(Color.Black)
.key('Text')
Text('Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test')
.size({ width: 100, height: 50 })
.padding({ bottom: 5, top: 5, right: 5, left: 10 })
.margin({ bottom: 15, top: 10, right: 10, left: 10 })
.fontSize('13')
.textAlign(TextAlign.Start)
.align(Alignment.Start)
.direction(Direction.Ltr)
.alignSelf(ItemAlign.Start)
.borderStyle(BorderStyle.Dotted)
.borderWidth(2)
.visibility(Visibility.Hidden)
.enabled(true)
.fontWeight(FontWeight.Normal)
.textAlign(TextAlign.Start)
.textOverflow(TextOverflow.Clip)
.maxLines(2)
.textCase(TextCase.LowerCase)
.decoration({ "type": TextDecorationType.LineThrough, "color": Color.Red })
.fontColor(Color.White)
.key('Text1')
Text('Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.width('100%')
.textAlign(TextAlign.Center)
.align(Alignment.TopEnd)
.direction(Direction.Rtl)
.alignSelf(ItemAlign.Center)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.visibility(Visibility.None)
.fontWeight(FontWeight.Bolder)
.textAlign(TextAlign.Center)
.textOverflow(TextOverflow.None)
.textCase(TextCase.UpperCase)
.decoration({ "type": TextDecorationType.None, "color": Color.Red })
.fontColor(Color.Blue)
.key('Text2')
Text('Text Anto test,Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.Top)
.alignSelf(ItemAlign.End)
.borderWidth(2)
.width('100%')
.fontWeight(FontWeight.Lighter)
.decoration({ type: TextDecorationType.Overline, color: Color.Red })
.fontColor(Color.Gray)
.key('Text3')
Text('Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.TopStart)
.alignSelf(ItemAlign.Baseline)
.borderWidth(2)
.width('100%')
.fontWeight(FontWeight.Medium)
.fontColor(Color.Brown)
.key('Text4')
Text('Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.End)
.alignSelf(ItemAlign.Stretch)
.borderWidth(2)
.width('100%')
.fontWeight(FontWeight.Regular)
.fontColor(Color.Grey)
.key('Text5')
Text('Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.BottomEnd)
.width('100%')
.fontColor(Color.Orange)
.key('Text6')
Text('Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.Bottom)
.width('100%')
.fontColor(Color.Yellow)
.key('Text7')
Text('Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.BottomStart)
.width('100%')
.key('Text8')
}
.key('flex')
.width('100%')
.height('100%')
}
}
// @ts-nocheck
/**
* 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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
Want.parameters['timeout'] = 100000
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
testsuite();
core.execute();
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
......@@ -44,98 +44,6 @@ export default function callJsunit(){
describe('callTest', function(){
console.log("==========> call Test start ==========>");
/**
* @tc.number Telephony_Call_Call_Dial_0100
* @tc.name Makes a call.
* @tc.desc Function test
*/
it("Telephony_Call_Call_Dial_0100",0,async function(done){
let caseName:string = "Telephony_Call_Call_Dial_0100";
console.log(`==========> ${caseName} Test start ==========>`);
call.dial(PHONE_NUMBER,(err,data) => {
if(err){
console.log(`${caseName} error,case success,error:${toString(err)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case fail`);
done();
});
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Call_Dial_0200
* @tc.name Makes a call.
* @tc.desc Function test
*/
it("Telephony_Call_Call_Dial_0200",0,async function(done){
let caseName:string = "Telephony_Call_Call_Dial_0200";
console.log(`==========> ${caseName} Test start ==========>`);
let options = {extras:false, accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE};
call.dial(PHONE_NUMBER,options,(err,data) => {
if(err){
console.log(`${caseName} error,case success,error:${toString(err)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case fail`);
done();
});
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Call_Dial_0200
* @tc.name Makes a call.
* @tc.desc Function test
*/
it("Telephony_Call_Call_Dial_0200",0,async function(done){
let caseName:string = "Telephony_Call_Call_Dial_0200";
console.log(`==========> ${caseName} Test start ==========>`);
let options = {extras:false, accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE};
call.dial(PHONE_NUMBER,options,(err,data) => {
if(err){
console.log(`${caseName} error,case success,error:${toString(err)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case fail`);
done();
});
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Call_Dial_0300
* @tc.name Makes a call.
* @tc.desc Function test
*/
it("Telephony_Call_Call_Dial_0300",0,async function(done){
let caseName:string = "Telephony_Call_Call_Dial_0300";
console.log(`==========> ${caseName} Test start ==========>`);
let options = {extras:false, accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE};
call.dial(PHONE_NUMBER,options).then(data=>{
expect(true).assertTrue();
}).catch(error =>{
console.log(caseName+ " dial error :"+ toString(error));
done();
return;
});
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Call_MakeCall_0100
......@@ -215,242 +123,6 @@ export default function callJsunit(){
done();
});
/**
* @tc.number Telephony_Call_Call_Reject_0100
* @tc.name call_reject
* @tc.desc Function test
*/
it("Telephony_Call_Call_Reject_0100",0,async function(done){
let caseName = 'Telephony_Call_Call_Reject_0100';
console.log(`==========> ${caseName} Test start ==========>`);
call.reject(BOUNDARY_NUMBER_INT, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
});
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Call_Reject_0200
* @tc.name call_reject
* @tc.desc Function test
*/
it("Telephony_Call_Call_Reject_0200",0,async function(done){
let caseName = 'Telephony_Call_Call_Reject_0200';
console.log(`==========> ${caseName} Test start ==========>`);
let options = {messageContent:"hello"}
call.reject(BOUNDARY_NUMBER_INT,options, (error) => {
if (error) {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
});
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Call_Reject_0300
* @tc.name call_reject
* @tc.desc Function test
*/
it("Telephony_Call_Call_Reject_0300",0,async function(done){
let caseName = 'Telephony_Call_Call_Reject_0300';
console.log(`==========> ${caseName} Test start ==========>`);
call.reject(CALL_ID_NOT_EXIST).then(() => {
expect().assertFail();
console.log(`${caseName} success,case failed`);
done();
}).catch(error => {
console.log(`${caseName} error,case success,error:${toString(error)}`);
done();
return;
});
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_On_CallDetailsChange_0100
* @tc.name Method in call_on of type callDetailsChange
* @tc.desc Function test
*/
it("Telephony_Call_On_CallDetailsChange_0100",0,async function(done){
let caseName:string = "Telephony_Call_On_CallDetailsChange_0100";
console.log(`==========> ${caseName} Test start ==========>`);
try{
call.on("callDetailsChange",(err,data) => {
if(err){
console.log(`${caseName} error,error :${toString(err)}`);
done();
return;
} else {
let callAttributeOptions = data;
console.log(`${caseName} success, startTime = :` + callAttributeOptions.startTime);
}
expect(true).assertTrue();
done();
});
done();
}catch(err){
expect().assertFail();
console.log(`${caseName} fail, err:${err}`);
done();
}
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Off_callDetailsChange_0100
* @tc.name Method in call_off of type callDetailsChange
* @tc.desc Function test
*/
it("Telephony_Call_Off_CallDetailsChange_0100",0,async function(done){
let caseName:string = "Telephony_Call_Off_CallDetailsChange_0100";
console.log(`==========> ${caseName} Test start ==========>`);
try{
call.off("callDetailsChange",(err,data) => {
if(err){
console.log(`${caseName} error,error :${toString(err)}`);
done();
return;
}
expect(true).assertTrue();
done();
});
done();
}catch(err){
expect().assertFail();
console.log(`${caseName} fail, err:${err}`);
done();
}
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_On_CallEventChange_0200
* @tc.name Method in call_on of type callEventChange
* @tc.desc Function test
*/
it("Telephony_Call_On_CallEventChange_0200",0,async function(done){
let caseName:string = "Telephony_Call_On_CallEventChange_0200";
console.log(`==========> ${caseName} Test start ==========>`);
try{
call.on("callEventChange",(err,data) => {
if(err){
console.log(`${caseName} error,error :${toString(err)}`);
done();
return;
}
expect(true).assertTrue();
done();
});
done();
}catch(err){
expect().assertFail();
console.log(`${caseName} fail, err:${err}`);
done();
}
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Off_CallEventChange_0200
* @tc.name Method in call_off of type callEventChange
* @tc.desc Function test
*/
it("Telephony_Call_Off_CallEventChange_0200",0,async function(done){
let caseName:string = "Telephony_Call_Off_CallEventChange_0200";
console.log(`==========> ${caseName} Test start ==========>`);
try{
call.off("callEventChange",(err,data) => {
if(err){
console.log(`${caseName} error,error :${toString(err)}`);
done();
return;
}
expect(true).assertTrue();
done();
});
done();
}catch(err){
expect().assertFail();
console.log(`${caseName} fail, err:${err}`);
done();
}
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Off_CallEventChange_0200
* @tc.name Method in call_off of type callDisconnectedCause
* @tc.desc Function test
*/
it("Telephony_Call_On_CallDisconnectedCause_0300",0,async function(done){
let caseName:string = "Telephony_Call_On_CallDisconnectedCause_0300";
console.log(`==========> ${caseName} Test start ==========>`);
try{
call.on("callDisconnectedCause",(err,data) => {
if(err){
console.log(`${caseName} error,error :${toString(err)}`);
done();
return;
}
expect(true).assertTrue();
done();
});
done();
}catch(err){
expect().assertFail();
console.log(`${caseName} fail, err:${err}`);
done();
}
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Off_CallEventChange_0200
* @tc.name Method in call_off of type callDisconnectedCause
* @tc.desc Function test
*/
it("Telephony_Call_Off_CallDisconnectedCause_0300",0,async function(done){
let caseName:string = "Telephony_Call_Off_CallDisconnectedCause_0300";
console.log(`==========> ${caseName} Test start ==========>`);
try{
call.off("callDisconnectedCause",(err,data) => {
if(err){
console.log(`${caseName} error,error :${toString(err)}`);
done();
return;
}
expect(true).assertTrue();
done();
});
done();
}catch(err){
expect().assertFail();
console.log(`${caseName} fail, err:${err}`);
done();
}
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_AudioDevice_DEVICE_MIC
......@@ -470,29 +142,6 @@ export default function callJsunit(){
done();
});
/**
* @tc.number Telephony_Call_Dial_Dial_0200
* @tc.name Makes a call.
* @tc.desc Function test
*/
it("Telephony_Call_DialOptions_Extras",0,async function(done){
let caseName:string = "Telephony_Call_DialOptions_extras";
console.log(`==========> ${caseName} Test start ==========>`);
let options = {extras:false, accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE};
call.dial(PHONE_NUMBER,options,(err,data) => {
if(err){
console.log(`${caseName} error,case success,error:${toString(err)}`);
done();
return;
}
expect().assertFail();
console.log(`${caseName} success,case fail`);
done();
});
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_CallTransferType_TRANSFER_TYPE_BUSY
......@@ -851,3 +500,4 @@ export default function callJsunit(){
});
}
......@@ -15,7 +15,7 @@
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import ConvertXML from '@ohos.convertxml'
import convertxml from '@ohos.convertxml'
export default function convertOptionsJsunit() {
describe('XmlTest',function () {
console.log("************* settings Test start*************");
......@@ -27,8 +27,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false,trim :true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false,trim :true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -59,8 +59,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreDeclaration: true});
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDeclaration: true}));
var str1 = '{"_elements":[{"_type":"element",'+
'"_name":"note",'+
'"_attributes":{"importance":"high",'+
......@@ -89,8 +89,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreDeclaration: true});
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDeclaration: true}));
var str1 = '{"_elements":[{"_type":"element",'+
'"_name":"note",'+
'"_attributes":{"importance":"high",'+
......@@ -119,8 +119,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreAttributes: true});
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreAttributes: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -150,8 +150,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreComment: true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreComment: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -183,8 +183,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreCDATA: true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreCDATA: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -216,8 +216,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreDoctype: true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDoctype: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -248,8 +248,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreText: true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreText: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -274,8 +274,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, declarationKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, declarationKey: "123"}));
var str1 = '{"123":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -307,8 +307,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, instructionKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, instructionKey: "123"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -343,8 +343,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, attributesKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, attributesKey: "123"}));
var str1 = '{"_declaration":{"123":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":{"importance":"high",'+
......@@ -378,8 +378,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, textKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, textKey: "123"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -411,8 +411,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, cdataKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, cdataKey: "123"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -446,8 +446,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, doctypeKey: 'doctype'})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, doctypeKey: 'doctype'}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"doctype","doctype":"foo"},'+
......@@ -480,8 +480,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, commentKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, commentKey: "123"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":"note",'+
......@@ -515,8 +515,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, parentKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, parentKey: "123"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -551,8 +551,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, typeKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, typeKey: "123"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":"element",'+
......@@ -583,8 +583,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, nameKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, nameKey: "123"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":"note",'+
......@@ -615,8 +615,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, elementsKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, elementsKey: "123"}));
var str1 = '{"123":[{"123":[{"123":[{"_type":"text",'+
'"_text":"Happy"}],'+
'"_type":"element",'+
......@@ -647,8 +647,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false,trim :true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false,trim :true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -679,8 +679,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreDeclaration: true});
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDeclaration: true}));
var str1 = '{"_elements":[{"_type":"element",'+
'"_name":"note",'+
'"_attributes":{"importance":"high",'+
......@@ -709,8 +709,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreDeclaration: true});
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDeclaration: true}));
var str1 = '{"_elements":[{"_type":"element",'+
'"_name":"note",'+
'"_attributes":{"importance":"high",'+
......@@ -739,8 +739,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreAttributes: true});
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreAttributes: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -770,8 +770,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreComment: true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreComment: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -803,8 +803,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreCDATA: true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreCDATA: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -836,8 +836,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreDoctype: true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDoctype: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -868,8 +868,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreText: true})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreText: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -894,8 +894,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, declarationKey: "456"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, declarationKey: "456"}));
var str1 = '{"456":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -927,8 +927,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, instructionKey: "456"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, instructionKey: "456"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -963,8 +963,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, attributesKey: "456"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, attributesKey: "456"}));
var str1 = '{"_declaration":{"456":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"456":{"importance":"high",'+
......@@ -998,8 +998,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, textKey: "456"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, textKey: "456"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -1031,8 +1031,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, cdataKey: "456"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, cdataKey: "456"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -1066,8 +1066,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, doctypeKey: 'doctype_next'})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, doctypeKey: 'doctype_next'}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"doctype","doctype_next":"foo"},'+
......@@ -1100,8 +1100,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, commentKey: "456"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, commentKey: "456"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"456":"note",'+
......@@ -1135,8 +1135,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, parentKey: "456"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, parentKey: "456"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......@@ -1171,8 +1171,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, typeKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, typeKey: "123"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":"element",'+
......@@ -1203,8 +1203,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, nameKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, nameKey: "123"}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":"note",'+
......@@ -1235,8 +1235,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, elementsKey: "123"})
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, elementsKey: "123"}));
var str1 = '{"123":[{"123":[{"123":[{"_type":"text",'+
'"_text":"Happy"}],'+
'"_type":"element",'+
......@@ -1273,8 +1273,8 @@ export default function convertOptionsJsunit() {
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var convertml = new ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreInstruction: true});
var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreInstruction: true}));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
......
......@@ -17,11 +17,9 @@
import convertOptionsJsunit from './ConvertOptionsJsunit.test.ets'
import radioJsunit from './RadioJsunit.test.ets'
import radioSecondJsunit from './RadioSecondJsunit.test.ets'
import observerJsunit from './ObserverJsunit.test.ets'
import smsUiJsunit from './SmsMmsJsunit.test.ets';
import callJsunit from './CallJsunit.test.ets';
import dataJsunit from './DataJsunit.test.ets';
import simJsunit from './SimJsunit.test.ets';
import statisticsUiJsunit from './StatisticsJsunit.test.ets';
export default function testsuite() {
......@@ -30,9 +28,7 @@ export default function testsuite() {
callJsunit();
smsUiJsunit();
convertOptionsJsunit();
observerJsunit();
radioJsunit();
radioSecondJsunit();
simJsunit();
statisticsUiJsunit();
}
\ No newline at end of file
......@@ -24,49 +24,7 @@ export default function radioJsunit() {
const SLOT_2 = -1;
const SLOT_0 = 0;
/**
* @tc.number Telephony_NetworkSearch_getMEID_Async_0100
* @tc.name Test getMEID(-1) to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getMEID_Async_0100', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
radio.getMEID(SLOT_2, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getMEID_Async_0100 fail: ${err}`);
expect().assertFail();
done();
return;
}
console.log(`Telephony_NetworkSearch_getMEID_Async_0100 end data: ${data}`);
expect(data === '').assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getMEID_Promise_0100
* @tc.name Test getMEID(-1) to check the callback result
* @tc.desc FunctigetMEIDon test
*/
it('Telephony_NetworkSearch_getMEID_Promise_0100', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
radio.getMEID(SLOT_2).then(data => {
console.log(`Telephony_NetworkSearch_getMEID_Promise_0100 end data: ${data}`);
expect(data === '').assertTrue();
done();
}).catch(err => {
console.log(`Telephony_NetworkSearch_getMEID_Promise_0100 fail: ${err}`);
expect().assertFail();
done();
})
});
/**
* @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0200
......@@ -91,48 +49,6 @@ export default function radioJsunit() {
});
});
/**
* @tc.number Telephony_NetworkSearch_setPrimarySlotId_Async_0300
* @tc.name Test The function setPrimarySlotId(0)
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_setPrimarySlotId_Async_0300', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
radio.setPrimarySlotId(SLOT_0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_setPrimarySlotId_Async_0300 fail: ${err}`);
expect(data === undefined).assertTrue();
done();
return;
}
console.log(`Telephony_NetworkSearch_setPrimarySlotId_Async_0300 end data: ${data}`);
expect(data === '').assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_setPrimarySlotId_Async_0300
* @tc.name Test The function setPrimarySlotId(0)
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_setPrimarySlotId_Promise_0300', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
try {
await radio.setPrimarySlotId(SLOT_0);
console.log('Telephony_NetworkSearch_setPrimarySlotId_Promise_0300 success');
done();
} catch (err) {
console.log(`Telephony_NetworkSearch_setPrimarySlotId_Promiss_0300 fail ${err}`);
done();
}
});
/**
* @tc.number Telephony_NetworkSearch_isNrSupported_Promise_0400
......
......@@ -65,62 +65,8 @@ export default function radioSecondJsunit() {
const CELL_INFO_MIN = 0;
const TIME_RADIO_TURNON = 10000;
console.log("************* radio Test start*************");
it('Telephony_NetworkSearch_getCellInformation_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getCellInformation((err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getCellInformation_Async_0100 fail: ${err}`);
expect().assertFail();
done();
return;
}
console.log(`Telephony_NetworkSearch_getCellInformation_Async_0100 end data: ${JSON.stringify(data)}`);
if (true) {
console.log(`Telephony_NetworkSearch_getCellInformation_Async_0100 1`);
expect(true).assertTrue();
done();
return;
} else {
assertCellInformation(data);
done();
}
});
});
/**
* @tc.number Telephony_NetworkSearch_getNrOptionMode_Async_0100
* @tc.name Test getNrOptionMode() to check the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNrOptionMode_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getNrOptionMode((err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getNrOptionMode_Async_0100 get fail err: ${err}`);
expect().assertFail();
done();
return;
}
console.log(`Telephony_NetworkSearch_getNrOptionMode_Async_0100 end data: ${JSON.stringify(data)}`);
if (true) {
console.log(`Telephony_NetworkSearch_getNrOptionMode_Async_0100 1`);
expect(true).assertTrue();
done();
return;
} else {
expect(NROPTION_MODE).assertContain(data);
done();
}
});
})
/**
* @tc.number Telephony_NetworkSearch_NetworkState_Async_0100
......@@ -179,52 +125,7 @@ export default function radioSecondJsunit() {
})
/**
* @tc.number Telephony_NetworkSearch_getNetworkSearchInformation_Async_0100
* @tc.name Test the getNetworkSearchInformation() query function and set the slotId parameter input to 0,
* test the return value isNetworkSearchSuccess is true and specific operator information
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getNetworkSearchInformation(SLOT_0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getNetworkSearchInformation_Async_0100 fail err: ${err}`);
expect().assertFail();
done();
return;
}
if (true){
console.log(`Telephony_NetworkSearch_getNetworkSearchInformation_Async_0100 1`);
expect(true).assertTrue();
done();
return;
}
expect(data != null && data != undefined).assertTrue();
if (data.networkSearchResult.length === 0) {
console.log('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0100 fail');
expect().assertFail();
done();
return;
}
console.log(
`Telephony_NetworkSearch_getNetworkSearchInformation_Async_0100 finish data: ${JSON.stringify(data)}`);
expect(data.isNetworkSearchSuccess).assertTrue();
expect(
data.networkSearchResult[0].operatorName != undefined &&
data.networkSearchResult[0].operatorName != '' &&
data.networkSearchResult[0].operatorName != null
).assertTrue();
expect(garrNetworkState).assertContain(data.networkSearchResult[0].state);
expect(garrNetworkRadioTech).assertContain(data.networkSearchResult[0].radioTech);
expect(data.networkSearchResult[0].operatorNumeric.substr(0, 3) === '460').assertTrue();
done();
});
});
console.log("************* radio Test end*************");
function assertCellInformation(data) {
expect(data !== '' && data != undefined && data != null).assertTrue();
......
// @ts-nocheck
/**
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import mms from '@ohos.telephony.sms';
import utils from './Utils.ets'
export default function smsUiJsunit() {
describe('appInfoTest', function () {
const SMS_SEND_DST_NUMBER = '';
const TRUE_SLOT_ID = 0;
const FALSE_SLOT_ID = 9;
const OTHER_SLOT_ID = 1;
const SECOND_SLOT_ID = 2;
const IDENTIFIER_MIN = 0;
const IDENTIFIER_MAX = 0xFFFF;
const RANTYPE_GSM = 1;
const RANTYPE_CDMA = 2;
const RANTYPE_ERROR = 3;
var rawArray = [
0x08, 0x91, 0x68, 0x31, 0x08, 0x20, 0x00, 0x75, 0xF4, 0x24, 0x0D, 0x91,
0x68, 0x81, 0x29, 0x56, 0x29, 0x83, 0xF6, 0x00, 0x00, 0x12, 0x40, 0x80,
0x01, 0x02, 0x14, 0x23, 0x02, 0xC1, 0x30
]
/*
* @tc.number Telephony_SmsMms_createMessage_Async_0100
* @tc.name Call interface CreateMessage,
* pass in the PDU(rawArray) in line with the coding specification, the specification is 3GPP,
* shortMessage Don't empty
* @tc.desc Function test
*/
it('Telephony_SmsMms_createMessage_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp', (err, shortMessage) => {
if (err) {
expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Async_0100 fail');
done();
return;
}
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue();
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue();
expect(shortMessage.protocolId === 0).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue();
expect(shortMessage.isReplaceMessage).assertFalse();
expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue();
expect(shortMessage.status === 0).assertTrue();
expect(shortMessage.isSmsStatusReportMessage).assertTrue();
console.log('Telephony_SmsMms_createMessage_Async_0100 finish');
done();
});
});
/*
* @tc.number Telephony_SmsMms_getSmsEncodingScheme_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSmsEncodingScheme_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.SMS_ENCODING_UNKNOWN == 0).assertTrue();
expect(sms.SMS_ENCODING_7BIT == 1).assertTrue();
expect(sms.SMS_ENCODING_8BIT == 2).assertTrue();
expect(sms.SMS_ENCODING_16BIT == 3).assertTrue();
done();
});
/*
* @tc.number Telephony_SmsMms_getSendSmsResult_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSendSmsResult_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.SEND_SMS_FAILURE_RADIO_OFF == 0).assertTrue();
expect(sms.SEND_SMS_FAILURE_SERVICE_UNAVAILABLE == 1).assertTrue();
expect(sms.SIM_MESSAGE_STATUS_FREE == 0).assertTrue();
expect(sms.INSTANT_MESSAGE == 1).assertTrue();
expect(sms.OPTIONAL_MESSAGE == 2).assertTrue();
done();
});
/*
* @tc.number Telephony_SmsMms_ShortMessageClass_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_ShortMessageClass_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.SIM_MESSAGE_STATUS_FREE == 0).assertTrue();
expect(sms.INSTANT_MESSAGE == 1).assertTrue();
expect(sms.OPTIONAL_MESSAGE == 2).assertTrue();
done();
});
/*
* @tc.number Telephony_SmsMms_getMmsCharSets_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getMmsCharSets_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.BIG5 == 0X07EA).assertTrue();
expect(sms.ISO_10646_UCS_2 == 0X03E8).assertTrue();
expect(sms.ISO_8859_1 == 0X04).assertTrue();
expect(sms.ISO_8859_2 == 0X05).assertTrue();
expect(sms.ISO_8859_3 == 0X06).assertTrue();
expect(sms.ISO_8859_4 == 0X07).assertTrue();
expect(sms.ISO_8859_5 == 0X08).assertTrue();
expect(sms.ISO_8859_6 == 0X09).assertTrue();
expect(sms.ISO_8859_7 == 0X10).assertTrue();
expect(sms.ISO_8859_8 == 0X12).assertTrue();
expect(sms.ISO_8859_9 == 0X13).assertTrue();
expect(sms.SHIFT_JIS == 0X11).assertTrue();
expect(sms.US_ASCII == 0X03).assertTrue();
expect(sms.UTF_8 == 0X6A).assertTrue();
done();
});
})
}
......@@ -689,45 +689,7 @@ export default function statisticsUiJsunit() {
});
});
/**
* @tc.number Telephony_statistics_statistics_on_0100
* @tc.name Test on() to check the callback result
* @tc.desc Function test
*/
it('Telephony_statistics_statistics_on_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
let caseName = 'Telephony_statistics_statistics_on_0100';
statistics.on('netStatsChange', (data) => {
console.log(`${caseName} on data: ${JSON.stringify(data)}`);
expect(data).assertUndefined();
done();
});
done();
});
/**
* @tc.number Telephony_statistics_statistics_off_0100
* @tc.name Test off() to check the callback result
* @tc.desc Function test
*/
it('Telephony_statistics_statistics_off_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
let caseName = 'Telephony_statistics_statistics_off_0100';
statistics.off('netStatsChange', (data) => {
console.log(`${caseName} off data: ${JSON.stringify(data)}`);
expect(data).assertUndefined();
done();
});
done();
});
/**
* @tc.number Telephony_statistics_getIfaceStatsDetail_Async_0100
* @tc.name Test getIfaceStatsDetail() to check the callback result when iface is test
......
// @ts-nocheck
/**
* 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.
*/
export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static notCheck = true;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
return this.rect_value = {
"left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
}
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
static async drags(downX, downY, upX, upY, steps, drag) {
var xStep;
var yStep;
var swipeSteps;
var ret;
xStep = 0;
yStep = 0;
ret = false;
swipeSteps = steps;
if (swipeSteps == 0) {
swipeSteps = 1;
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
if (drag) {
await this.sleep(500)
}
for (var i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
if (drag) {
await this.sleep(100)
}
var upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
}
/**
* 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.
*/
// sim slot id
export const DEFAULT_SLOTID = 0;
export const SLOTID3 = 3;
export const SLOTID2 = 2;
export const SLOTID_MINUS1 = -1;
// sim correct password
export const CORRECT_PIN = '1234';
export const CORRECT_PIN2 = '18099014';
// sim incorrect password
export const INCORRECT_PIN = '134679';
export const INCORRECT_PIN_LEN3 = '123';
export const INCORRECT_PUK = '134679';
export const INCORRECT_PIN2 = '134679';
export const INCORRECT_PIN2_LEN3 = '123';
export const INCORRECT_PIN2_LEN9 = '123456789';
export const INCORRECT_PUK2 = '134679';
// lock status response
export const LOCK_RESULT = { SUCCESS: 0, FAILURE: -1, EXCEPTION: -2 };
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
......@@ -258,1251 +258,161 @@ describe('SimManagerTest', function () {
done();
});
/**
* @tc.number Telephony_Sim_getSimGid1_Async_0200
* @tc.name Enter exception parameters to test whether the getSimGid1 interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimGid1_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimGid1_Async_0200';
sim.getSimGid1(env.SLOTID2, (err, data) => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail, data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_Sim_getSimGid1_Promise_0200
* @tc.name Enter exception parameters to test whether the getSimGid1 interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimGid1_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimGid1_Promise_0200';
try {
var data = await sim.getSimGid1(env.SLOTID2);
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail, data = ${data}`);
done();
});
/**
* @tc.number Telephony_Sim_getSimAccountInfo_Async_0200
* @tc.name Test getSimAccountInfo async callback interface slotid exception,
* enter parameter 2, and check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_getSimAccountInfo_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimAccountInfo_Async_0200';
sim.getSimAccountInfo(env.SLOTID2, (err) => {
if (err) {
console.log(`${CASE_NAME} expect error: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} test fail.`);
done();
});
});
/**
* @tc.number Telephony_Sim_getSimAccountInfo_Promise_0200
* @tc.name Test getSimAccountInfo promise interface slotid exception,
* enter parameter 2, and check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_getSimAccountInfo_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimAccountInfo_Promise_0200';
try {
await sim.getSimAccountInfo(env.SLOTID2);
expect().assertFail();
console.log(`${CASE_NAME} fail`);
} catch (err) {
console.log(`${CASE_NAME} expect error: ${err.message}`);
console.log(`${CASE_NAME} finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_setDefaultVoiceSlotId_Async_0100
* @tc.name Test the setDefaultVoiceLotid interface when the input SIM ID parameter is 2.
* @tc.desc Function test
*/
it('Telephony_Sim_setDefaultVoiceSlotId_Async_0100', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_setDefaultVoiceSlotId_Async_0100';
sim.setDefaultVoiceSlotId(env.SLOTID2, (err) => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail`);
done();
});
});
/**
* @tc.number Telephony_Sim_setDefaultVoiceSlotId_Promise_0100
* @tc.name Test the setDefaultVoiceLotid interface when the input SIM ID parameter is 2.
* @tc.desc Function test
*/
it('Telephony_Sim_setDefaultVoiceSlotId_Promise_0100', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_setDefaultVoiceSlotId_Promise_0100';
try {
await sim.setDefaultVoiceSlotId(env.SLOTID2);
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail`);
done();
});
/**
* @tc.number Telephony_Sim_getDefaultVoiceSlotId_Async_0200
* @tc.name The test first sets the default card number and then calls
* the getDefaultVoiceLotid interface to get the SIM ID.
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotId_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotId_Async_0200';
sim.getDefaultVoiceSlotId((err, data) => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_getDefaultVoiceSlotId_Promise_0200
* @tc.name The test first sets the default card number and then calls
* the getDefaultVoiceLotid interface to get the default SIM ID.
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotId_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotId_Promise_0200';
try {
let data = await sim.getDefaultVoiceSlotId();
console.log(`${CASE_NAME}, data = ${data}`);
expect().assertFail();
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_unlockPin_Async_0400
* @tc.name The status of the card is ready state, the unlockPin interface is tested, and slotId is abnormal.
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPin_Async_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_unlockPin_Async_0400';
sim.unlockPin(env.SLOTID2, env.CORRECT_PIN, err => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail`);
done();
});
});
/**
* @tc.number Telephony_Sim_unlockPin_Promise_0400
* @tc.name The status of the card is ready state, the unlockPin interface is tested, and slotId is abnormal.
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPin_Promise_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_unlockPin_Promise_0400';
try {
await sim.unlockPin(env.SLOTID2, env.CORRECT_PIN);
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail`);
done();
});
/**
* @tc.number Telephony_Sim_unlockPuk_Async_0400
* @tc.name The card status is ready state, and the unlockPuk interface is tested.
* The slotId parameter is abnormal.
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPuk_Async_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_unlockPuk_Async_0400';
sim.unlockPuk(env.SLOTID2, env.CORRECT_PIN, env.CORRECT_PUK, err => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail`);
done();
});
});
/**
* @tc.number Telephony_Sim_unlockPuk_Promise_0400
* @tc.name The card status is ready state, and the unlockPuk interface is tested.
* The slotId parameter is abnormal.
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPuk_Promise_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_unlockPuk_Promise_0400';
try {
await sim.unlockPuk(env.SLOTID2, env.CORRECT_PIN, env.CORRECT_PUK);
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
console.log(`${CASE_NAME} fail`);
done();
});
/**
* @tc.number Telephony_Sim_alterPin_Async_0400
* @tc.name The status of the card is ready state, and the alterPin interface. SlotId is abnormal.
* @tc.desc Function test
*/
it('Telephony_Sim_alterPin_Async_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_alterPin_Async_0400';
sim.alterPin(env.SLOTID2, env.CORRECT_PIN, env.ALTER_PIN, err => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail`);
done();
});
});
/**
* @tc.number Telephony_Sim_alterPin_Promise_0400
* @tc.name The status of the card is ready state, and the alterPin interface is tested. SlotId is abnormal.
* @tc.desc Function test
*/
it('Telephony_Sim_alterPin_Promise_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_alterPin_Promise_0400';
try {
await sim.alterPin(env.SLOTID2, env.CORRECT_PIN, env.ALTER_PIN);
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail`);
done();
});
/**
* @tc.number Telephony_Sim_SetLockState_Async_1000
* @tc.name The card is in the ready state, test the SetLockState async callback interface
* slotId exception into the parameter 2, check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_SetLockState_Async_1000', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_SetLockState_Async_1000';
const lockInfo = { lockType: sim.PIN_LOCK, state: sim.LOCK_OFF, password: env.CORRECT_PIN };
sim.setLockState(env.SLOTID2, lockInfo, (error) => {
if (error) {
console.log(`${CASE_NAME} setLockState expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
done();
return;
}
console.log(`${CASE_NAME} test fail`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_SetLockState_Promise_1000
* @tc.name The card is in the ready state, test the SetLockState promise interface
* slotId exception into the parameter 2, check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_SetLockState_Promise_1000', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_SetLockState_Promise_1000';
const lockInfo = { lockType: sim.PIN_LOCK, state: sim.LOCK_OFF, password: env.CORRECT_PIN };
try {
await sim.setLockState(env.SLOTID2, lockInfo);
console.log(`${CASE_NAME} test fail`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} setLockState expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_GetSimIccId_Async_0600
* @tc.name CDMA file, getSimIccId async callback interface slotId
* exception enters parameter -1 test
* @tc.desc Function test
*/
it('Telephony_Sim_GetSimIccId_Async_0600', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_GetSimIccId_Async_0600';
sim.getSimIccId(env.SLOTID2, error => {
if (error) {
console.log(`${CASE_NAME} getSimIccId expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish.`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} test fail.`);
done();
});
});
/**
* @tc.number Telephony_Sim_GetSimIccId_Promise_0600
* @tc.name CDMA file, getSimIccId promise interface slotId
* exception enters parameter -1 test
* @tc.desc Function test
*/
it('Telephony_Sim_GetSimIccId_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_GetSimIccId_Promise_0600';
try {
await sim.getSimIccId(env.SLOTID2);
expect().assertFail();
console.log(`${CASE_NAME} test fail.`);
} catch (error) {
console.log(`${CASE_NAME} getSimIccId expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish.`);
}
done();
});
/**
* @tc.number Telephony_Sim_getIMSI_Async_0200
* @tc.name To test the getIMSI interface, enter slotid as 4 and expect the result to enter err.
* @tc.desc Function test
*/
it('Telephony_Sim_getIMSI_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getIMSI_Async_0200';
sim.getIMSI(env.SLOTID2, err => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail`);
done();
});
});
/**
* @tc.number Telephony_Sim_getIMSI_Promise_0200
* @tc.name To test the getIMSI interface, enter slotid as 4 and expect the result to enter err.
* @tc.desc Function test
*/
it('Telephony_Sim_getIMSI_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getIMSI_Async_0200';
try {
await sim.getIMSI(env.SLOTID2);
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} fail`);
done();
});
/**
* @tc.number Telephony_Sim_isSimActive_Async_0700
* @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_isSimActive_Async_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700';
sim.isSimActive(env.SLOTID2, (err, data) => {
if (err) {
console.log(`${CASE_NAME} fail, err: ${err.message}`);
expect().assertFail();
done();
return;
}
expect(data).assertFalse();
console.log(`${CASE_NAME} finish`);
done();
});
});
/**
* @tc.number Telephony_Sim_isSimActive_Promise_0700
* @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_isSimActive_Promise_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_isSimActive_Promise_0700';
try {
let data = await sim.isSimActive(env.SLOTID2);
expect(data).assertFalse();
} catch (err) {
console.log(`${CASE_NAME} isSimActive fail, err: ${err.message}`);
expect().assertFail();
done();
return;
}
console.log(`${CASE_NAME} finish`);
done();
});
/**
* @tc.number Telephony_Sim_activateSim_Async_0600
* @tc.name Test the slotId exception input parameter 2 of activateSim interface,
* check the callback value, and expect to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_activateSim_Async_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_activateSim_Async_0600';
sim.activateSim(env.SLOTID2, (err) => {
if (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} fail`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_activateSim_Promise_0600
* @tc.name Test the slotId exception input parameter 2 of activateSim interface,
* check the callback value, and expect to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_activateSim_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_activateSim_Promise_0600';
try {
await sim.activateSim(env.SLOTID2);
} catch (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} fail`);
expect().assertFail();
done();
});
/**
* @tc.number Telephony_Sim_deactivateSim_Async_0600
* @tc.name Test the deactivateSim interface slotId exception input parameter 2
* and check the callback value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_deactivateSim_Async_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_deactivateSim_Async_0600';
sim.deactivateSim(env.SLOTID2, (err) => {
if (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} fail`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_deactivateSim_Promise_0600
* @tc.name Test the deactivateSim interface slotId exception input parameter
* 2 and check the callback value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_deactivateSim_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_deactivateSim_Promise_0600';
try {
await sim.deactivateSim(env.SLOTID2);
} catch (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} fail`);
expect().assertFail();
done();
});
/**
* @tc.number Telephony_Sim_hasSimCard_Async_0600
* @tc.name Test the slotId exception input parameter 2 of the hasSimCard interface,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_hasSimCard_Async_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600';
sim.hasSimCard(env.SLOTID2, (err, data) => {
if (err) {
expect().assertFail();
console.log(`${CASE_NAME} fail, err: ${err.message}`);
done();
return;
}
expect(data).assertFalse();
console.log(`${CASE_NAME} finish`);
done();
});
});
/**
* @tc.number Telephony_Sim_hasSimCard_Promise_0600
* @tc.name Test the slotId exception input parameter 2 of the hasSimCard interface,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_hasSimCard_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_hasSimCard_Promise_0600';
try {
let data = await sim.hasSimCard(env.SLOTID2);
expect(data).assertFalse();
} catch (err) {
expect().assertFail();
console.log(`${CASE_NAME} fail, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} finish`);
done();
});
/**
* @tc.number Telephony_Sim_setShowName_Async_0700
* @tc.name Test setShowName slotId exception input parameter 2 to check the
* callback value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_setShowName_Async_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_setShowName_Async_0700';
sim.setShowName(env.SLOTID2, env.CARD_NAME, (err) => {
if (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} fail`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_setShowName_Promise_0700
* @tc.name Test setShowName promise interface slotId exception into parameter 2, check the return value
* @tc.desc Function test
*/
it('Telephony_Sim_setShowName_Promise_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_setShowName_Promise_0700';
try {
await sim.setShowName(env.SLOTID2, env.CARD_NAME);
} catch (err) {
console.log(`${CASE_NAME} finish, error : ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} fail`);
expect().assertFail();
done();
});
/**
* @tc.number Telephony_Sim_getShowName_Async_0700
* @tc.name Test the slotId exception input parameter 2 of getShowName and
* check the return value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_getShowName_Async_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getShowName_Async_0700';
sim.getShowName(env.SLOTID2, (err, data) => {
if (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} , data : ${data}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_getShowName_Promise_0700
* @tc.name Test the slotId exception input parameter 2 of getShowName and check the
* return value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_getShowName_Promise_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getShowName_Promise_0700';
try {
let data = await sim.getShowName(env.SLOTID2);
console.log(`${CASE_NAME} fail, data : ${data}`);
expect().assertFail();
done();
} catch (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
}
});
/**
* @tc.number Telephony_Sim_setShowNumber_Async_0700
* @tc.name Test setShowNumber slotId exception input parameter 2, check the callback value,
* and expect to enter err
* @tc.desc Function test
*/
it('Telephony_Sim_setShowNumber_Async_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_setShowNumber_Async_0700';
sim.setShowNumber(env.SLOTID2, env.CARD_NUMBER, (err) => {
if (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} fail`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_setShowNumber_Promise_0700
* @tc.name Test setShowNumber slotId exception input parameter 2 and check
* the return value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_setShowNumber_Promise_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_setShowNumber_Promise_0700';
try {
await sim.setShowNumber(env.SLOTID2, env.CARD_NUMBER);
console.log(`${CASE_NAME} fail`);
expect().assertFail();
done();
} catch (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
}
});
/**
* @tc.number Telephony_Sim_getShowNumber_Async_0600
* @tc.name Test the slotId exception of the getShowNumber async callback interface into parameter 2,
* check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_getShowNumber_Async_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getShowNumber_Async_0600';
sim.getShowNumber(env.SLOTID2, (err, data) => {
if (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} fail, data : ${data}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_getShowNumber_Promise_0600
* @tc.name Test the slotId exception of the getShowNumber interface into parameter 2, check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_getShowNumber_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getShowNumber_Promise_0600';
try {
let data = await sim.getShowNumber(env.SLOTID2);
console.log(`${CASE_NAME} fail, data : ${data}`);
expect().assertFail();
done();
} catch (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
}
});
/**
* @tc.number Telephony_Sim_getOperatorConfigs_Async_0700
* @tc.name Test the getOperatorConfigs slotId exception input parameter 2 and check the
* callback value, expecting to enter err
* @tc.desc Function test
*/
it('Telephony_Sim_getOperatorConfigs_Async_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getOperatorConfigs_Async_0700';
sim.getOperatorConfigs(env.SLOTID2, (err, data) => {
if (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} , data : ${data}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_getOperatorConfigs_Promise_0700
* @tc.name Test the getOperatorConfigs slotId exception input parameter 2 and check
* the callback value, expecting to enter err
* @tc.desc Function test
*/
it('Telephony_Sim_getOperatorConfigs_Promise_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getOperatorConfigs_Promise_0700';
try {
let data = await sim.getOperatorConfigs(env.SLOTID2);
console.log(`${CASE_NAME} fail, data : ${data}`);
expect().assertFail();
done();
} catch (err) {
console.log(`${CASE_NAME} finish, err: ${err.message}`);
done();
}
});
/**
* @tc.number Telephony_Sim_getActiveSimAccountInfoList_Async_0500
* @tc.name When there is no card, test the getActiveSimAccountInfoList interface and check the return value
* @tc.desc Function test
*/
it('Telephony_Sim_getActiveSimAccountInfoList_Async_0500', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_getActiveSimAccountInfoList_Async_0500';
sim.getActiveSimAccountInfoList(error => {
if (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
} else {
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
}
done();
});
});
/**
* @tc.number Telephony_Sim_getActiveSimAccountInfoList_Promise_0500
* @tc.name When there is no card, test the getActiveSimAccountInfoList interface and check the return value
* @tc.desc Function test
*/
it('Telephony_Sim_getActiveSimAccountInfoList_Promise_0500', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getActiveSimAccountInfoList_Async_0500';
try {
await sim.getActiveSimAccountInfoList();
expect().assertFail();
console.log(`${CASE_NAME} test fail.`);
} catch (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
}
done();
});
/**
* @tc.number Telephony_Sim_unlockPin2_Async_1000
* @tc.name Test slotid exception input parameter 2 of unlockPin2 and check the callback
* value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPin2_Async_1000', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_unlockPin2_Async_1000';
sim.unlockPin2(env.SLOTID2, env.INCORRECT_PIN2, (err, data) => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
console.log(`${CASE_NAME} , data: ${JSON.stringify(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_unlockPin2_Promise_1000
* @tc.name Test slotid exception input parameter 2 of unlockPin2 and check the callback
* value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPin2_Promise_1000', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_unlockPin2_Promise_1000';
try {
await sim.unlockPin2(env.SLOTID2, env.INCORRECT_PIN2);
expect().assertFail();
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_unlockPuk2_Async_1100
* @tc.name Test the slotId exception input parameter 2 of the unlockPuk2
* interface and check the callback value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPuk2_Async_1100', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_unlockPuk2_Async_1100';
sim.unlockPuk2(env.SLOTID2, env.INCORRECT_PIN2, env.INCORRECT_PUK2_LEN8, (err, data) => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
console.log(`${CASE_NAME}, data: ${JSON.stringify(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_unlockPuk2_Promise_1100
* @tc.name Test the slotId exception input parameter 2 of the unlockPuk2 interface
* and check the callback value, expecting to enter ERR
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPuk2_Promise_1100', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_unlockPuk2_Async_1100';
try {
const data = await sim.unlockPuk2(env.SLOTID2, env.INCORRECT_PIN2, env.INCORRECT_PUK2_LEN8);
console.log(`${CASE_NAME}, data: ${JSON.stringify(data)}`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} expect err: ${error.message}`);
console.log(`${CASE_NAME} finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_alterPin2_Async_1100
* @tc.name Test alterPin2 interface exception slotId input parameter 2, check the callback
* value, expecting to enter err
* @tc.desc Function test
*/
it('Telephony_Sim_alterPin2_Async_1100', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_alterPin2_Async_1100';
sim.alterPin2(env.SLOTID2, env.INCORRECT_PIN2, env.INCORRECT_PIN2, (err, data) => {
if (err) {
console.log(`${CASE_NAME} expect error: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
console.log(`${CASE_NAME} data: ${JSON.stringify(data)}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_alterPin2_Promise_1100
* @tc.name Test alterPin2 interface exception slotId input parameter 2, check the callback
* value, expecting to enter err
* @tc.desc Function test
*/
it('Telephony_Sim_alterPin2_Promise_1100', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_alterPin2_Promise_1100';
try {
const data = await sim.alterPin2(env.SLOTID2, env.INCORRECT_PIN2, env.INCORRECT_PIN2);
console.log(`${CASE_NAME} data: ${JSON.stringify(data)}`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_queryIccDiallingNumbers_Async_0800
* @tc.name Test sim.queryIccDiallingNumbers(soltId: 2, type: 1, callback:
* AsyncCallback<Array<DiallingNumbersInfo>>), expect return an empty array.
* @tc.desc Function test
*/
it('Telephony_Sim_queryIccDiallingNumbers_Async_0800', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_queryIccDiallingNumbers_Async_0800';
sim.queryIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, (error, data) => {
if (error) {
console.log(`${CASE_NAME} query error: ${error.message}`);
expect().assertFail();
done();
return;
}
expect(data.length === 0).assertTrue();
console.log(`${CASE_NAME} finish`);
done();
});
});
/**
* @tc.number elephony_Sim_queryIccDiallingNumbers_Promise_0800
* @tc.name Test sim.queryIccDiallingNumbers(soltId: 2, type: 1):Promise<Array<DiallingNumbersInfo>>
* promise interface, expect result is an empty array.
* @tc.desc Function test
*/
it('telephony_Sim_queryIccDiallingNumbers_Promise_0800', 0, async function (done) {
const CASE_NAME = 'telephony_Sim_queryIccDiallingNumbers_Promise_0800';
try {
const contacts = await sim.queryIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT);
expect(contacts.length === 0).assertTrue();
console.log(`${CASE_NAME} test finish.`);
} catch (error) {
console.log(`${CASE_NAME} query error:${error.message}`);
expect().assertFail();
}
done();
});
/**
* @tc.number Telephony_Sim_addIccDiallingNumbers_Async_0900
* @tc.name Test sim.addIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers:
* {recordNumber: 1, alphaTag: 'test', number: '12345678', pin2: '123@#ABCD'},
* callback: AsyncCallback<void>) async callback interface, expect enter error.
* @tc.desc Function test
*/
it('Telephony_Sim_addIccDiallingNumbers_Async_0900', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_addIccDiallingNumbers_Async_0900';
const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
const GENERAL_CONTACT_INFO = Object.assign({}, { 'pin2': env.INCORRECT_PIN2 }, CONTACT_INFO);
sim.addIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, GENERAL_CONTACT_INFO, error => {
if (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} finish.`);
} else {
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
}
done();
});
});
/**
* @tc.number Telephony_Sim_addIccDiallingNumbers_Promise_0900
* @tc.name Test sim.addIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers:
* {recordNumber: 1, alphaTag: 'test', number: '12345678', pin2: '123@#ABCD'}): Promise<void>
* promise interface, expect enter error.
* @tc.desc Function test
*/
it('Telephony_Sim_addIccDiallingNumbers_Promise_0900', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_addIccDiallingNumbers_Promise_0900';
const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
const GENERAL_CONTACT_INFO = Object.assign({}, { 'pin2': env.INCORRECT_PIN2 }, CONTACT_INFO);
try {
await sim.addIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, GENERAL_CONTACT_INFO);
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish.`);
}
done();
});
/**
* @tc.number Telephony_Sim_delIccDiallingNumbers_Async_0900
* @tc.name Test sim.delIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers: DiallingNumbersInfo,
* callback: AsyncCallback<void>) async callback interface, expect enter error.
* @tc.desc Function test
*/
it('Telephony_Sim_delIccDiallingNumbers_Async_0900', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_delIccDiallingNumbers_Async_0900';
const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
sim.delIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, CONTACT_INFO, error => {
if (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} finish.`);
} else {
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
}
done();
});
});
/**
* @tc.number Telephony_Sim_delIccDiallingNumbers_Promise_0900
* @tc.name Test sim.delIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers: DiallingNumbersInfo):
* Promise<void> promise interface to delete record, expect enter error.
* @tc.desc Function test
*/
it('Telephony_Sim_delIccDiallingNumbers_Promise_0900', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_delIccDiallingNumbers_Promise_0900';
const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
try {
await sim.delIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, CONTACT_INFO);
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_updateIccDiallingNumbers_Async_1200
* @tc.name Test sim.updateIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers:
* {recordNumber: 1, alphaTag: 'test_Update', number: '87654321', pin2:'123@#ABCD'}, callback:
* AsyncCallback<void>) async callback interface, expect enter error.
* @tc.desc Function test
*/
it('Telephony_Sim_updateIccDiallingNumbers_Async_1200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_updateIccDiallingNumbers_Async_1200';
let updateInfo = { recordNumber: 1, alphaTag: 'test_Update', number: '87654321', pin2: '123@#ABCD' };
sim.updateIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, updateInfo, error => {
if (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish.`);
done();
return;
}
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_updateIccDiallingNumbers_Promise_1200
* @tc.name Test sim.updateIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers:
* {recordNumber: 1, alphaTag: 'test_Update', number: '87654321', pin2:'123@#ABCD'})
* promise interface, expect enter error.
* @tc.desc Function test
*/
it('Telephony_Sim_updateIccDiallingNumbers_Promise_1200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_updateIccDiallingNumbers_Promise_1200';
let updateInfo = { recordNumber: 1, alphaTag: 'test_Update', number: '87654321', pin2: '123@#ABCD' };
try {
console.log(`${CASE_NAME} update`);
await sim.updateIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, updateInfo);
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish.`);
}
done();
});
/**
* @tc.number Telephony_Sim_getSimTelephoneNumber_Async_0600
* @tc.name Test getSimTelephoneNumber slotId exception input parameter 2,
* check the callback value, and expect to enter err
* @tc.number Telephony_Sim_getDefaultVoiceSlotId_Async_0200
* @tc.name The test first sets the default card number and then calls
* the getDefaultVoiceLotid interface to get the SIM ID.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimTelephoneNumber_Async_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimTelephoneNumber_Async_0600';
sim.getSimTelephoneNumber(env.SLOTID2, (err, data) => {
it('Telephony_Sim_getDefaultVoiceSlotId_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotId_Async_0200';
sim.getDefaultVoiceSlotId((err, data) => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
console.log(`${CASE_NAME} , data : ${data}`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_getSimTelephoneNumber_Promise_0600
* @tc.name Test getSimTelephoneNumber slotId exception input parameter 2, check the callback
* value, and expect to enter err
* @tc.number Telephony_Sim_getDefaultVoiceSlotId_Promise_0200
* @tc.name The test first sets the default card number and then calls
* the getDefaultVoiceLotid interface to get the default SIM ID.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimTelephoneNumber_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimTelephoneNumber_Promise_0600';
let data;
it('Telephony_Sim_getDefaultVoiceSlotId_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotId_Promise_0200';
try {
data = await sim.getSimTelephoneNumber(env.SLOTID2);
let data = await sim.getDefaultVoiceSlotId();
console.log(`${CASE_NAME}, data = ${data}`);
expect().assertFail();
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
console.log(`${CASE_NAME}, data : ${data}`);
expect().assertFail();
done();
});
/**
* @tc.number Telephony_Sim_getVoiceMailIdentifier_Async_0600
* @tc.name Test getVoiceMailIdentifier slotId exception input parameter 2, check the
* callback value, and expect to enter err
* @tc.number Telephony_Sim_isSimActive_Async_0700
* @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_getVoiceMailIdentifier_Async_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getVoiceMailIdentifier_Async_0600';
sim.getVoiceMailIdentifier(env.SLOTID2, (err, data) => {
it('Telephony_Sim_isSimActive_Async_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700';
sim.isSimActive(env.SLOTID2, (err, data) => {
if (err) {
console.log(`${CASE_NAME} finish`);
console.log(`${CASE_NAME} fail, err: ${err.message}`);
expect().assertFail();
done();
return;
}
console.log(`${CASE_NAME} , data : ${data}`);
expect().assertFail();
expect(data).assertFalse();
console.log(`${CASE_NAME} finish`);
done();
});
});
/**
* @tc.number Telephony_Sim_getVoiceMailIdentifier_Promise_0600
* @tc.name Test getVoiceMailIdentifier slotId exception input parameter 2, check the callback
* value, and expect to enter err
* @tc.number Telephony_Sim_isSimActive_Promise_0700
* @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_getVoiceMailIdentifier_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getVoiceMailIdentifier_Promise_0600';
let data;
it('Telephony_Sim_isSimActive_Promise_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_isSimActive_Promise_0700';
try {
data = await sim.getVoiceMailIdentifier(env.SLOTID2);
let data = await sim.isSimActive(env.SLOTID2);
expect(data).assertFalse();
} catch (err) {
console.log(`${CASE_NAME} finish`);
console.log(`${CASE_NAME} isSimActive fail, err: ${err.message}`);
expect().assertFail();
done();
return;
}
console.log(`${CASE_NAME}, data : ${data}`);
expect().assertFail();
console.log(`${CASE_NAME} finish`);
done();
});
/**
* @tc.number Telephony_Sim_getVoiceMailNumber_Async_0600
* @tc.name Test getVoiceMailNumber slotId exception input parameter 2, check the callback
* value, and expect to enter ERR
* @tc.number Telephony_Sim_hasSimCard_Async_0600
* @tc.name Test the slotId exception input parameter 2 of the hasSimCard interface,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_getVoiceMailNumber_Async_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getVoiceMailNumber_Async_0600';
sim.getVoiceMailNumber(env.SLOTID2, (err, data) => {
it('Telephony_Sim_hasSimCard_Async_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600';
sim.hasSimCard(env.SLOTID2, (err, data) => {
if (err) {
console.log(`${CASE_NAME} finish`);
expect().assertFail();
console.log(`${CASE_NAME} fail, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} , data : ${data}`);
expect().assertFail();
expect(data).assertFalse();
console.log(`${CASE_NAME} finish`);
done();
});
});
/**
* @tc.number Telephony_Sim_getVoiceMailNumber_Promise_0600
* @tc.name Test getVoiceMailNumber slotId exception input parameter 2, check the callback
* value, and expect to enter ERR
* @tc.number Telephony_Sim_hasSimCard_Promise_0600
* @tc.name Test the slotId exception input parameter 2 of the hasSimCard interface,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_getVoiceMailNumber_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getVoiceMailNumber_Promise_0600';
let data;
it('Telephony_Sim_hasSimCard_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_hasSimCard_Promise_0600';
try {
data = await sim.getVoiceMailNumber(env.SLOTID2);
let data = await sim.hasSimCard(env.SLOTID2);
expect(data).assertFalse();
} catch (err) {
console.log(`${CASE_NAME} finish`);
expect().assertFail();
console.log(`${CASE_NAME} fail, err: ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME}, data : ${data}`);
expect().assertFail();
console.log(`${CASE_NAME} finish`);
done();
});
/**
* @tc.number Telephony_Sim_setVoiceMailInfo_Async_0400
* @tc.name Test the setVoiceMailInfo async callback interface, slotId is 2, expect enter error.
* @tc.desc Function test
*/
it('Telephony_Sim_setVoiceMailInfo_Async_0400', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_setVoiceMailInfo_Async_0400';
sim.setVoiceMailInfo(env.SLOTID2, env.MAIL_NAME_LEN12, env.MAIL_NUMBER_LEN20, error => {
if (error) {
console.log(`${CASE_NAME} setVoiceMailInfo expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
} else {
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
}
done();
});
});
/**
* @tc.number Telephony_Sim_setVoiceMailInfo_Promise_0400
* @tc.name Test the setVoiceMailInfo promise interface, slotId is 2, expect enter error.
* @tc.desc Function test
*/
it('Telephony_Sim_setVoiceMailInfo_Promise_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_setVoiceMailInfo_Promise_0400';
try {
await sim.setVoiceMailInfo(env.SLOTID2, env.MAIL_NAME_LEN12, env.MAIL_NUMBER_LEN20);
console.log(`${CASE_NAME} test fail.`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} setVoiceMailInfo expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_getMaxSimCount_0100
......@@ -1517,45 +427,6 @@ describe('SimManagerTest', function () {
done();
});
/**
* @tc.number Telephony_Sim_GetLockState_Async_0300
* @tc.name Test the GetLockState async callback interface, enter parameter 2
* for slotId exception, check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_GetLockState_Async_0300', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_GetLockState_Async_0300';
sim.getLockState(env.SLOTID2, sim.PIN_LOCK, error => {
if (error) {
console.log(`${CASE_NAME} getLockState expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
done();
return;
}
console.log(`${CASE_NAME} test fail`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_GetLockState_Promise_0300
* @tc.name Test the GetLockState promise interface, enter parameter 2
* for slotId exception, check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_GetLockState_Promise_0300', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_GetLockState_Promise_0300';
try {
await sim.getLockState(env.SLOTID2, sim.PIN_LOCK);
console.log(`${CASE_NAME} test fail`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} getLockState expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_GetCardType_Async_0400
......@@ -1597,85 +468,9 @@ describe('SimManagerTest', function () {
done();
});
/**
* @tc.number Telephony_Sim_SendEnvelopeCmd_Async_0300
* @tc.name Test SendEnvelopeCmd async callback interface, enter parameter 2
* for slotId exception, check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_SendEnvelopeCmd_Async_0300', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_SendEnvelopeCmd_Async_0300';
sim.sendEnvelopeCmd(env.SLOTID2, env.STK_CMD, (error) => {
if (error) {
console.log(`${CASE_NAME} SendEnvelopeCmd expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
done();
return;
}
console.log(`${CASE_NAME} test fail`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_SendEnvelopeCmd_Promise_0300
* @tc.name Test SendEnvelopeCmd promise interface, enter parameter 2
* for slotId exception, check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_SendEnvelopeCmd_Promise_0300', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_SendEnvelopeCmd_Promise_0300';
try {
await sim.sendEnvelopeCmd(env.SLOTID2, env.STK_CMD);
console.log(`${CASE_NAME} test fail`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} SendEnvelopeCmd expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_SendTerminalResponseCmd_Async_0300
* @tc.name Test SendTerminalResponseCmd async callback interface, enter parameter 2
* for slotId exception, check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_SendTerminalResponseCmd_Async_0300', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_SendTerminalResponseCmd_Async_0300';
sim.sendTerminalResponseCmd(env.SLOTID2, env.STK_CMD, (error) => {
if (error) {
console.log(`${CASE_NAME} SendTerminalResponseCmd expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
done();
return;
}
console.log(`${CASE_NAME} test fail`);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_SendTerminalResponseCmd_Promise_0300
* @tc.name Test SendTerminalResponseCmd promise interface, enter parameter 2
* for slotId exception, check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_SendTerminalResponseCmd_Promise_0300', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_SendTerminalResponseCmd_Promise_0300';
try {
await sim.sendTerminalResponseCmd(env.SLOTID2, env.STK_CMD);
console.log(`${CASE_NAME} test fail`);
expect().assertFail();
} catch (error) {
console.log(`${CASE_NAME} SendTerminalResponseCmd expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
}
done();
});
/**
* @tc.number Telephony_Sim_hasOperatorPrivileges_Async_0400
......@@ -1716,44 +511,4 @@ describe('SimManagerTest', function () {
}
done();
});
/**
* @tc.number Telephony_Sim_unlockSimLock_Async_2600
* @tc.name Test the unlocksimLock interface slotId exception into parameter 2, view the callback result
* @tc.desc Function test
*/
it('Telephony_Sim_unlockSimLock_Async_2600', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_unlockSimLock_Async_2600';
const lockInfo = { lockType: sim.PN_PIN_LOCK, password: env.SIM_PN_PIN_PASSWORD };
sim.unlockSimLock(env.SLOTID2, lockInfo, (error) => {
if (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish.`);
done();
return;
}
expect().assertFail();
console.log(`${CASE_NAME} test fail.`);
done();
});
});
/**
* @tc.number Telephony_Sim_unlockSimLock_Promise_2600
* @tc.name Test the unlocksimLock interface slotId exception into parameter 2, view the return result
* @tc.desc Function test
*/
it('Telephony_Sim_unlockSimLock_Promise_2600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_unlockSimLock_Promise_2600';
const lockInfo = { lockType: sim.PN_PIN_LOCK, password: env.SIM_PN_PIN_PASSWORD };
try {
await sim.unlockSimLock(env.SLOTID2, lockInfo);
expect().assertFail();
console.log(`${CASE_NAME} test fail.`);
} catch (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish.`);
}
done();
});
});
\ No newline at end of file
})
......@@ -38,337 +38,6 @@ describe('SmsMmsErrorTest', function () {
const TRUE_SLOT_ID = 0;
const RECEIVE_SMS_PDU = '240D91689141468496F600001270721142432302B319';
/*
* @tc.number Telephony_SmsMms_addSimMessage_Async_0200
* @tc.name When SLOTID is the wrong value,Failed to save SMS to SIM
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Async_0200', 0, async function (done) {
let data = {
slotId: FALSE_SLOT_ID,
smsc: '',
pdu: CORRECT_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_SENT
};
sms.addSimMessage(data, (err, result) => {
if (err) {
console.log('Telephony_SmsMms_addSimMessage_Async_0200 finish');
done();
return;
}
expect().assertFail();
console.log('Telephony_SmsMms_addSimMessage_Async_0200 fail');
done();
});
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Promise_0200
* @tc.name When SLOTID is the wrong value,Failed to save SMS to SIM
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Promise_0200', 0, async function (done) {
let data = {
slotId: FALSE_SLOT_ID,
smsc: '',
pdu: CORRECT_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_SENT
};
try {
await sms.addSimMessage(data);
expect().assertFail();
console.log('Telephony_SmsMms_addSimMessage_Promise_0200 fail');
done();
} catch (err) {
console.log('Telephony_SmsMms_addSimMessage_Promise_0200 finish');
done();
}
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Async_1400
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_READ,
* Save a text message to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Async_1400', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: RECEIVE_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_READ
};
sms.addSimMessage(data, (addErr) => {
if (addErr) {
console.log('Telephony_SmsMms_addSimMessage_Async_1400 finish');
done();
return;
}
console.log('Telephony_SmsMms_addSimMessage_Async_1400 add fail ');
});
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Promise_1400
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_READ,
* Save a text message to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Promise_1400', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: RECEIVE_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_READ
};
try {
await sms.addSimMessage(data);
console.log('Telephony_SmsMms_addSimMessage_Promise_1400 fail ');
} catch (err) {
console.log('Telephony_SmsMms_addSimMessage_Promise_1400 addSimMessage finish');
done();
}
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Async_1700
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNSENT,Set the PDU read type
* Description Failed to add SMS messages to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Async_1700', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: RECEIVE_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_UNSENT
};
sms.addSimMessage(data, (addErr) => {
if (addErr) {
sms.getAllSimMessages(TRUE_SLOT_ID, (getErr, getResult) => {
if (getErr) {
console.log('Telephony_SmsMms_addSimMessage_Async_1700 getAllSimMessages fail');
done();
return;
}
expect(getResult.length == 0).assertTrue();
console.log('Telephony_SmsMms_addSimMessage_Async_1700 getAllSimMessages getResult.length = '
+ getResult.length);
console.log('Telephony_SmsMms_addSimMessage_Async_1700 getAllSimMessages finish');
done();
});
} else {
console.log('Telephony_SmsMms_addSimMessage_Async_1700 addSimMessage fail');
done();
}
});
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Promise_1700
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNSENT,Set the PDU read type
* Description Failed to add SMS messages to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Promise_1700', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: RECEIVE_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_UNSENT
};
try {
await sms.addSimMessage(data);
console.log('Telephony_SmsMms_addSimMessage_Promise_1700 add fail');
done();
return;
} catch (err) {
console.log('Telephony_SmsMms_addSimMessage_Promise_1700 finish ');
done();
}
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Async_1800
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNREAD,Set the PDU sending type
* Description Failed to add SMS messages to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Async_1800', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: CORRECT_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_UNREAD
};
sms.addSimMessage(data, (addErr) => {
if (addErr) {
sms.getAllSimMessages(TRUE_SLOT_ID, (getErr, getResult) => {
if (getErr) {
console.log('Telephony_SmsMms_addSimMessage_Async_1800 getAllSimMessages fail');
done();
return;
}
expect(getResult.length == 0).assertTrue();
console.log('Telephony_SmsMms_addSimMessage_Async_1800 getAllSimMessages getResult = ' + getResult.length);
console.log('Telephony_SmsMms_addSimMessage_Async_1800 getAllSimMessages finish');
done();
});
} else {
console.log('Telephony_SmsMms_addSimMessage_Async_1800 addSimMessage fail');
done();
}
});
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Promise_1800
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNREAD,Set the PDU sending type
* Description Failed to add SMS messages to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Promise_1800', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: CORRECT_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_UNREAD
};
try {
await sms.addSimMessage(data);
console.log('Telephony_SmsMms_addSimMessage_Promise_1800 add fail');
done();
} catch (err) {
console.log('Telephony_SmsMms_addSimMessage_Promise_1800 finish ');
done();
}
});
/**
* @tc.number Telephony_SmsMms_delSimMessage_Async_0200
* @tc.name When SLOTID is the wrong value,Deletes a text message from the SIM card fail
* @tc.desc Function test
*/
it('Telephony_SmsMms_delSimMessage_Async_0200', 0, async function (done) {
sms.delSimMessage(FALSE_SLOT_ID, 0, (err) => {
if (err) {
console.log('Telephony_SmsMms_delSimMessage_Async_0200 delSimMessage finish');
done();
return;
}
expect().assertFail();
console.log('Telephony_SmsMms_delSimMessage_Async_0200 fail');
done();
});
});
/**
* @tc.number Telephony_SmsMms_delSimMessage_Promise_0200
* @tc.name When SLOTID is the wrong value,Deletes a text message from the SIM card fail
* @tc.desc Function test
*/
it('Telephony_SmsMms_delSimMessage_Promise_0200', 0, async function (done) {
try {
await sms.delSimMessage(FALSE_SLOT_ID, 0);
expect().assertFail();
console.log('Telephony_SmsMms_delSimMessage_Promise_0200 fail');
done();
} catch (err) {
console.log('Telephony_SmsMms_delSimMessage_Promise_0200 finish');
done();
}
});
/**
* @tc.number Telephony_SmsMms_updateSimMessage_Async_0100
* @tc.name When SLOTID is the wrong value,Failed to update SIM card SMS record
* @tc.desc Function test
*/
it('Telephony_SmsMms_updateSimMessage_Async_0100', 0, async function (done) {
let upData = {
slotId: FALSE_SLOT_ID,
msgIndex: 0,
newStatus: sms.SIM_MESSAGE_STATUS_SENT,
pdu: CORRECT_SMS_PDU,
smsc: ''
};
sms.updateSimMessage(upData, (err) => {
if (err) {
console.log('Telephony_SmsMms_updateSimMessage_Async_0100 update finish');
done();
return;
}
expect().assertFail();
console.log('Telephony_SmsMms_updateSimMessage_Async_0100 update fail');
done();
});
});
/**
* @tc.number Telephony_SmsMms_updateSimMessage_Promise_0100
* @tc.name When SLOTID is the wrong value,Failed to update SIM card SMS record
* @tc.desc Function test
*/
it('Telephony_SmsMms_updateSimMessage_Promise_0100', 0, async function (done) {
let upData = {
slotId: FALSE_SLOT_ID,
msgIndex: 0,
newStatus: sms.SIM_MESSAGE_STATUS_SENT,
pdu: CORRECT_SMS_PDU,
smsc: ''
};
try {
await sms.updateSimMessage(upData);
expect().assertFail();
console.log('Telephony_SmsMms_updateSimMessage_Promise_0100 fail');
done();
return;
} catch (err) {
console.log('Telephony_SmsMms_updateSimMessage_Promise_0100 getAllSimMessages cur finish');
done();
}
});
/**
* @tc.number Telephony_SmsMms_getAllSIMMessages_Async_0200
* @tc.name When "SLOTID" is an error value,Failed to query all SMS records for SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_getAllSIMMessages_Async_0200', 0, async function (done) {
sms.getAllSimMessages(FALSE_SLOT_ID, (err, result) => {
if (err) {
expect().assertFail();
console.log('Telephony_SmsMms_getAllSIMMessages_Async_0200 fail');
done();
return;
}
if (result.length > 0) {
except(result[0].shortMessage != null).assertTrue();
except(result[0].indexOnSim != -1).assertTrue();
}
expect(result === undefined || result.length === 0).assertTrue();
console.log('Telephony_SmsMms_getAllSIMMessages_Async_0200 finish');
done();
});
});
/**
* @tc.number Telephony_SmsMms_getAllSIMMessages_Promise_0200
* @tc.name When "SLOTID" is an error value,Failed to query all SMS records for SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_getAllSIMMessages_Promise_0200', 0, async function (done) {
try {
let promise = await sms.getAllSimMessages(FALSE_SLOT_ID);
expect(promise === null || promise === undefined || promise.length === 0).assertTrue();
console.log('Telephony_SmsMms_getAllSIMMessages_Promise_0200 getAllSimMessages cur finish');
done();
} catch (err) {
expect().assertFail();
console.log('Telephony_SmsMms_getAllSIMMessages_Promise_0200 fail');
done();
}
});
/*
* @tc.number Telephony_SmsMms_createMessage_Async_0200
......@@ -400,35 +69,6 @@ describe('SmsMmsErrorTest', function () {
});
});
/*
* @tc.number Telephony_SmsMms_sendMessage_0200
* @tc.name Call the interface sendMessage, set the card slot parameter "slotId" to FALSE_SLOT_ID,
* SMS failed to send
* @tc.desc Function test
*/
it('Telephony_SmsMms_sendMessage_0200', 0, async function (done) {
sms.sendMessage({
slotId: FALSE_SLOT_ID,
destinationHost: SMS_SEND_DST_NUMBER,
serviceCenter: '',
content: 'hello',
destinationPort: 0,
sendCallback: (err, value) => {
if (err) {
expect().assertFail();
console.log('Telephony_SmsMms_sendMessage_0200 fail');
done();
return;
}
console.log(`sendCallback success sendResult = ${value.result}`);
expect(value.result === sms.SEND_SMS_FAILURE_UNKNOWN).assertTrue();
expect(value.isLastPart != true).assertTrue();
console.log('Telephony_SmsMms_sendMessage_0200 finish');
done();
},
deliveryCallback: () => {}
});
});
/*
* @tc.number Telephony_SmsMms_createMessage_Promise_0200
......@@ -449,152 +89,7 @@ describe('SmsMmsErrorTest', function () {
}
});
/**
* @tc.number Telephony_SmsMms_setSmscAddr_Async_0200
* @tc.name When "SLOTID" is an error value,Failed to set short message service address
* @tc.desc Function test
*/
it('Telephony_SmsMms_setSmscAddr_Async_0200', 0, async function (done) {
sms.setSmscAddr(FALSE_SLOT_ID, '', (err) => {
if (err) {
console.log('Telephony_SmsMms_setSmscAddr_Async_0200 finish');
done();
return;
}
expect().assertFail();
console.log('Telephony_SmsMms_setSmscAddr_Async_0200 fail');
done();
});
});
/**
* @tc.number Telephony_SmsMms_setSmscAddr_Promise_0200
* @tc.name When "SLOTID" is an error value,Failed to set short message service address
* @tc.desc Function test
*/
it('Telephony_SmsMms_setSmscAddr_Promise_0200', 0, async function (done) {
try {
await sms.setSmscAddr(FALSE_SLOT_ID, '');
expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Promise_0200 fail');
done();
} catch (err) {
console.log('Telephony_SmsMms_createMessage_Promise_0200 finish ');
done();
}
});
/**
* @tc.number Telephony_SmsMms_getSmscAddr_Async_0200
* @tc.name When "SLOTID" is an error value,Failed to get SMS service address
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSmscAddr_Async_0200', 0, async function (done) {
sms.getSmscAddr(FALSE_SLOT_ID, (err, getResult) => {
if (err) {
expect().assertFail();
console.log('Telephony_SmsMms_getSmscAddr_Async_0200 fail');
done();
return;
}
expect(getResult === undefined || getResult === '');
console.log('Telephony_SmsMms_getSmscAddr_Async_0200 finish');
done();
});
});
/**
* @tc.number Telephony_SmsMms_getSmscAddr_Promise_0200
* @tc.name When "SLOTID" is an error value,Failed to get SMS service address
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSmscAddr_Promise_0200', 0, async function (done) {
try {
let promise = await sms.getSmscAddr(FALSE_SLOT_ID);
expect(promise === undefined || promise === '');
console.log('Telephony_SmsMms_getSmscAddr_Promise_0200 finish');
done();
} catch (err) {
console.log('Telephony_SmsMms_getSmscAddr_Promise_0200 fail');
expect().assertFail();
done();
}
});
/*
* @tc.number Telephony_SmsMms_getSmsSegmentsInfo_Async_2000
* @tc.name The passed argument is an error slotId, view the results
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSmsSegmentsInfo_Async_2000', 0, async function (done) {
let message = '';
for (let index = 0;index < MAX_CHINESE_MESSAGE_LENTH + 1;index++) {
message += '';
}
sms.getSmsSegmentsInfo(FALSE_SLOT_ID, message, true, (error, result) => {
if (error) {
console.log("Telephony_SmsMms_getSmsSegmentsInfo_Async_2000 getSmsSegmentsInfo error " + error.message);
console.log('Telephony_SmsMms_getSmsSegmentsInfo_Async_2000 finish');
} else {
expect().assertFail();
console.log('Telephony_SmsMms_getSmsSegmentsInfo_Async_2000 fail');
}
done();
});
});
/*
* @tc.number Telephony_SmsMms_getSmsSegmentsInfo_Promise_2000
* @tc.name The passed argument is an error slotId, view the results
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSmsSegmentsInfo_Promise_2000', 0, async function (done) {
let message = '';
for (let index = 0;index < MAX_MESSAGE_LENTH;index++) {
message += 'a';
}
try {
let result = await sms.getSmsSegmentsInfo(FALSE_SLOT_ID, message, true);
console.log('Telephony_SmsMms_getSmsSegmentsInfo_Promise_2000 fail');
expect().assertFail();
} catch (err) {
console.log('Telephony_SmsMms_getSmsSegmentsInfo_Promise_2000 finish');
}
done();
});
/*
* @tc.number Telephony_SmsMms_isImsSmsSupported_Async_0100
* @tc.name Check whether the Ims SMS function is supported
* @tc.desc Function test
*/
it('Telephony_SmsMms_isImsSmsSupported_Async_0100', 0, async function (done) {
sms.isImsSmsSupported((error, result) => {
if (error) {
console.log('Telephony_SmsMms_isImsSmsSupported_Async_0100 fail');
} else {
expect(result === false || result === true).assertTrue();
console.log('Telephony_SmsMms_isImsSmsSupported_Async_0100 finish');
}
done();
});
});
/*
* @tc.number Telephony_SmsMms_isImsSmsSupported_Promise_0100
* @tc.name Check whether the Ims SMS function is supported
* @tc.desc Function test
*/
it('Telephony_SmsMms_isImsSmsSupported_Promise_0100', 0, async function (done) {
try {
let result = await sms.isImsSmsSupported();
expect(result === false || result === true).assertTrue();
console.log('Telephony_SmsMms_isImsSmsSupported_Promise_0100 finish');
} catch (err) {
console.log('Telephony_SmsMms_isImsSmsSupported_Promise_0100 fail');
}
done();
});
/*
* @tc.number Telephony_SmsMms_hasSmsCapability_0100
......@@ -608,279 +103,6 @@ describe('SmsMmsErrorTest', function () {
done();
});
/*
* @tc.number Telephony_SmsMms_getImsShortMessageFormat_Async_0100
* @tc.name call the interface to obtain SMS system
* @tc.desc Function test
*/
it('Telephony_SmsMms_getImsShortMessageFormat_Async_0100', 0, async function (done) {
sms.getImsShortMessageFormat((error, result) => {
if (error) {
console.log('Telephony_SmsMms_getImsShortMessageFormat_Async_0100 fail');
expect().assertFail();
} else {
expect(result === undefined || result === '').assertTrue();
console.log('Telephony_SmsMms_getImsShortMessageFormat_Async_0100 result = ' + result);
console.log('Telephony_SmsMms_getImsShortMessageFormat_Async_0100 finish');
}
done();
});
});
/*
* @tc.number Telephony_SmsMms_getImsShortMessageFormat_Promise_0100
* @tc.name call the interface to obtain SMS system
* @tc.desc Function test
*/
it('Telephony_SmsMms_getImsShortMessageFormat_Promise_0100', 0, async function (done) {
try {
let result = await sms.getImsShortMessageFormat();
expect(result === undefined || result === '').assertTrue();
console.log('Telephony_SmsMms_getImsShortMessageFormat_Async_0100 result = ' + result);
console.log('Telephony_SmsMms_getImsShortMessageFormat_Promise_0100 finish');
} catch (err) {
expect().assertFail();
console.log('Telephony_SmsMms_getImsShortMessageFormat_Promise_0100 fail');
}
done();
});
/*
* @tc.number Telephony_SmsMms_splitMessage_Async_1600
* @tc.name Call the interface, set message to empty, and see the result
* @tc.desc Function test
*/
it('Telephony_SmsMms_splitMessage_Async_1600', 0, async function (done) {
let message = '';
sms.splitMessage(message, (error, result) => {
if (error) {
console.log("Telephony_SmsMms_splitMessage_Async_1600 splitMessage on error because " + error.message);
console.log('Telephony_SmsMms_splitMessage_Async_1600 fail');
} else {
console.log("Telephony_SmsMms_splitMessage_Async_1600 splitMessage on value = " + JSON.stringify(result));
expect(result === undefined || result.length === 0).assertTrue();
console.log('Telephony_SmsMms_splitMessage_Async_1600 finish');
}
done();
});
});
/*
* @tc.number Telephony_SmsMms_splitMessage_Promise_1600
* @tc.name Call the interface, set message to empty, and see the result
* @tc.desc Function test
*/
it('Telephony_SmsMms_splitMessage_Promise_1600', 0, async function (done) {
let message = '';
try {
let result = await sms.splitMessage(message);
console.log('Telephony_SmsMms_splitMessage_Promise_1600 finish');
expect(result === undefined || result.length === 0).assertTrue();
} catch (err) {
console.log('Telephony_SmsMms_splitMessage_Promise_1600 fail');
}
done();
});
/**
* @tc.number Telephony_SmsMms_decodeMms_Async_1000
* @tc.name Passing in the exception path, Parse failure
* @tc.desc Function test
*/
it('Telephony_SmsMms_decodeMms_Async_1000', 0, async function (done) {
sms.decodeMms(eorroMessagePath, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_decodeMms_Async_1000 finish');
done();
return;
}
expect().assertFail();
console.log('Telephony_SmsMms_decodeMms_Async_1000 fail');
done();
});
});
/**
* @tc.number Telephony_SmsMms_decodeMms_Promise_1000
* @tc.name Passing in the exception path, Parse failure
* @tc.desc Function test
*/
it('Telephony_SmsMms_decodeMms_Promise_1000', 0, async function (done) {
try {
await sms.decodeMms(eorroMessagePath);
console.log('Telephony_SmsMms_decodeMms_Promise_1000 fail');
expect().assertFail();
done();
} catch (err) {
console.log('Telephony_SmsMms_decodeMms_Promise_1000 finish');
done();
}
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Async_0900
* @tc.name ReadOrigInd type MMS, encoding after decoding, the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Async_0900', 0, async function (done) {
let mmsType = {
version: sms.MMS_VERSION_1_1,
messageId: "0001",
to: [{address: "+861388888****/TYPE=PLMN", charset: sms.UTF_8}],
"from": {address: "+861381234****/TYPE=PLMN", charset: sms.UTF_8},
readStatus: 129,
date: 1639378126,
};
sms.encodeMms({messageType: sms.TYPE_MMS_READ_ORIG_IND, mmsType}, (err, encodeData) =>{
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0900 encodeMms fail');
done();
return;
}
console.log('Telephony_SmsMms_encodeMms_Async_0900 encodeMms finish');
sms.decodeMms(encodeData, (err, data) => {
if (err) {
console.log('Telephony_SmsMms_encodeMms_Async_0900 fail');
done();
return;
}
expect(data.messageType === sms.TYPE_MMS_READ_ORIG_IND).assertTrue();
expect(data.mmsType.version === sms.MMS_VERSION_1_1).assertTrue();
expect(data.mmsType.messageId === '0001').assertTrue();
expect(data.mmsType.to.length > 0).assertTrue();
expect(data.mmsType.to[0].address.length > 0).assertTrue();
expect(data.mmsType.to[0].charset === sms.UTF_8).assertTrue();
expect(data.mmsType.from.address.length > 0).assertTrue();
expect(data.mmsType.from.charset === sms.UTF_8).assertTrue();
expect(data.mmsType.date > 0).assertTrue();
expect(data.mmsType.readStatus === 129).assertTrue();
console.log('Telephony_SmsMms_encodeMms_Async_0900 finish');
done();
});
});
});
/**
* @tc.number Telephony_SmsMms_encodeMms_Promise_0900
* @tc.name ReadOrigInd type MMS, encoding after decoding, the content after decoding and coding before the same
* @tc.desc Function test
*/
it('Telephony_SmsMms_encodeMms_Promise_0900', 0, async function (done) {
let mmsType = {
version: sms.MMS_VERSION_1_1,
messageId: "0001",
to: [{address: "+861388888****/TYPE=PLMN", charset: sms.UTF_8}],
"from": {address: "+861381234****/TYPE=PLMN", charset: sms.UTF_8},
date: 1639378126,
readStatus: 129,
};
try {
let encodePromise = await sms.encodeMms({messageType: sms.TYPE_MMS_READ_ORIG_IND, mmsType});
expect(encodePromise.length > 0).assertTrue();
console.log('Telephony_SmsMms_encodeMms_Promise_0900 encodeMms finish');
let promise = await sms.decodeMms(encodePromise);
expect(promise.messageType === sms.TYPE_MMS_READ_ORIG_IND).assertTrue();
expect(promise.mmsType.version === sms.MMS_VERSION_1_1).assertTrue();
expect(promise.mmsType.messageId === '0001').assertTrue();
expect(promise.mmsType.to.length > 0).assertTrue();
expect(promise.mmsType.to[0].address.length > 0).assertTrue();
expect(promise.mmsType.to[0].charset === sms.UTF_8).assertTrue();
expect(promise.mmsType.from.address.length > 0).assertTrue();
expect(promise.mmsType.from.charset === sms.UTF_8).assertTrue();
expect(promise.mmsType.date > 0).assertTrue();
expect(promise.mmsType.readStatus === 129).assertTrue();
console.log('Telephony_SmsMms_decodeMms_Promise_0900 finish');
done();
} catch (err) {
console.log('Telephony_SmsMms_decodeMms_Promise_0900 fail');
done();
}
});
/**
* @tc.number Telephony_SmsMms_setCBConfig_Async_0600
* @tc.name When "SLOTID" is an error value,Failed to set up cell broadcast
* @tc.desc Function test
*/
it('Telephony_SmsMms_setCBConfig_Async_0600', 0, async function (done) {
let data = {
slotId: FALSE_SLOT_ID,
enable: true,
startMessageId: IDENTIFIER_MIN,
endMessageId: IDENTIFIER_MAX,
ranType: RANTYPE_GSM
};
sms.setCBConfig(data, (err) => {
if (err) {
console.log(`Telephony_SmsMms_setCBConfig_Async_0600 finish err : ${err.message}`);
done();
return;
}
expect().assertFail();
console.log('Telephony_SmsMms_setCBConfig_Async_0600 fail');
done();
});
});
/**
* @tc.number Telephony_SmsMms_setCBConfig_Promise_0600
* @tc.name When "SLOTID" is an error value,Failed to set up cell broadcast
* @tc.desc Function test
*/
it('Telephony_SmsMms_setCBConfig_Promise_0600', 0, async function (done) {
let data = {
slotId: FALSE_SLOT_ID,
enable: true,
startMessageId: IDENTIFIER_MIN,
endMessageId: IDENTIFIER_MAX,
ranType: RANTYPE_GSM
};
try {
await sms.setCBConfig(data);
expect().assertFail();
console.log('Telephony_SmsMms_setCBConfig_Promise_0600 fail');
done();
} catch (err) {
console.log('Telephony_SmsMms_setCBConfig_Promise_0600 finish');
done();
}
});
/**
* @tc.number Telephony_SmsMms_setDefaultSmsSlotId_Async_0200
* @tc.name The default card slot ID is set to an error value,Failed to set send SMS card slot ID
* @tc.desc Function test
*/
it('Telephony_SmsMms_setDefaultSmsSlotId_Async_0200', 0, async function (done) {
sms.setDefaultSmsSlotId(FALSE_SLOT_ID, (err) => {
if (err) {
console.log('Telephony_SmsMms_setDefaultSmsSlotId_Async_0200 finish');
done();
return;
}
expect().assertFail();
console.log('Telephony_SmsMms_setDefaultSmsSlotId_Async_0200 fail');
done();
});
});
/**
* @tc.number Telephony_SmsMms_setDefaultSmsSlotId_Promise_0200
* @tc.name The default card slot ID is set to an error value,Failed to set send SMS card slot ID
* @tc.desc Function test
*/
it('Telephony_SmsMms_setDefaultSmsSlotId_Promise_0200', 0, async function (done) {
try {
await sms.setDefaultSmsSlotId(FALSE_SLOT_ID);
expect().assertFail();
console.log('Telephony_SmsMms_setDefaultSmsSlotId_Promise_0200 fail');
done();
return;
} catch (err) {
console.log('Telephony_SmsMms_setDefaultSmsSlotId_Promise_0200 finish');
done();
}
});
/**
* @tc.number Telephony_SmsMms_getDefaultSmsSlotId_Async_0100
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册