diff --git a/telephony/telephonyjstest/BUILD.gn b/telephony/telephonyjstest/BUILD.gn index a4e956d92b194386db411e736309a3bc96d2b4f2..ec73d6e22617ba9db396a3a22256d17a49a0c008 100644 --- a/telephony/telephonyjstest/BUILD.gn +++ b/telephony/telephonyjstest/BUILD.gn @@ -16,14 +16,16 @@ group("telephonyjstest") { deps = [ "call_manager:call_manager", "cellular_data:cellular_data", - "contact_function:ActsContactFunctionEtsTest", - "contact_function_merge:ActsContactFunctionMergeEtsTest", - "contact_performance:ActsContactPerformanceEtsTest", - "contact_stability:ActsContactStabilityEtsTest", + + #"contact_function:ActsContactFunctionEtsTest", + #"contact_function_merge:ActsContactFunctionMergeEtsTest", + #"contact_performance:ActsContactPerformanceEtsTest", + #"contact_stability:ActsContactStabilityEtsTest", "netmanager_http:ActsNetManagerHttpEtsTest", "netmanager_socket:ActsNetManagerSocketEtsTest", "network_search:network_search", - "new_add:ActsNewAddEtsTest", + "observer:ActsObserverEtsTest", + "radiostatistic:ActsRadiostatisticEtsTest", "sim:sim", "sms_mms:sms_mms", ] diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js index b4782c54aed8d7d22ddf9304c9173300f5645ca5..294c2584535bde87cf47110e93d70b824babb59d 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js +++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js @@ -183,126 +183,7 @@ describe('CallManageImsCall', function () { callDetailsChangeOff(); 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,1083 +372,175 @@ 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.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) => { - if (error) { - console.log(`${caseName} updateImsCallMode2 error,case success,error:${toString(error)}`); - done(); - return; - } - expect().assertFail(); - console.log(`${caseName} updateImsCallMode2 success,case failed,data:${toString(data)}`); - done(); - }); - }); /** - * @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.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_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(); + 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} 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)}`); - done(); - return; - } - expect().assertFail(); - console.log(`${caseName} holdCall success,case failed,data:${toString(data)}`); + 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_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 => { - expect().assertFail(); - console.log(`${caseName} holdCall success,case failed,data:${toString(data)}`); - done(); + 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} 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)}`); - done(); - return; - } - expect().assertFail(); - console.log(`${caseName} unHoldCall success,case failed,data:${toString(data)}`); + 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(); - }); - }); - - /** - * @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.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 => { + 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} unHoldCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`); - done(); - }); + } 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_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_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)}`); - done(); - return; - } - expect().assertFail(); - console.log(`${caseName} switchCall ${CALL_ID_NOT_EXIST} success,case failed,data:${toString(data)}`); + 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(); - }); - }); - - /** - * @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.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 => { + 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} switchCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`); - done(); - }); + } catch (error) { + console.log(`${caseName} error,case success,error:${toString(error)}`); + } + hangupCall2(caseName, done, callId); }); /** - * @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_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_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; + it('Telephony_CallManager_setDisplayWindow_Promise_0300', 0, async function (done) { + let caseName = 'Telephony_CallManager_setDisplayWindow_Promise_0300'; try { let data = await scenceInCalling({ caseName:caseName, @@ -1575,130 +548,45 @@ describe('CallManageImsCall', function () { 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)}`); + console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); done(); + return; } - }); - - /** - * @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; try { - let data = await scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER, - 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(() => { + 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} success,case failed`); - done(); - }).catch(error => { + } 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(); - }); + } + hangupCall2(caseName, done, callId); }); /** - * @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.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_startDTMF_Promise_1300', 0, function (done) { - let caseName = 'Telephony_CallManager_IMS_startDTMF_Promise_1300'; + it('Telephony_CallManager_setCameraZoom_Async_0400', 0, function (done) { + let caseName = 'Telephony_CallManager_setCameraZoom_Async_0400'; scenceInCalling({ caseName:caseName, - phoneNumber:PHONE_NUMBER_LENGTH_11, + phoneNumber:AUTO_ACCEPT_NUMBER2, 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)}`); + 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} case success`); - hangupCall2(caseName, done, callId); }); }).catch(error => { console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); @@ -1707,277 +595,152 @@ describe('CallManageImsCall', function () { }); /** - * @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)}`); - 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) { - 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(); - }); - }); - - /** - * @tc.number Telephony_CallManager_cancelMuted_Async_0300 - * @tc.name Unwanted state,run function cancelMuted by callback,the function return error + * @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_cancelMuted_Async_0300', 0, function (done) { - let caseName = 'Telephony_CallManager_cancelMuted_Async_0300'; - call.cancelMuted((error, data) => { - if (error) { - console.log(`${caseName} error,case success,error:${toString(error)}`); - done(); - return; - } - console.log(`${caseName} success,case failed,data:${toString(data)}`); - expect().assertFail(); + 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_cancelMuted_Promise_0300 - * @tc.name Unwanted state,run function cancelMuted by promise,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_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)}`); - done(); + 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); }); - }); - - /** - * @tc.number Telephony_CallManager_isNewCallAllowed_Async_0200 - * @tc.name Unwanted state ,run the function isNewCallAllowed by callback ,the function return true - * @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(); - done(); - return; - } - console.log(`${caseName} success,case ${data === true ? 'success' : 'failed'},data:${toString(data)}`); - expect(data === true).assertTrue(); + }).catch(error => { + console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); done(); }); }); /** - * @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_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_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 => { - console.log(`${caseName} error,case failed,error:${toString(error)}`); - expect().assertFail(); - done(); + 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_isRinging_Async_0100 - * @tc.name Unwanted state ,run the function isRinging by callback ,the function return false + * @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_isRinging_Async_0100', 0, function (done) { - let caseName = 'Telephony_CallManager_isRinging_Async_0100'; - call.isRinging(function (error, data) { - if (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(); - done(); - return; - } - console.log(`${caseName} success,case ${data === false ? 'success' : 'failed'},data:${toString(data)}`); - expect(data === false).assertTrue(); + hangupCall2(caseName, done, callId); + }); + }).catch(error => { + console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); done(); }); }); /** - * @tc.number Telephony_CallManager_isRinging_Promise_0100 - * @tc.name Unwanted state ,run the function isRinging by promise ,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_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)}`); - expect().assertFail(); - done(); + 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); }); /** @@ -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 diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js index ff9e708de1dde69cea7df08ded4c334fc0cb0ac8..33f2b52461b6268ba2688d41e1a7b3d4562a5f7c 100644 --- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js +++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js @@ -56,83 +56,7 @@ describe("ActsCellularDataAbnormalTest", function () { done(); }) }) - - /* - * @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 @@ -170,26 +94,7 @@ describe("ActsCellularDataAbnormalTest", function () { done(); }) }) - - /* - * @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) diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 0da9c54105c1cdd0a4120940982c7f065f00f911..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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. - */ - -//contact import -import CalllogTest from './contact/Calllog_test.js' -import ContactCardTest from './contact/ContactCard_test.js' -import ContactsTest from './contact/Contacts_test.js' -import GroupsTest from './contact/Groups_test.js' -import ObjectInterfaceTest from './contact/ObjectInterface_test.js' -import RecoveryTest from './contact/recovery_test.js' -import VoicemailTest from './contact/Voicemail_test.js' -import ContactClassTest from './contact/ContactClass_test.js' -import ContacterTest from './contact/ContacterJsunit.ets' - -export default function testsuite() { - //contact - ContactClassTest(); - ContacterTest(); - CalllogTest(); - ContactCardTest(); - ContactsTest(); - GroupsTest(); - ObjectInterfaceTest(); - RecoveryTest(); - VoicemailTest(); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Calllog_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Calllog_test.js deleted file mode 100644 index d94514f7e2727ece1161260a90192a1b4737713e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Calllog_test.js +++ /dev/null @@ -1,1361 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CALLLOG = "dataability:///com.ohos.calllogability"; -const calllogUri = "dataability:///com.ohos.calllogability/calls/calllog"; -import common from './common.js'; - -export default function CalllogTest() { - describe('CalllogTest', function () { - console.log("----------CalllogTest is starting!----------"); - - async function calllogQueryForALL(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': calllogQueryByInsert start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' : logMessage calllogQueryByInsert key = ' + key + - ' dbResult :' + dbresult + ' value : ' + value); - console.info(tag + ' : logMessage calllogQueryByInsert value ' + (value == dbresult)); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - console.info(tag + " :logMessage calllogQueryByInsert: end"); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage calllogQueryByInsert: error = " + error); - } - } - - async function calllogQueryForDelete(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': calllogQueryForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage calllogQueryForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage calllogQueryForDelete: error = " + error); - } - } - - async function calllogQueryForBatchInsert(array, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': calllogQueryForBatchInsert start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", array[0].get("phone_number")); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - var size = array.size(); - console.info(tag + ' : logMessage calllogQueryForBatchInsert: size' + size); - expect(resultSet.rowCount == size).assertEqual(true); - var i = 0; - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of array[i]) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' : logMessage calllogQueryForBatchInsert dbresult :' + dbresult + - ' value : ' + value); - console.info(tag + ' : logMessage calllogQueryForBatchInsert value ' + (value == dbresult)); - expect(value == dbresult).assertTrue(); - } - i++; - } while (resultSet.goToNextRow()); - } - - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage calllogQueryByInsert: error = " + error); - } - } - - async function callLogDelete(tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info(tag + ': callLogDelete deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } - - /** - * @tc.number calllog_insert_test_100 - * @tc.name Insert call log - * @tc.desc Function test - */ - it("calllog_insert_test_100", 0, async function (done) { - console.info("--------logMessage calllog_insert_test_100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_insert_test_100: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = common.getCallLogInsertMap() - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_insert_test_100"); - await callLogDelete("calllog_insert_test_100"); - done(); - } catch (error) { - console.info("logMessage calllog_insert_test_100: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_update_test_400 - * @tc.name Single call log update - * @tc.desc Function test - */ - it("calllog_update_test_400", 0, async function (done) { - console.info("--------logMessage calllog_update_test_400 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_update_test_400: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await updateOneCalllog(); - done(); - } catch (error) { - console.info("logMessage calllog_update_test_400: calllog insert error = " + error); - done(); - } - ; - - async function updateOneCalllog() { - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - var updateCode = await DAHelper.update(calllogUri, common.getCallLogUpdate(), condition); - console.info("logMessage calllog_update_test_400: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = common.getCallLogUpdateMap(); - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_update_test_400"); - await callLogDelete("calllog_update_test_400"); - } catch (error) { - console.info("logMessage calllog_update_test_400: update error = " + error); - done(); - } - ; - } - }); - - /** - * @tc.number calllog_update_test_500 - * @tc.name Update all call logs - * @tc.desc Function test - */ - it("calllog_update_test_500", 0, async function (done) { - console.info("--------logMessage calllog_update_test_500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1122445566", "ring_duration": "500" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_update_test_500: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await updateAllCalllog(); - done(); - } catch (error) { - console.info("logMessage calllog_update_test_500: calllog insert error = " + error); - done(); - } - ; - async function updateAllCalllog() { - var updateValues = { - "answer_state": "1" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var updateCode = await DAHelper.update(calllogUri, updateValues, condition) - console.info("logMessage calllog_update_test_500: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map([["phone_number", "1122445566"], ["ring_duration", "500"]]) - map.set("id", calllogId.toString()); - map.set("answer_state", "1"); - await calllogQueryForALL(map, "calllog_update_test_500"); - await callLogDelete("calllog_update_test_500"); - } catch (error) { - console.info("logMessage calllog_update_test_500: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_delete_test_1300 - * @tc.name Delete call log - * @tc.desc Function test - */ - it("calllog_delete_test_1300", 0, async function (done) { - console.info("--------logMessage calllog_delete_test_1300 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "123456", "ring_duration": "200" - }; - try { - var callLogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_delete_test_1300: callLogId = " + callLogId); - expect(callLogId > 0).assertTrue(); - await deleteOneCallLog(); - done(); - } catch (error) { - console.info("logMessage calllog_delete_test_1300: calllog insert error = " + error); - done(); - } - - async function deleteOneCallLog() { - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info("logMessage calllog_delete_test_1300: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - await calllogQueryForDelete(map, "calllog_delete_test_1300"); - } catch (error) { - console.info("logMessage calllog_delete_test_1300: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_batchInset_test_1600 - * @tc.name Insert call logs in batches - * @tc.desc Function test - */ - it("calllog_batchInset_test_1600", 0, async function (done) { - console.info("--------logMessage calllog_batchInset_test_1600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "phone_number": "1600", "ring_duration": "333" - }; - var addBulkValue2 = { - "phone_number": "1600", "ring_duration": "600" - }; - var addBulkValue3 = { - "phone_number": "1600", "ring_duration": "600" - }; - var addBulkValue4 = { - "phone_number": "1600", "ring_duration": "600" - }; - var addBulkValue5 = { - "phone_number": "1600", "ring_duration": "600" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - console.info("logMessage calllog_batchInset_test_1600: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await calllogQueryForBatchInsert(common.getCallLogBatchInsert(), "calllog_batchInset_test_1600"); - await callLogDelete("calllog_batchInset_test_1600"); - done(); - } catch (error) { - console.info("logMessage calllog_batchInset_test_1600: error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_query_test_1200 - * @tc.name Query all call logs - * @tc.desc Function test - */ - it("calllog_query_test_1200", 0, async function (done) { - console.info("------------calllog_query_test_1200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "123566456", "ring_duration": "200" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_query_test_1200: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = new Map([["phone_number", "123566456"], ["ring_duration", "200"]]); - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_query_test_1200"); - await callLogDelete("calllog_query_test_1200"); - done(); - } catch (error) { - console.info("logMessage calllog_query_test_1200: calllog insert error = " + error); - } - }); - - /** - * @tc.number calllog_query_test_1100 - * @tc.name Query call logs of combined conditions - * @tc.desc Function test - */ - it("calllog_query_test_1100", 0, async function (done) { - console.info("------------calllog_query_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "44325008", "ring_duration": "100" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_query_test_1100: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryCalllog(); - await callLogDelete("calllog_query_test_1100"); - done() - } catch (error) { - console.info("logMessage calllog_query_test_1100: calllog insert error = " + error); - done(); - } - - async function queryCalllog() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.lessThan("ring_duration", "200").orderByAsc("id"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_query_test_1100: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_query_test_1100: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_query_test_1100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info('logMessage calllog_query_test_1100: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "44325008").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_query_test_1100: query error:" + error); - done(); - } - } - }); - - /** - * @tc.number calllog_query_test_800 - * @tc.name Query a single call log - * @tc.desc Function test - */ - it("calllog_query_test_800", 0, async function (done) { - console.info("------------calllog_query_test_800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "88888888888", "ring_duration": "100" - }; - try { - var callLogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_query_test_800: callLogId = " + callLogId); - expect(callLogId > 0).assertTrue(); - await queryOneCallLog(); - await callLogDelete("calllog_query_test_800"); - done(); - } catch (error) { - console.info("logMessage calllog_query_test_800: calllog insert error = " + error); - done(); - } - - async function queryOneCallLog() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_query_test_800: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_query_test_800: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_query_test_800: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info('logMessage calllog_query_test_800: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "88888888888").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_query_test_800: query error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_fuzzyquery_test_100 - * @tc.name Fuzzy query ability based on mobile phone number (beginning of a certain field) - * @tc.desc Function test - */ - it("calllog_fuzzyquery_test_100", 0, async function (done) { - console.info("------------calllog_fuzzyquery_test_100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "196320147" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_fuzzyquery_test_100: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryByStartsWithPhoneNumber(); - await callLogDelete("calllog_fuzzyquery_test_100"); - done(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_100: calllog insert error = " + error); - done(); - } - - async function queryByStartsWithPhoneNumber() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phone_number", "196%"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_fuzzyquery_test_100: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_fuzzyquery_test_100: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_fuzzyquery_test_100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info( - 'logMessage calllog_fuzzyquery_test_100: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "196320147").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_100: query error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_fuzzyquery_test_200 - * @tc.name Fuzzy query ability based on mobile phone number (at the end of a certain field) - * @tc.desc Function test - */ - it("calllog_fuzzyquery_test_200", 0, async function (done) { - console.info("------------calllog_fuzzyquery_test_200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "126467821" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_fuzzyquery_test_200: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryByEndWithPhoneNumber(); - await callLogDelete("calllog_fuzzyquery_test_200"); - done(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_200: calllog insert error = " + error); - done(); - } - - async function queryByEndWithPhoneNumber() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phone_number", "%821"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_fuzzyquery_test_200: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_fuzzyquery_test_200: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_fuzzyquery_test_200: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info( - 'logMessage calllog_fuzzyquery_test_200: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "126467821").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_200: query error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_fuzzyquery_test_300 - * @tc.name Fuzzy query ability based on mobile phone number (including a certain field) - * @tc.desc Function test - */ - it("calllog_fuzzyquery_test_300", 0, async function (done) { - console.info("------------calllog_fuzzyquery_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1234567855557568" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_fuzzyquery_test_300: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryByPhoneNumberContainsField(); - await callLogDelete("calllog_fuzzyquery_test_300"); - done(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_300: calllog insert error = " + error); - done(); - } - - async function queryByPhoneNumberContainsField() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phone_number", "%555%"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_fuzzyquery_test_300: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_fuzzyquery_test_300: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_fuzzyquery_test_300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info( - 'logMessage calllog_fuzzyquery_test_300: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "1234567855557568").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_300: query error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_insert_test_200 - * @tc.name Abnormal use case, an incorrect field is passed in when inserting data - * @tc.desc Function test - */ - it("abnormal_calllog_insert_test_200", 0, async function (done) { - console.info("------------abnormal_calllog_insert_test_200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_numbers": "1111111111" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_insert_test_200: calllogId = " + calllogId); - expect(calllogId == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_insert_test_200: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_calllog_insert_test_300 - * @tc.name Abnormal use case, an incorrect table name is passed in when inserting data - * @tc.desc Function test - */ - it("abnormal_calllog_insert_test_300", 0, async function (done) { - console.info("------------abnormal_calllog_insert_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/calllogs"; - - var insertValues = { - "phone_number": "456789410" - }; - try { - var calllogId = await DAHelper.insert(errorUri, insertValues); - console.info("logMessage abnormal_calllog_insert_test_300: calllogId = " + calllogId); - expect(calllogId == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_insert_test_300: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_calllog_update_test_600 - * @tc.name Abnormal use case, passing in a wrong field when updating data - * @tc.desc Function test - */ - it("abnormal_calllog_update_test_600", 0, async function (done) { - console.info("------------abnormal_calllog_update_test_600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1020202020" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_update_test_600: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalUpdate(); - await callLogDelete("abnormal_calllog_update_test_600"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_600: calllog insert error = " + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "phone_numbers": "22001122" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogId.toString()); - try { - var updataCode = await DAHelper.update(calllogUri, updateValues, condition); - console.info("logMessage abnormal_calllog_update_test_600: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("phone_number", "1020202020"); - await calllogQueryForALL(map, "abnormal_calllog_update_test_600"); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_600: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_update_test_700 - * @tc.name Abnormal use case, an incorrect table name is passed in when updating data - * @tc.desc Function test - */ - it("abnormal_calllog_update_test_700", 0, async function (done) { - console.info("------------abnormal_calllog_update_test_700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/calllogs"; - - var insertValues = { - "phone_number": "9952364" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_update_test_700: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalUpdate(); - await callLogDelete("abnormal_calllog_update_test_700"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_700: calllog insert error = " + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "phone_numbers": "22001122" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - try { - var updataCode = await DAHelper.update(errorUri, updateValues, condition); - console.info("logMessage abnormal_calllog_update_test_700: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("phone_number", "9952364"); - await calllogQueryForALL(map, "abnormal_calllog_update_test_700"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_700: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_delete_test_1400 - * @tc.name Abnormal use case, passing in a wrong field when deleting data - * @tc.desc Function test - */ - it("abnormal_calllog_delete_test_1400", 0, async function (done) { - console.info("------------abnormal_calllog_delete_test_1400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "789130" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_delete_test_1400: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalDelete(); - await callLogDelete("abnormal_calllog_delete_test_1400"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_1400: calllog insert error = " + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogId.toString()); - try { - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info("logMessage abnormal_calllog_delete_test_1400: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("phone_number", "789130"); - await calllogQueryForALL(map, "abnormal_calllog_delete_test_1400"); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_1400: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_delete_test_1500 - * @tc.name Abnormal use case, passing in an incorrect table name when deleting data - * @tc.desc Function test - */ - it("abnormal_calllog_delete_test_1500", 0, async function (done) { - console.info("------------abnormal_calllog_delete_test_1500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/calllogs"; - - var insertValues = { - "phone_number": "1564721" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_delete_test_1500: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalDelete(); - await callLogDelete("abnormal_calllog_delete_test_1500"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_1500: calllog insert error = " + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - try { - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info("logMessage abnormal_calllog_delete_test_1500: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - done() - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("phone_number", "1564721"); - await calllogQueryForALL(map, "abnormal_calllog_delete_test_1500"); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_1500: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_query_test_900 - * @tc.name Abnormal use case, an incorrect field is passed in when querying - * @tc.desc Function test - */ - it("abnormal_calllog_query_test_900", 0, async function (done) { - console.info("------------abnormal_calllog_query_test_900 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1564721" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_query_test_900: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalQuery(); - await callLogDelete("abnormal_calllog_query_test_900"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_900: calllog insert error = " + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogId.toString()); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - console.info('logMessage abnormal_calllog_query_test_900: goToFirstRow' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow()).assertEqual(false); - resultSet.close(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_900:query error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_batchinsert_test_1700 - * @tc.name abnormal_batchinsert - * @tc.desc Function test - */ - it("abnormal_calllog_batchinsert_test_1700", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_batchinsert_test_1700 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "phone_number": "5555555555", "ring_duration": "500" - }; - var addBulkValue2 = { - "phone_number": "1511002", "ring_duration": "100" - }; - var addBulkValue3 = { - "phone_numbers": "1521003", "ring_duration": "100" - }; - var addBulkValue4 = { - "phone_number": "1521004", "ring_durations": "100" - }; - var addBulkValue5 = { - "phone_number": "1521005", "ring_duration": "100" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - console.info("logMessage abnormal_calllog_batchinsert_test_1700: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_batchinsert_test_1700: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_delete_test_1800 - * @tc.name batchDelete - * @tc.desc Function test - */ - it("calllog_delete_test_1800", 0, async function (done) { - console.info("--------logMessage calllog_delete_test_1800 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_delete_test_1800: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = common.getCallLogInsertMap() - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_delete_test_1800"); - await executeBatch(); - } catch (error) { - console.info("logMessage calllog_delete_test_1800: calllog insert error = " + error); - done(); - } - - async function executeBatch() { - console.info("logMessage calllog_delete_test_1800: executeBatch start "); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - DAHelper.executeBatch(URI_CALLLOG, [{ - uri: calllogUri, - type: featureAbility.DataAbilityOperationType.TYPE_DELETE, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage calllog_delete_test_1800: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage calllog_delete_test_1800: data_3 = " + data); - console.info("logMessage calllog_delete_test_1800: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - }; - }); - - /** - * @tc.number calllog_update_test_1900 - * @tc.name batchUpdate - * @tc.desc Function test - */ - it("calllog_update_test_1900", 0, async function (done) { - console.info("--------logMessage calllog_update_test_1900 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_update_test_1900: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = common.getCallLogInsertMap() - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_update_test_1900"); - await executeBatch(); - } catch (error) { - console.info("logMessage calllog_update_test_1900: calllog insert error = " + error); - done(); - } - - async function executeBatch() { - var updateValues = { - "phone_number": "123456789" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - DAHelper.executeBatch(URI_CALLLOG, [{ - uri: calllogUri, - type: featureAbility.DataAbilityOperationType.TYPE_UPDATE, - valuesBucket: updateValues, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage calllog_update_test_1900: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage calllog_update_test_1900: data_3 = " + data); - console.info("logMessage calllog_update_test_1900: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - }; - }); - - /** - * @tc.number calllog_Delete_test_2000 - * @tc.name calllog Delete - * @tc.desc Function test - */ - it("calllog_Delete_test_2000", 0, async function (done) { - console.info("--------logMessage calllog_Delete_test_2000 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "123456", "ring_duration": "200" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - var calllogIdThree = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - expect(calllogIdThree > 0).assertTrue(); - await deleteCalllog(); - done(); - } catch (error) { - console.info("logMessage calllog_Delete_test_2000: calllog insert error = " + error); - done(); - } - - async function deleteCalllog() { - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - condition.or(); - condition.equalTo("id", calllogIdTwo.toString()); - condition.or(); - condition.equalTo("id", calllogIdThree.toString()); - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info("logMessage calllog_Delete_test_2000: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var resultColumns = []; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_Delete_test_2000: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_Delete_test_2100 - * @tc.name calllog Delete - * @tc.desc Function test - */ - it("calllog_Delete_test_2100", 0, async function (done) { - console.info("--------logMessage calllog_Delete_test_2100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_Delete_test_2100: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = common.getCallLogInsertMap() - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_Delete_test_2100"); - await callLogDelete("calllog_Delete_test_2100"); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId); - var resultColumns = []; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage calllog_Delete_test_2100: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_queryContains_test_2200 - * @tc.name calllog Delete - * @tc.desc Function test - */ - it("calllog_queryContains_test_2200", 0, async function (done) { - console.info("--------logMessage calllog_queryContains_test_2200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "123456789220099999" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_queryContains_test_2200: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - - var resultColumns = ["phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.contains("phone_number", "99999"); - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var phone = resultSet.getString(resultSet.getColumnIndex("phone_number")); - console.info("logMessage calllog_queryContains_test_2200: phone is = " + phone); - expect(phone == "123456789220099999").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - await callLogDelete(); - done(); - } catch (error) { - console.info("logMessage calllog_queryContains_test_2200: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_calllog_update_test_2300 - * @tc.name Update all call records, pass in a field that does not exist - * @tc.desc Function test - */ - it("abnormal_calllog_update_test_2300", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_update_test_2300 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "15748646546", display_name: "name2300" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - await updateOneCalllog(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_2300: calllog insert error = " + error); - done(); - } - ; - async function updateOneCalllog() { - try { - var insertValues = { - phone_number: "15748646546", display_names: "nameUpdateError2300" - }; - var condition = - new ohosDataAbility.DataAbilityPredicates(); - var updateCode = await DAHelper.update(calllogUri, insertValues, condition); - console.info("logMessage abnormal_calllog_update_test_2300: updateCode = " + updateCode); - expect(updateCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("display_name", "name2300"); - await calllogQueryForALL(map, "abnormal_calllog_update_test_2300"); - map.set("id", calllogIdTwo.toString()); - await calllogQueryForALL(map, "abnormal_calllog_update_test_2300"); - await callLogDelete("calllog_update_test_2300"); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_2300: update error = " + error); - done(); - } - ; - } - }); - - /** - * @tc.number abnormal_calllog_query_test_2400 - * @tc.name When querying call records based on combined conditions, incorrect field - * names and non-existent data are passed in - * @tc.desc Function test - */ - it("abnormal_calllog_query_test_2400", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_query_test_2400 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "15748646546", display_name: "name2300" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString() + "ksks"); - var resultColumns = ["display_names"]; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - console.info("abnormal_calllog_query_test_2400: resultSet.rowCount = " + resultSet.rowCount); - expect(resultSet.rowCount == -1).assertTrue(); - resultSet.close(); - await callLogDelete("abnormal_calllog_query_test_2400"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_2400: calllog insert error = " + error); - done(); - } - ; - }); - - /** - * @tc.number abnormal_calllog_query_test_2500 - * @tc.name When querying all call records based on combined conditions, incorrect field - * names and non-existent data are passed in - * @tc.desc Function test - */ - it("abnormal_calllog_query_test_2500", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_query_test_2500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "15748646546", display_name: "name2300" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info('abnormal_calllog_query_test_2500 calllogId = ' + calllogId); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - console.info('abnormal_calllog_query_test_2500 calllogIdTwo = ' + calllogIdTwo); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var resultColumns = ["display_names"]; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - console.info('abnormal_calllog_query_test_2500 resultSet.goToFirstRow() = ' + resultSet.goToFirstRow()); - console.info('abnormal_calllog_query_test_2500 resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.goToFirstRow() == false).assertTrue(); - resultSet.close(); - await callLogDelete("abnormal_calllog_query_test_2500"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_2500: calllog insert error = " + error); - done(); - } - ; - }); - - /** - * @tc.number abnormal_calllog_delete_test_2600 - * @tc.name Batch call records are added, and some of them fail, depending on the processing logic - * @tc.desc Function test - */ - it("abnormal_calllog_delete_test_2600", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_delete_test_2600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "15748646546", display_name: "name2300" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_2600: calllog insert error = " + error); - done(); - } - ; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogIdTwo.toString()); - condition.or(); - condition.equalTo("id", calllogId.toString()); - var code = await DAHelper.delete(calllogUri, condition); - console.info("logMessage abnormal_calllog_delete_test_2600: code = " + code); - expect(code == -1).assertTrue(); - condition.clear(); - var resultColumns = []; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - var count = 2; - expect(resultSet.rowCount == count).assertTrue(); - resultSet.close(); - await callLogDelete("abnormal_calllog_delete_test_2600"); - done(); - }); - - /** - * @tc.number abnormal_calllog_update_test_2700 - * @tc.name When batch call records are modified, the wrong field or table name is passed in - * @tc.desc Function test - */ - it("abnormal_calllog_delete_test_2700", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "270015748646546", display_name: "name2700" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - await updateOneCalllog(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_2700: calllog insert error = " + error); - done(); - } - ; - async function updateOneCalllog() { - try { - var insertValues = { - phone_number: "270015748646546", display_names: "nameUpdateError2700" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogIdTwo.toString()); - condition.or(); - condition.equalTo("id", calllogId.toString()); - var updateCode = await DAHelper.update(calllogUri, insertValues, condition); - console.info("logMessage abnormal_calllog_delete_test_2700: updateCode = " + updateCode); - expect(updateCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("display_name", "name2700"); - await calllogQueryForALL(map, "abnormal_calllog_delete_test_2700"); - map.set("id", calllogIdTwo.toString()); - await calllogQueryForALL(map, "abnormal_calllog_delete_test_2700"); - await callLogDelete("abnormal_calllog_delete_test_2700"); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_2700: update error = " + error); - done(); - } - ; - } - }); - - /** - * @tc.number abnormal_calllog_query_test_2800 - * @tc.name Fuzzy search query based on mobile phone number - * @tc.desc Function test - */ - it("abnormal_calllog_query_test_2800", 0, async function (done) { - console.info("------------abnormal_calllog_query_test_2800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "196320147" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_query_test_2800: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryByStartsWithPhoneNumberError(); - await callLogDelete("abnormal_calllog_query_test_2800"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_2800: calllog insert error = " + error); - done(); - } - - async function queryByStartsWithPhoneNumberError() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phone_numbers", "196%"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - console.info("logMessage abnormal_calllog_query_test_2800: resultSet.rowCount = " + resultSet.rowCount); - expect(resultSet.rowCount == -1).assertTrue(); - resultSet.close(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_2800: query error = " + error); - done(); - } - } - }); - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('callllog afterAll logMessage get DAHelper success! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info('callllog afterAll end logMessage deleteCode = ' + deleteCode); - }); - }) -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactCard_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactCard_test.js deleted file mode 100644 index 7e25361d026a08e1d86164c14e95ab0780bc4f4f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactCard_test.js +++ /dev/null @@ -1,5441 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const profilecontactUri = "dataability:///com.ohos.contactsdataability/profile/contact"; -const profileRawContactUri = "dataability:///com.ohos.contactsdataability/profile/raw_contact"; -const profileContactDataUri = "dataability:///com.ohos.contactsdataability/profile/contact_data"; -const profileGroupUri = "dataability:///com.ohos.contactsdataability/profile/groups"; -const profileBlocklistUri = "dataability:///com.ohos.contactsdataability/profile/contact_blocklist"; -const profilesearchContactUri = "dataability:///com.ohos.contactsdataability/profile/search_contact"; -const profileDeletedContactsUri = "dataability:///com.ohos.contactsdataability/profile/deleted_raw_contact"; -const profileDeletedRawContactRecord = - "dataability:///com.ohos.contactsdataability/profile/deleted_raw_contact_record"; - -export default function ContactCardTest() { - describe('ContactCardTest', function () { - console.info("-------ContactsTest is starting!--------"); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - async function contactsQuery(map, tag, uri) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - sleep(2000); - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ':logMessage contactsQuery key = ' + key + ' dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - async function queryBatch(map, tag, size) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryBatch start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", map.get("raw_contact_id")); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - console.info(tag + ': queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage resultSet.rowCount: error = " + error); - } - } - - async function queryIdForDelete(map, tag, uri) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryIdForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - sleep(1000); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage queryIdForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - async function deleteAll(uri, tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(uri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info(tag + ': deleteAll error = ' + error); - } - } - - async function deleteRawContact(tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - var deleteCode = await DAHelper.delete(profileRawContactUri, condition); - console.info(tag + ': deleteRawContact deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - sleep(1000); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - var code = await DAHelper.delete(profileDeletedContactsUri, conditionAll); - console.info(tag + ': Completely delete code = ' + code); - expect(code == 0).assertTrue(); - } catch (error) { - console.info(tag + ': deleteRawContact error = ' + error); - } - } - - async function insertData(rawContactId, type, value, position) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var contactDataValues1 = - { - "raw_contact_id": rawContactId, "content_type": type, "detail_info": value, "position": position - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - console.info("logMessage : contactDataId " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage : contact_data name insert error = " + error); - } - return contactDataId; - } - - /** - * @tc.number contactCard_insert_test_100 - * @tc.name Insert contact data - * @tc.desc Function test - */ - it("contactCard_insert_test_100", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_insert_test_100: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insert_test_100", profileRawContactUri); - await deleteRawContact("contactCard_insert_test_100"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_100: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_insert_test_400 - * @tc.name Insert contact details (name, company, position, mobile phone number) - * @tc.desc Function test - */ - it("contactCard_insert_test_400", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataNameInsert(DAHelper, rawContactId); - await dataCompanyInsert(DAHelper, rawContactId); - await dataPhoneInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_400"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_400"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_400: raw_contact insert error = " + error); - done(); - } - }); - - async function dataNameInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaocheng" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - console.info("logMessage contactCard_insert_test_400: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "xiaocheng"); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insert_test_400", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_400: contact_data name insert error = " + error); - done(); - } - } - - async function dataCompanyInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "developer" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - console.info("logMessage contactCard_insert_test_400: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "TT"); - map.set("position", "developer"); - contactsQuery(map, "contactCard_insert_test_400", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_400: contact_data company insert error = " + error); - done(); - } - } - - async function dataPhoneInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "12345678" - }; - try { - var contactDataId3 = await DAHelper.insert(profileContactDataUri, contactDataValues3); - sleep(1000); - console.info("logMessage contactCard_insert_test_400: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "12345678"); - await contactsQuery(map, "contactCard_insert_test_400", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_400: contact_data phone insert error = " + error); - done(); - } - } - - /** - * @tc.number contactCard_insert_test_500 - * @tc.name Insert contact details (nickname, email, home) - * @tc.desc Function test - */ - it("contactCard_insert_test_500", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataEmailInsert(DAHelper, rawContactId); - await dataNickNameInsert(DAHelper, rawContactId); - await dataPostalAddressInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_500"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_500"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_500: raw_contact insert error = " + error); - done(); - } - }); - - async function dataEmailInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "166@163.com" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contactCard_insert_test_500: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "166@163.com"); - await contactsQuery(map, "contactCard_insert_test_500_1", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_500: contact_data email insert error = " + error); - } - } - - async function dataNickNameInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaocheng" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - console.info("logMessage contactCard_insert_test_500: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "xiaocheng"); - await contactsQuery(map, "contactCard_insert_test_500_2", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_500: contact_data nickname insert error = " + error); - } - } - - async function dataPostalAddressInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "NanJingSoftRoad" - }; - try { - var contactDataId3 = await DAHelper.insert(profileContactDataUri, contactDataValues3); - console.info("logMessage contactCard_insert_test_500: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "NanJingSoftRoad"); - await contactsQuery(map, "contactCard_insert_test_500_3", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_500: contact_data postal_address insert error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_600 - * @tc.name Insert contact details (remarks, AIM, birthday) - * @tc.desc Function test - */ - it("contactCard_insert_test_600", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues) - console.info("logMessage contactCard_insert_test_600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataNoteInsert(DAHelper, rawContactId); - await dataAimInsert(DAHelper, rawContactId); - await dataEventInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_600"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_600"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_600: raw_contact insert error = " + error); - done(); - } - }); - - async function dataNoteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "note", - "detail_info": "javaGangster" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - console.info("logMessage contactCard_insert_test_600: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "javaGangster"); - await contactsQuery(map, "contactCard_insert_test_600_1", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_600: contact_data note insert error = " + error); - done(); - } - } - - async function dataAimInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, "content_type": "im", "detail_info": "aaaaa" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - console.info("logMessage contactCard_insert_test_600: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "aaaaa"); - await contactsQuery(map, "contactCard_insert_test_600_2", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_600: contact_data aim insert error = " + error); - } - } - - async function dataEventInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "contact_event", - "detail_info": "19960229" - }; - try { - var contactDataId3 = await DAHelper.insert(profileContactDataUri, contactDataValues3); - console.info("logMessage contactCard_insert_test_600: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "19960229"); - await contactsQuery(map, "contactCard_insert_test_600_3", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_600: contact_data event insert error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_700 - * @tc.name Insert contact details (URL, assistant, group) - * @tc.desc Function test - */ - it("contactCard_insert_test_700", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataWebsiteInsert(DAHelper, rawContactId); - await dataRelationInsert(DAHelper, rawContactId); - await dataWebsiteInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_700"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_700"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_700: raw_contact insert error = " + error); - done(); - } - }); - - async function dataWebsiteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "website", - "detail_info": "www.com" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contactCard_insert_test_700: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "www.com"); - await contactsQuery(map, "contactCard_insert_test_700_1", profileContactDataUri); - await contactDataRelationInsert(); - } catch (error) { - console.info("logMessage contactCard_insert_test_700: contact_data website insert error = " + error); - } - } - - async function dataRelationInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "relation", - "detail_info": "Secretary" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - sleep(1000); - console.info("logMessage contactCard_insert_test_700: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "Secretary"); - await contactsQuery(map, "contactCard_insert_test_700_2", profileContactDataUri); - await contactDataGroupInsert(); - } catch (error) { - console.info("logMessage contactCard_insert_test_700: contact_data relation insert error = " + error); - } - } - - async function dataGroupInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": "1" - }; - try { - var contactDataId3 = await DAHelper.insert(profileContactDataUri, contactDataValues3); - sleep(1000); - console.info("logMessage contactCard_insert_test_700: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "1"); - await contactsQuery(map, "contactCard_insert_test_700_3", profileContactDataUri); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_700: contact_data group insert error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_800 - * @tc.name Insert contact details (phone ringtone) - * @tc.desc Function test - */ - it("contactCard_insert_test_800", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataMiscInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_800"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_800"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_800: raw_contact insert error = " + error); - done(); - } - }); - - async function dataMiscInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_misc", - "detail_info": "1234" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contactCard_insert_test_800: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "1234"); - await contactsQuery(map, "contactCard_insert_test_800_1", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_800: contact_data misc insert error = " + error); - } - } - - /** - * @tc.number contactCard_update_test_900 - * @tc.name Update contact data - * @tc.desc Function test - */ - it("contactCard_update_test_900", 0, async function (done) { - console.info("------logMessage contactCard_update_test_900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "licheng", - "company": "TT", - "position": "developer", - "favorite": 1, - "phonetic_name": "licheng||lc" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_900"); - await deleteAll(profileContactDataUri, "contactCard_update_test_900"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_900: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactUpdate(DAHelper, rawContactId) { - var updateValues = { - "display_name": "dacheng", - "company": "oo", - "position": "Testers", - "favorite": 0, - "phonetic_name": "dacheng||dc" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_900: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "dacheng"); - map.set("company", "oo"); - map.set("position", "Testers"); - map.set("favorite", "0"); - map.set("phonetic_name", "dacheng||dc"); - await contactsQuery(map, "contactCard_update_test_900", profileRawContactUri); - } catch (error) { - console.info('logMessage contactCard_update_test_900: raw_contact update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1200 - * @tc.name Update contact details (name) - * @tc.desc Function test - */ - it("contactCard_update_test_1200", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNameInsert(DAHelper, rawContactId); - await dataNameUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1200"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1200"); - done(); - } catch (error) { - console.info('logMessage contactCard_update_test_1200: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataNameInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "xiaoyuan" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1200: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1200: contact_data insert error = ' + error); - } - } - - async function dataNameUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "dayuan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1200: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "dayuan"); - await contactsQuery(map, "contactCard_update_test_1200", profileRawContactUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1200: contact_data update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1300 - * @tc.name Update contact details (company, position) - * @tc.desc Function test - */ - it("contactCard_update_test_1300", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataCompanyInsert(DAHelper, rawContactId); - await dataCompanyUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1300"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1300"); - done(); - } catch (error) { - console.info('logMessage contactCard_update_test_1300: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataCompanyInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "Testers", - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1300: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1300: contact_data insert error = ' + error); - } - } - - async function dataCompanyUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "OOOO", "position": "developer" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1300: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("company", "OOOO"); - map.set("position", "developer"); - await contactsQuery(map, "contactCard_update_test_1300", profileRawContactUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1300: contact_data update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1400 - * @tc.name Update contact details (mobile phone number) - * @tc.desc Function test - */ - it("contactCard_update_test_1400", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataPhoneInsert(DAHelper, rawContactId); - await dataPhoneUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1400"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1400"); - done(); - } catch (error) { - console.info('logMessage contactCard_update_test_1400: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforeDataPhoneInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "phone", "detail_info": "123456" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1400: contact_data insert error = ' + error); - } - } - - async function dataPhoneUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "99663355" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1400: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "99663355"); - await contactsQuery(map, "contactCard_update_test_1400", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1400: contact_data update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1500 - * @tc.name Update contact details (nickname) - * @tc.desc Function test - */ - it("contactCard_update_test_1500", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNickNameInsert(DAHelper, rawContactId); - await dataNickNameUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1500"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1500"); - done(); - } catch (error) { - console.info('logMessage contactCard_update_test_1500: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataNickNameInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaoyuan" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1500: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1500: contact_data insert error = ' + error); - } - } - - async function dataNickNameUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "fengyuan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1500: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "fengyuan"); - await contactsQuery(map, "contactCard_update_test_1500", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1500: contact_data update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1600 - * @tc.name Update contact details (email) - * @tc.desc Function test - */ - it("contactCard_update_test_1600", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataEmailInsert(DAHelper, rawContactId); - await dataEmailUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1600"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1600"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_1600: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataEmailInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "166@163.com" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1600: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1600: contact_data insert error = ' + error); - } - } - - async function dataEmailUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "199@163.com" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition) - sleep(1000); - console.info('logMessage contactCard_update_test_1600: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "199@163.com"); - await contactsQuery(map, "contactCard_update_test_1600", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1600: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1700 - * @tc.name Update Contact Details (Residential) - * @tc.desc Function test - */ - it("contactCard_update_test_1700", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataPostalInsert(DAHelper, rawContactId); - await dataPostalUpdate(); - await deleteRawContact("contactCard_update_test_1700"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1700"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_1700: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataPostalInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "NanJing" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1700: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_update_test_1700: contact_data insert error = " + error); - } - } - - async function dataPostalUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "BeiJing" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1700: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "BeiJing"); - await contactsQuery(map, "contactCard_update_test_1700", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1700: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1800 - * @tc.name Update contact details (remarks) - * @tc.desc Function test - */ - it("contactCard_update_test_1800", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNoteInsert(DAHelper, rawContactId); - await dataNoteUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1800"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1800"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_1800: raw_contact insert error = " + error); - done(); - } - }); - - async function beforedataNoteInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "note", "detail_info": "Gangster" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1800: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1800: contact_data insert error = ' + error); - } - } - - async function dataNoteUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "God" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1800: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "God"); - await contactsQuery(map, "contactCard_update_test_1800", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1800: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1900 - * @tc.name Update Contact Details (AIM) - * @tc.desc Function test - */ - it("contactCard_update_test_1900", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues) - console.info("logMessage contactCard_update_test_1900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataAimInsert(DAHelper, rawContactId); - await dataAimUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1900"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1900"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_1900: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataAimInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "im", "detail_info": "aaaaa" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1900: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_update_test_1900: contact_data insert error = " + error); - } - } - - async function dataAimUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "bbbbb" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1900: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "bbbbb"); - await contactsQuery(map, "contactCard_update_test_1900", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1900: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2000 - * @tc.name Update Contact Details (Birthday) - * @tc.desc Function test - */ - it("contactCard_update_test_2000", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_2000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataEventInsert(DAHelper, rawContactId); - await dataEventUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2000"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2000"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2000: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataEventInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_event", - "detail_info": "19960229" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contactCard_update_test_2000: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2000: contact_data insert error = ' + error); - } - } - - async function dataEventUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "19971021" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2000: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "19971021"); - await contactsQuery(map, "contactCard_update_test_2000", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2000: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2100 - * @tc.name Update contact details (website) - * @tc.desc Function test - */ - it("contactCard_update_test_2100", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_2100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataWebsiteInsert(DAHelper, rawContactId); - await dataWebsiteUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2100"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2100"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2100: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataWebsiteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "website", - "detail_info": "www.com" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contactCard_update_test_2100: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2100: contact_data insert error = ' + error); - } - } - - async function dataWebsiteUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "www.123.com" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2100: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "www.123.com"); - await contactsQuery(map, "contactCard_update_test_2100", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2100: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2200 - * @tc.name Update contact details (assistant) - * @tc.desc Function test - */ - it("contactCard_update_test_2200", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_2200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataRelationInsert(DAHelper, rawContactId); - await dataRelationUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2200"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2200"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2200: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataRelationInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "relation", - "detail_info": "Secretary" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_update_test_2200: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2200: contact_data insert error = ' + error); - } - } - - async function dataRelationUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "spouse" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2200: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "spouse"); - await contactsQuery(map, "contactCard_update_test_2200", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2200: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2300 - * @tc.name Update contact detail data table (group) - * @tc.desc Function test - */ - it("contactCard_update_test_2300", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_2300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataGroupInsert(DAHelper, rawContactId); - await dataGroupUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2300"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2300"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2300: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataGroupInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": "2" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_2300: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2300: contact_data insert error = ' + error); - } - } - - async function dataGroupUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "7" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2300: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "3"); - await contactsQuery(map, "contactCard_update_test_2300", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2300: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2400 - * @tc.name Update contact detail data table (phone ringtone) - * @tc.desc Function test - */ - it("contactCard_update_test_2400", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contactCard_update_test_2400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataMiscInsert(DAHelper, rawContactId); - await dataMiscUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2400"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2400"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2400: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataMiscInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_misc", - "detail_info": "1234" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contactCard_update_test_2400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2400: contact_data insert error = ' + error); - } - } - - async function dataMiscUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "999" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2400: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "999"); - await contactsQuery(map, "contactCard_update_test_2300", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2400: update error = ' + error); - } - } - - /** - * @tc.number contactCard_favorite_test_2500 - * @tc.name Favorite contacts - * @tc.desc Function test - */ - it("contactCard_favorite_test_2500", 0, async function (done) { - console.info("-------logMessage contactCard_favorite_test_2500 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaocai", "company": "TT", "position": "Testers" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues) - console.info('logMessage contactCard_favorite_test_2500: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await updateFavorite(DAHelper, rawContactId); - await deleteRawContact("contactCard_favorite_test_2500"); - done(); - } catch (error) { - console.info('logMessage contactCard_favorite_test_2500: raw_contact insert error = ' + error); - done(); - } - }); - - async function updateFavorite(DAHelper, rawContactId) { - var updateValues = { - "favorite": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contactCard_favorite_test_2500: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaocai"); - map.set("company", "TT"); - map.set("position", "Testers"); - map.set("favorite", "1"); - await contactsQuery(map, "contactCard_favorite_test_2500", profileRawContactUri); - } catch (error) { - console.info('logMessage contactCard_favorite_test_2500: update error = ' + error); - } - } - - /** - * @tc.number contactCard_unfavorite_test_2600 - * @tc.name Unfavorite contacts - * @tc.desc Function test - */ - it("contactCard_unfavorite_test_2600", 0, async function (done) { - console.info("-------logMessage contactCard_unfavorite_test_2600 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaohong", "company": "TT", "position": "Testers", "favorite": 1 - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info('logMessage contactCard_unfavorite_test_2600: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await updateUnFavorite(DAHelper, rawContactId); - await deleteRawContact("contactCard_unfavorite_test_2600"); - done(); - } catch (error) { - console.info('logMessage contactCard_unfavorite_test_2600: raw_contact insert error = ' + error); - done(); - } - }); - - async function updateUnFavorite(DAHelper, rawContactId) { - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contactCard_unfavorite_test_2600: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaohong"); - map.set("company", "TT"); - map.set("position", "Testers"); - map.set("favorite", "0"); - await contactsQuery(map, "contactCard_favorite_test_2500", profileRawContactUri); - } catch (error) { - console.info("logMessage contactCard_unfavorite_test_2600: update error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_2700 - * @tc.name Insert contact black list - * @tc.desc Function test - */ - it("contactCard_insert_test_2700", 0, async function (done) { - console.info("-------logMessage contactCard_insert_test_2700 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var blocklistId = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - sleep(1000); - console.info('logMessage contactCard_insert_test_2700: blocklistId = ' + blocklistId); - expect(blocklistId > 0).assertTrue(); - var map = common.getProfileBlockListMap(); - map.set("id", blocklistId.toString()); - await contactsQuery(map, "contactCard_insert_test_2700", profileBlocklistUri); - await deleteAll(profileBlocklistUri, "contactCard_insert_test_2700"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_2700: blocklist insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_delete_test_2800 - * @tc.name Delete contact black list - * @tc.desc Function test - */ - it("contactCard_delete_test_2800", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_2800 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var blocklistId = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - sleep(1000); - console.info('logMessage contactCard_delete_test_2800: blocklistId = ' + blocklistId); - expect(blocklistId > 0).assertTrue(); - await blocklistDelete(); - done(); - } catch (error) { - console.info('logMessage contactCard_delete_test_2800: blocklist insert error = ' + error); - done(); - } - - async function blocklistDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", blocklistId.toString()); - try { - var deleteCode = await DAHelper.delete(profileBlocklistUri, condition); - sleep(1000); - console.info("logMessage contactCard_delete_test_2800: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", blocklistId.toString()); - await queryIdForDelete(map, "contactCard_delete_test_2800", profileBlocklistUri); - } catch (error) { - console.info('logMessage contactCard_delete_test_2800: delete error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_insert_test_2900 - * @tc.name Insert contact group - * @tc.desc Function test - */ - it("contactCard_insert_test_2900", 0, async function (done) { - console.info("-------logMessage contactCard_insert_test_2900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var groupValues = { - "group_name": "TestersThird" - }; - try { - var groupId = await DAHelper.insert(profileGroupUri, groupValues); - sleep(1000); - console.info("logMessage contactCard_insert_test_2900: groupId =" + groupId); - expect(groupId > 0).assertTrue(); - await groupRawContactInsert(DAHelper); - await deleteRawContact("contactCard_insert_test_2900"); - await deleteAll(profileGroupUri, "contactCard_insert_test_2900"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_2900"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_2900: group insert error =" + error); - done(); - } - }); - - async function groupRawContactInsert(DAHelper) { - var rawContactValues = { - "display_name": "liyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_insert_test_2900: rawContactId =" + rawContactId); - expect(rawContactId > 0).assertTrue(); - await groupDataInsert(DAHelper, rawContactId); - } catch (error) { - console.info("logMessage contactCard_insert_test_2900: raw_contact insert error =" + error); - } - } - - async function groupDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues) - sleep(1000); - console.info("logMessage contactCard_insert_test_2900: contactDataId =" + contactDataId); - expect(contactDataId > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId); - map.set("raw_contact_id", rawContactId.toString()); - map.set("detail_info", groupId.toString()); - await contactsQuery(map, "contactCard_insert_test_2900", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_2900: contact_data insert error =" + error); - } - } - - /** - * @tc.number contactCard_delete_test_3000 - * @tc.name Delete contact group - * @tc.desc Function test - */ - it("contactCard_delete_test_3000", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_3000 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var groupValues = { - "group_name": "TestersFourth" - }; - try { - var groupId = await DAHelper.insert(profileGroupUri, groupValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_3000: groupId =" + groupId); - expect(groupId > 0).assertTrue(); - await groupAfterRawContactInsert(DAHelper); - await deleteRawContact("contactCard_delete_test_3000"); - await deleteAll(profileGroupUri, "contactCard_delete_test_3000"); - await deleteAll(profileContactDataUri, "contactCard_delete_test_3000"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_3000: group insert error =" + error); - done(); - } - }); - - async function groupAfterRawContactInsert(DAHelper) { - var rawContactValues = { - "display_name": "liyuchen" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_3000: rawContactId =" + rawContactId); - expect(rawContactId > 0).assertTrue(); - await deleteGroupContactDataInsert(DAHelper, rawContactId); - } catch (error) { - console.info("logMessage contactCard_delete_test_3000: raw_contact insert error =" + error); - } - } - - async function deleteGroupContactDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info("logMessage contactCard_delete_test_3000: contactDataId =" + contactDataId); - expect(contactDataId > 0).assertTrue(); - await deleteGroup(DAHelper, contactDataId); - } catch (error) { - console.info("logMessage contactCard_delete_test_3000: contact_data insert error =" + error); - } - } - - async function deleteGroup(DAHelper, contactDataId) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - try { - var deleteCode = await DAHelper.delete(profileContactDataUri, condition); - sleep(1000); - console.info("logMessage contactCard_delete_test_3000: deleteCode =" + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - await queryIdForDelete(map, "contactCard_delete_test_3000", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_delete_test_3000: delete error =" + error); - } - } - - /** - * @tc.number contactCard_query_test_3100 - * @tc.name Query basic information of a single contact - * @tc.desc Function test - */ - it("contactCard_query_test_3100", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactQuery(DAHelper, rawContactId); - await deleteRawContact("contactCard_query_test_3100"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3100: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(2000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId).assertEqual(true); - console.info('logMessage contactCard_query_test_3100: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyu").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_3100: query error = " + error); - } - } - - /** - * @tc.number contactCard_query_test_3200 - * @tc.name Query basic information of multiple contacts - * @tc.desc Function test - */ - it("contactCard_query_test_3200", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues1 = { - "display_name": "xiaoyu" - }; - try { - var rawContactIdFirst = await DAHelper.insert(profileRawContactUri, rawContactValues1); - sleep(1000); - console.info("logMessage contactCard_query_test_3200: rawContactId = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3200: raw_contact_1 insert error = " + error); - done(); - } - - var rawContactValues2 = { - "display_name": "xiaohong" - }; - try { - var rawContactIdSecond = await DAHelper.insert(profileRawContactUri, rawContactValues2); - sleep(1000); - console.info("logMessage contactCard_query_test_3200: rawContactId = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await queryTwoRaw(DAHelper, rawContactIdFirst, rawContactIdSecond); - await deleteRawContact("contactCard_query_test_3200"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3200: raw_contact_2 insert error = " + error); - done(); - } - }); - - async function queryTwoRaw(DAHelper, rawContactIdFirst, rawContactIdSecond) { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactIdFirst.toString()); - condition.or(); - condition.equalTo("id", rawContactIdSecond.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - console.info('logMessage contactCard_query_test_3200: goToFirstRow' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow()).assertEqual(true); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage contactCard_query_test_3200: columnNames :" + resultSet.columnNames); - console.info("logMessage contactCard_query_test_3200: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_query_test_3200: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_query_test_3200: displayName = ' + resultSet.getString(1)); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_query_test_3200: query error' + error); - } - } - - /** - * @tc.number contactCard_query_test_3300 - * @tc.name Query basic information of all contacts - * @tc.desc Function test - */ - it("contactCard_query_test_3300", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3300 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues1 = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues1); - sleep(1000); - console.info("logMessage contactCard_query_test_3300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3300: raw_contact_1 insert error = " + error); - done(); - } - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contactCard_query_test_3300: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyu").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - await deleteRawContact("contactCard_query_test_3300"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3300: query error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_query_test_3400 - * @tc.name Query all information of a single contact - * @tc.desc Function test - */ - it("contactCard_query_test_3400", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3400 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyuzhou", - "company": "TT", - "position": "Testers", - "favorite": 1, - "phonetic_name": "xiaoyu||xy" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryAllInformation(DAHelper, rawContactId); - await deleteRawContact("contactCard_query_test_3400"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3400: raw_contact insert error = " + error); - done(); - } - }); - - async function queryAllInformation(DAHelper, rawContactId) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("id")); - console.info('logMessage contactCard_query_test_3400: id = ' + id); - expect(id == rawContactId).assertEqual(true); - var favorite = resultSet.getString(resultSet.getColumnIndex("favorite")); - console.info('logMessage contactCard_query_test_3400: favorite = ' + favorite); - expect(favorite == "1").assertEqual(true); - var phoneticName = resultSet.getString(resultSet.getColumnIndex("phonetic_name")); - console.info('logMessage contactCard_query_test_3400: phoneticName = ' + phonetic_name); - expect(phoneticName == "xiaoyu||xy").assertEqual(true); - var company = resultSet.getString(resultSet.getColumnIndex("company")); - console.info('logMessage contactCard_query_test_3400: company = ' + company); - expect(company == "TT").assertEqual(true); - var displayName = resultSet.getString(resultSet.getColumnIndex("display_name")); - console.info('logMessage contactCard_query_test_3400: displayName = ' + displayName); - expect(displayName == "xiaoyuzhou").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_query_test_3400: query error = ' + error); - } - } - - /** - * @tc.number contactCard_query_test_3500 - * @tc.name Query group member ability - * @tc.desc Function test - */ - it("contactCard_query_test_3500", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3500: raw_contact insert error = " + error); - done(); - } - var groupValues = { - "group_name": "BossBoard3500" - }; - try { - var groupId = await DAHelper.insert(profileGroupUri, groupValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3500: group insert error = " + error); - done(); - } - await groupBossBoardInsert(DAHelper, rawContactId, groupId); - await deleteRawContact("contactCard_query_test_3500"); - await deleteAll(profileGroupUri, "contactCard_query_test_3500"); - await deleteAll(profileContactDataUri, "contactCard_query_test_3500"); - done(); - }); - - async function groupBossBoardInsert(DAHelper, rawContactId, groupId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3500: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - await groupBossBoardQuery(DAHelper, rawContactId, groupId); - } catch (error) { - console.info("logMessage contactCard_query_test_3500: query error = " + error); - } - } - - async function groupBossBoardQuery(DAHelper, rawContactId, groupId) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 9 data is group - condition.equalTo("type_id", "9"); - condition.and(); - condition.equalTo("detail_info", groupId.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3500: raw_contact_id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId).assertEqual(true); - console.info('logMessage contactCard_query_test_3500: detail_info = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == groupId.toString()).assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_3500: query error :" + error); - } - } - - /** - * @tc.number contactCard_query_test_3600 - * @tc.name Query favorite contacts - * @tc.desc Function test - */ - it("contactCard_query_test_3600", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou", "favorite": 1 - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryFavorite(); - await deleteRawContact("contactCard_query_test_3600"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3600: raw_contact insert error = " + error); - done(); - } - - async function queryFavorite() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("favorite", "1"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3600: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_query_test_3600: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyuzhou").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_3600: query error :" + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_query_test_3700 - * @tc.name Query recent contact ability - * @tc.desc Function test - */ - it("contactCard_query_test_3700", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3700 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou", "lastest_contacted_time": 60 - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryContacted(); - await deleteRawContact("contactCard_query_test_3700"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3700: raw_contact insert error = " + error); - done(); - } - - async function queryContacted() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.lessThan("lastest_contacted_time", "100"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3700: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_query_test_3700: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyuzhou").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_query_test_3700: query error' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_query_test_3800 - * @tc.name Query recently deleted contacts - * @tc.desc Function test - */ - it("contactCard_query_test_3800", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3800 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaocai" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactDelete(DAHelper, rawContactId); - await deletedRawContactQuery(DAHelper, rawContactId); - await deleteAll(profileDeletedContactsUri, "contactCard_query_test_3800") - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3800: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profileRawContactUri, condition1); - sleep(1000); - console.info('logMessage contactCard_query_test_3800: deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3800: raw_contact delete error = " + error); - done(); - } - } - - async function deletedRawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "display_name", "is_deleted"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedprofileRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info('logMessage contactCard_query_test_3800: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_query_test_3800: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_query_test_3800: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaocai").assertTrue(); - console.info('logMessage contactCard_query_test_3800: is_deleted = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == "1").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_3800: query error :" + error); - done(); - } - } - - /** - * @tc.number contactCard_query_test_3900 - * @tc.name Query all mobile phone numbers - * @tc.desc Function test - */ - it("contactCard_query_test_3900", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3900 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaocai" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryPhoneInsert(); - await phoneQuery(rawContactId); - await deleteRawContact("contactCard_query_test_3900"); - await deleteAll(profileContactDataUri, "contactCard_query_test_3900"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3900: raw_contact insert error = " + error); - done(); - } - }); - - async function queryPhoneInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "1853696321" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3900: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3900: contact_data insert error = " + error); - } - } - - async function phoneQuery(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 5 data is phone - condition.equalTo("content_type", "phone"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3900: raw_contact_id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_query_test_3900: detail_info = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "1853696321").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_query_test_3900: query error' + error); - } - } - - /** - * @tc.number contactCard_query_test_4000 - * @tc.name Query all mailbox capabilities - * @tc.desc Function test - */ - it("contactCard_query_test_4000", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_4000 is starting!------------"); - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_4000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryEmailInsert(DAHelper, rawContactId); - await emailQuery(DAHelper, contactDataId, rawContactId); - await deleteRawContact("contactCard_query_test_4000"); - await deleteAll(profileContactDataUri, "contactCard_query_test_4000"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_4000: raw_contact insert error = " + error); - done(); - } - }); - - async function queryEmailInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "16658@163.com" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_query_test_4000: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_4000: contact_data insert error = " + error); - } - } - - async function emailQuery(DAHelper, contactDataId, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data content_type is email - condition.equalTo("type_id", "1").limitAs(3).orderByDesc("id"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_4000: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contactCard_query_test_4000: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_query_test_4000: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "16658@163.com").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_4000: query error :" + error); - } - } - - /** - * @tc.number contactCard_query_test_4100 - * @tc.name Query data information of a single contact - * @tc.desc Function test - */ - it("contactCard_query_test_4100", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_4100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_4100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryTwoDataInsert(DAHelper, rawContactId); - await queryTwoDataInsertCompany(DAHelper, rawContactId); - await queryTwo(DAHelper, rawContactId); - await deleteRawContact("contactCard_query_test_4100"); - await deleteAll(profileContactDataUri, "contactCard_query_test_4100"); - del - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_4100: raw_contact insert error = " + error); - done(); - } - }); - - async function queryTwoDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "xiaoyu" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_query_test_4100: contactDataId = " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_4100: contact_data name insert error = " + error); - } - } - - async function queryTwoDataInsertCompany(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "OOOO", - "position": "Testers" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info("logMessage contactCard_query_test_4100: contactDataId = " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_4100: contact_data company insert error = " + error); - } - } - - async function queryTwo(DAHelper, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "detail_info", "position"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - var array = [{ - detail_info: "xiaoyu", position: "" - }, { - detail_info: "OOOO", position: "Testers" - }]; - var i = 0; - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage contactCard_query_test_4100: columnNames :" + resultSet.columnNames); - console.info("logMessage contactCard_query_test_4100: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_query_test_4100: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_query_test_4100: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contactCard_query_test_4100: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == array[i].detail_info).assertEqual(true); - console.info('logMessage contactCard_query_test_4100: position = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == array[i].position).assertEqual(true); - i++; - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_4100: query error :" + error); - } - } - - /** - * @tc.number contactCard_delete_test_4400 - * @tc.name Delete the basic raw data of the contact and record the deleted basic raw data - * @tc.desc Function test - */ - it("contactCard_delete_test_4400", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_4400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_4400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await deleteRaw(DAHelper, rawContactId); - await queryDelete(DAHelper, rawContactId); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4400: raw_contact insert error :" + error); - done(); - } - }); - - async function deleteRaw(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profileRawContactUri, condition1); - sleep(1000); - console.info("logMessage contactCard_delete_test_4400: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4400: delete error = " + error); - } - } - - async function queryDelete(DAHelper, rawContactId) { - var resultColumns = ["id", "delete_time", "display_name"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedprofileRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info("logMessage contactCard_delete_test_4400: columnNames:" + resultSet.columnNames); - console.info("logMessage contactCard_delete_test_4400: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_delete_test_4400: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_delete_test_4400: delete_time = ' + resultSet.getString(1)); - console.info('logMessage contactCard_delete_test_4400: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaoming").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4400: query error:" + error); - } - } - - /** - * @tc.number contactCard_delete_test_4700 - * @tc.name Delete detailed contact data and record detailed data - * @tc.desc Function test - */ - it("contactCard_delete_test_4700", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_4700 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaozhang", "company": "OOOO", "position": "TestManager" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_4700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryDeleteCompanyData(DAHelper, rawContactId); - await rawContactDelete(DAHelper, rawContactId); - await companyRawContactDeleteQuery(DAHelper, rawContactId); - await deleteAll(profileContactDataUri, "contactCard_delete_test_4700"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4700: raw_contact insert error:" + error); - done(); - } - }); - - async function queryDeleteCompanyData(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "OOOO", - "position": "TestManager" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_4700: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4700: contact_data insert error:" + error); - } - } - - async function rawContactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profileRawContactUri, condition1); - sleep(1000); - console.info("logMessage contactCard_delete_test_4700: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4700: delete error = " + error); - done(); - } - } - - async function companyRawContactDeleteQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name", "backup_data"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedprofileRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info("logMessage contactCard_delete_test_4700: columnNames:" + resultSet.columnNames); - console.info("logMessage contactCard_delete_test_4700: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_delete_test_4700: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_delete_test_4700: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaozhang").assertEqual(true); - console.info('logMessage contactCard_delete_test_4700: backup_data = ' + resultSet.getString(2)); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4700: query error:" + error); - } - } - - /** - * @tc.number contactCard_delete_test_4800 - * @tc.name Delete and record basic data of a single contact - * @tc.desc Function test - */ - it("contactCard_delete_test_4800", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_4800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaopeng" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_4800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDelete(DAHelper, rawContactId); - await deletedRawContactQuery(DAHelper, rawContactId) - await deleteAll(profileContactDataUri, "contactCard_delete_test_4800"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4800: raw_contact insert error:" + error); - done(); - } - }); - - async function contactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("name_raw_contact_id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profilecontactUri, condition1); - sleep(1000); - console.info("logMessage contactCard_delete_test_4800: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4800: delete error = " + error); - } - } - - async function deletedRawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "delete_time", "display_name"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedprofileRawContactUri, resultColumns, condition2); - sleep(1000) - if (resultSet.goToFirstRow()) { - console.info("logMessage contactCard_delete_test_4800: columnNames:" + resultSet.columnNames); - console.info("logMessage contactCard_delete_test_4800: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_delete_test_4800: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_delete_test_4800: delete_time = ' + resultSet.getString(1)); - console.info('logMessage contactCard_delete_test_4800: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaopeng").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4800: query error:" + error); - } - } - - /** - * @tc.number contactCard_batchinsert_test_4900 - * @tc.name Insert contacts in batches(raw_contact) - * @tc.desc Function test - */ - it("contactCard_batchinsert_test_4900", 0, async function (done) { - console.info("--------logMessage contactCard_batchinsert_test_4900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.batchInsert(profileRawContactUri, common.getContactBatchCompany()); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_4900: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("company", "TT4900"); - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - console.info( - 'contactCard_batchinsert_test_4900 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 5).assertEqual(true); - resultSet.close(); - await deleteRawContact("contactCard_batchinsert_test_4900"); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_4900: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_batchinsert_test_5000 - * @tc.name Insert contact_data in batches of address book - * @tc.desc Function test - */ - it("contactCard_batchinsert_test_5000", 0, async function (done) { - console.info("--------logMessage contactCard_batchinsert_test_5000 start!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaozhi" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataBatchInsert(rawContactId); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5000: raw_contact insert error = " + error); - done(); - } - async function contactDataBatchInsert(rawContactId) { - try { - var batchInsertCode = - await DAHelper.batchInsert(profileContactDataUri, common.getContactBatchCompanyTwo()); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5000: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var map = new Map(); - map.set("raw_contact_id", rawContactId.toString()); - await queryBatch(map, "contactCard_batchinsert_test_5000", 5); - await deleteRawContact("contactCard_batchinsert_test_5000"); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5000: batchInsert error = " + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_batchinsert_test_5400 - * @tc.name Batch operation of contact black list - * @tc.desc Function test - */ - it("contactCard_batchinsert_test_5400", 0, async function (done) { - console.info("--------logMessage contactCard_batchinsert_test_5400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.batchInsert(profileBlocklistUri, common.getPhoneNumberBatch()); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5400: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await query(5); - await blocklistDelete(); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5400: batchInsert error = " + error); - done(); - } - - async function blocklistDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "85525040585400"); - try { - var deleteCode = await DAHelper.delete(profileBlocklistUri, condition); - console.info("logMessage contactCard_batchinsert_test_5400: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - await query(0); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5400: delete error = " + error); - done(); - } - } - - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "85525040585400"); - try { - var resultSet = await DAHelper.query(profileBlocklistUri, resultColumns, condition); - sleep(1000); - console.info('contactCard_batchinsert_test_5400 : queryBatch start ! resultSet.rowCount = ' + - resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contactCard_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - }); - - /** - * @tc.number contactCard_update_test_5300 - * @tc.name Bulk favorites and unfavorites of contacts - * @tc.desc Function test - */ - it("contactCard_update_test_5300", 0, async function (done) { - console.info("--------logMessage contactCard_update_test_5300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValuesOne = { - "display_name": "fengyuan", "favorite": 1 - }; - var rawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactValuesThree = { - "display_name": "xiaoma", "favorite": 1 - }; - var listAddBluk = [] - listAddBluk[0] = rawContactValuesOne; - listAddBluk[1] = rawContactValuesTwo; - listAddBluk[2] = rawContactValuesThree; - try { - var batchInsertCode = await DAHelper.batchInsert(profileRawContactUri, listAddBluk); - sleep(1000); - console.info("logMessage contactCard_update_test_5300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await rawContactUpdateUnFavorites(DAHelper); - await queryUnFavorites(DAHelper); - await deleteRawContact("contactCard_update_test_5300"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_5300: batchInsert error = " + error); - done(); - } - }); - - async function rawContactUpdateUnFavorites(DAHelper) { - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("display_name", "fengyuan"); - condition.or(); - condition.equalTo("display_name", "xiaoma"); - try { - var updateCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contactCard_update_test_5300: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_update_test_5300: update error = " + error); - } - } - - async function queryUnFavorites(DAHelper) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("display_name", "fengyuan"); - condition.or(); - condition.equalTo("display_name", "xiaoma"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - console.info( - 'contactCard_update_test_5300 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 2).assertEqual(true); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var dbresult = resultSet.getString(resultSet.getColumnIndex("favorite")); - console.info(' contactCard_update_test_5300 :logMessage contactsQuery dbresult :' + dbresult + - ' value : ' + value); - expect(dbresult == "0").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(" contactCard_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - - /** - * @tc.number contactCard_batchinsert_test_5500 - * @tc.name Contacts are added to and removed from groups in batches - * @tc.desc Function test - */ - it("contactCard_batchinsert_test_5500", 0, async function (done) { - console.info("--------logMessage contactCard_batchinsert_test_5500 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var groupValues = { - "group_name": "ManagerGroup" - }; - try { - var groupId = await DAHelper.insert(profileGroupUri, groupValues); - console.info("logMessage contactCard_batchinsert_test_5500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: group insert error = " + error); - done(); - } - - try { - var rawContactValues1 = { - "display_name": "xiaohuang" - }; - var rawContactIdFirst = await DAHelper.insert(profileRawContactUri, rawContactValues1); - console.info("logMessage contactCard_batchinsert_test_5500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: raw_contact_1 insert error = " + error); - done(); - } - - try { - var rawContactValues2 = { - "display_name": "xiaolv" - }; - var rawContactIdSecond = await DAHelper.insert(profileRawContactUri, rawContactValues2); - console.info("logMessage contactCard_batchinsert_test_5500: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: raw_contact_2 insert error = " + error); - done(); - } - - try { - var rawContactValues3 = { - "display_name": "xiaobai" - }; - var rawContactIdThird = await DAHelper.insert(profileRawContactUri, rawContactValues3); - console.info("logMessage contactCard_batchinsert_test_5500: rawContactIdThird = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: raw_contact_3 insert error = " + error); - done(); - } - await threeDataInsert(DAHelper, rawContactIdFirst, rawContactIdSecond, rawContactIdThird, groupId); - await deleteRawContact("contactCard_batchinsert_test_5500"); - await deleteAll(profileGroupUri, "contactCard_batchinsert_test_5500"); - await deleteAll(profileContactDataUri, "contactCard_batchinsert_test_5500"); - done(); - }); - - async function threeDataInsert(DAHelper, rawContactIdFirst, rawContactIdSecond, rawContactIdThird, groupId) { - var contactDataValues1 = { - "raw_contact_id": rawContactIdFirst, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var contactDataValues2 = { - "raw_contact_id": rawContactIdSecond, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var contactDataValues3 = { - "raw_contact_id": rawContactIdThird, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValues1; - listAddBluk[1] = contactDataValues2; - listAddBluk[2] = contactDataValues3; - try { - var batchInsertCode = await DAHelper.batchInsert(profileContactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await contactDataDelete(DAHelper, rawContactIdFirst, rawContactIdThird); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: batchInsert error = " + error); - } - } - - async function contactDataDelete(DAHelper, rawContactIdFirst, rawContactIdThird) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdThird.toString()); - try { - var deleteCode = await DAHelper.delete(profileContactDataUri, condition); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5500: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - await queryTwoData(DAHelper, rawContactIdFirst, rawContactIdThird); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: delete error = " + error); - } - } - - async function queryTwoData(DAHelper, rawContactIdFirst, rawContactIdThird) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdThird.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - console.info( - 'contactCard_batchinsert_test_5500 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contactCard_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - - /** - * @tc.number contactCard_pinyin_query_test_200 - * @tc.name Contact name to pinyin (Chinese Simplified) - * @tc.desc Function test - */ - it("contactCard_pinyin_query_test_200", 0, async function (done) { - console.info("--------logMessage contactCard_pinyin_query_test_200 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "小黄" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info('logMessage contactCard_pinyin_query_test_200 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contactCard_pinyin_query_test_100"); - await deleteAll(profileContactDataUri, "contactCard_pinyin_query_test_100"); - done(); - } catch (error) { - console.info("logMessage contactCard_pinyin_query_test_200: raw_contact insert error = " + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaohuang" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_pinyin_query_test_200 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchQuery(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_200 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profilesearchContactUri, resultColumns, condition); - var map = common.getSearchMap(); - map.set("raw_contact_id", rawContactId.toString()); - if (resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ':contactCard_pinyin_query_test_200 key = ' + key + - ' dbresult :' + dbresult + ' value : ' + value); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_200 query error = ' + error); - } - } - - /** - * @tc.number contactCard_pinyin_query_test_100 - * @tc.name Contact name to pinyin (Chinese Traditional) - * @tc.desc Function test - */ - it("contactCard_pinyin_query_test_100", 0, async function (done) { - console.info("--------logMessage contactCard_pinyin_query_test_100 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "鍵盤" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_pinyin_query_test_100 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contactCard_pinyin_query_test_100"); - await deleteAll(profileContactDataUri, "contactCard_pinyin_query_test_100"); - done(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_100 raw_contact insert error = ' + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "鍵盤" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_pinyin_query_test_100 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchContactQueryChinese(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_100 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchContactQueryChinese(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profilesearchContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_pinyin_query_test_100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_pinyin_query_test_100: search_name = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "鍵盤||jianpan||jp").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_100 query error = ' + error); - } - } - - /** - * @tc.number contactCard_pinyin_query_test_300 - * @tc.name Contact name to pinyin (English) - * @tc.desc Function test - */ - it("contactCard_pinyin_query_test_300", 0, async function (done) { - console.info("--------logMessage contactCard_pinyin_query_test_300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "Tom" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_pinyin_query_test_300 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contactCard_pinyin_query_test_300"); - done(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_300 raw_contact insert error = ' + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "Tom" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_pinyin_query_test_300 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchContactQuery(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_300 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchContactQuery(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profilesearchContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_pinyin_query_test_300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_pinyin_query_test_300: search_name = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "Tom||Tom||Tom").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_300 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_400 - * @tc.name Contact fuzzy search query interface (name) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_400", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "400xiaoming400" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_400 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactNameQuery(); - await deleteRawContact("contactCard_fuzzyquery_test_400"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_400 raw_contact insert error = ' + error); - done(); - } - - async function rawContactNameQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("display_name", "%xiaoming40%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_400: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_400: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "400xiaoming400").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_400 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_fuzzyquery_test_500 - * @tc.name Contact fuzzy search query interface (name pinyin, pinyin name) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_500", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_500 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var rawContactValues = { - "display_name": "500xiaoming500", "phonetic_name": "500xiaoming500||xm" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_500 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactPhoneticNameQuery(); - await deleteRawContact("contactCard_fuzzyquery_test_500"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_500 raw_contact insert error = ' + error); - done(); - } - - async function rawContactPhoneticNameQuery() { - var resultColumns = ["id", "display_name", "phonetic_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phonetic_name", "%xiaoming%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - condition.or(); - condition.like("phonetic_name", "%xm%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_500: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_500: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "500xiaoming500").assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_500: phoneticName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "500xiaoming500||xm").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_500 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_fuzzyquery_test_600 - * @tc.name Contact fuzzy search query interface (company, position) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_600", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_600 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming", "company": "TT600", "position": "Testers600" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_600 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactCompanyQuery(DAHelper, rawContactId); - await deleteRawContact("contactCard_fuzzyquery_test_600"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_600 raw_contact insert error = ' + error); - done(); - } - }); - - async function rawContactCompanyQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name", "company", "position"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("company", "%TT6%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - condition.or(); - condition.like("position", "%Testers6%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_600: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_600: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoming").assertEqual(true); - console.info('logMessage contactCard_fuzzyquery_test_600: company = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "TT600").assertEqual(true); - console.info('logMessage contactCard_fuzzyquery_test_600: position = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == "Testers600").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_600 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_700 - * @tc.name Contact fuzzy search query interface (mobile phone number) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_700", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_700 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_700 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataPhoneInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_700"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_700"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_700 raw_contact insert error = ' + error); - done(); - } - - async function contactDataPhoneInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "14528963" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_700 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryPhone(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_700 contact_data insert error = ' + contactDataId); - done(); - } - } - }); - - async function fuzzyQueryPhone(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 5 data is phone - condition.like("detail_info", "%52896%"); - condition.and(); - condition.equalTo("type_id", "5"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_700: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_700: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contactCard_fuzzyquery_test_700: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "14528963").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_700 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_800 - * @tc.name Contact fuzzy search query interface (nickname) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_800", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_800 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactNickNameInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_800"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_800"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_800 raw_contact insert error = ' + error); - done(); - } - - async function contactNickNameInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "daming" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_fuzzyquery_test_800 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryPhoneNickName(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_800 contact_data insert error = ' + contactDataId); - done(); - } - } - }); - - async function fuzzyQueryPhoneNickName(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 3 data is nickname - condition.like("detail_info", "%daming%"); - condition.and(); - condition.equalTo("type_id", "3"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_800: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_800: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_fuzzyquery_test_800: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "daming").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_800 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_900 - * @tc.name Contact fuzzy search query interface (mailbox) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_900", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_900 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataEmailInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_900"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_900"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_900 raw_contact insert error = ' + error); - done(); - } - - async function contactDataEmailInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "1564@163.com" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_fuzzyquery_test_900 ; = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryEmail(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_900 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryEmail(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data is email - condition.like("detail_info", "%1564%"); - condition.and(); - condition.equalTo("type_id", "1"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_900: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_900: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_fuzzyquery_test_900: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "1564@163.com").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_900 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_1000 - * @tc.name Contact fuzzy search query interface (residential) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_1000", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_1000 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_1000 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataPostalInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_1000"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_1000"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1000 raw_contact insert error = ' + error); - done(); - } - - async function contactDataPostalInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "nanjing1000" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_1000 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryAddress(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1000 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryAddress(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data is postal_address - condition.like("detail_info", "%nanjing10%"); - condition.and(); - condition.equalTo("type_id", "7"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_1000: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_1000: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_1000: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "nanjing1000").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1000: query error' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_1100 - * @tc.name Contact fuzzy search query interface (remarks) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_1100", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_1100 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_1100 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataNoteInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_1100"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_1100"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1100 raw_contact insert error = ' + error); - done(); - } - - async function contactDataNoteInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "note", - "detail_info": "java1100" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_1100 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryNote(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1100 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryNote(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 10 data is note - condition.like("detail_info", "%java11%"); - condition.and(); - condition.equalTo("type_id", "10"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_1100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_1100: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_1100: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "java1100").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1100: query error' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_1200 - * @tc.name Contact fuzzy search query interface (AIM) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_1200", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_1200 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info('logMessage contactCard_fuzzyquery_test_1200 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_1200"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_1200"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1200 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "im", - "detail_info": "aaaa1200" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_fuzzyquery_test_1200 ; = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryIM(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1200 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryIM(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 10 data is im account number - condition.like("detail_info", "%aa12%"); - condition.and(); - condition.equalTo("type_id", "2"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_1200: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_1200: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_1200: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "aaaa1200").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1200: query error' + error); - } - } - - /** - * @tc.number abnormal_contactCard_insert_test_200 - * @tc.name Abnormal use case, an incorrect field is passed in when inserting - * @tc.desc Function test - */ - it("abnormal_contactCard_insert_test_200", 0, async function (done) { - console.info("------------abnormal_contactCard_insert_test_200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_names": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_insert_test_200: rawContactId = " + rawContactId); - expect(rawContactId).assertEqual(-1); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_test_200: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contactCard_insert_test_300 - * @tc.name Abnormal use case, an incorrect table name is passed in when inserting - * @tc.desc Function test - */ - it("abnormal_contactCard_insert_test_300", 0, async function (done) { - console.info("------------abnormal_contactCard_insert_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(errorUri, rawContactValues); - console.info("logMessage abnormal_contactCard_insert_test_300: rawContactId = " + rawContactId); - expect(rawContactId == -1).assertTrue(); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_test_300: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contactCard_update_test_1100 - * @tc.name Abnormal use case, an incorrect field is passed in when updating - * @tc.desc Function test - */ - it("abnormal_contactCard_update_test_1100", 0, async function (done) { - console.info("------------abnormal_contactCard_update_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_update_test_1100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalUpdate(); - await deleteRawContact("abnormal_contactCard_update_test_1100"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_update_test_1100: raw_contact insert error' + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "display_names": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var updataCode = await DAHelper.update(profileRawContactUri, updateValues, condition) - console.info("logMessage abnormal_contactCard_update_test_1100: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contactCard_update_test_1100", profileRawContactUri); - } catch (error) { - console.info('logMessage abnormal_contactCard_update_test_1100: update error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_update_test_1000 - * @tc.name Abnormal use case, an incorrect table name is passed in when updating - * @tc.desc Function test - */ - it("abnormal_contactCard_update_test_1000", 0, async function (done) { - console.info("------------abnormal_contactCard_update_test_1000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_update_test_1000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalUpdate(); - await deleteRawContact("abnormal_contactCard_update_test_1100"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_update_test_1000: raw_contact insert error' + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "display_name": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updataCode = await DAHelper.update(errorUri, updateValues, condition); - console.info("logMessage abnormal_contactCard_update_test_1000: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contactCard_update_test_1000", profileRawContactUri); - } catch (error) { - console.info("logMessage abnormal_contactCard_update_test_1000: updata error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_delete_test_4500 - * @tc.name Abnormal use case, an incorrect field is passed in when deleting - * @tc.desc Function test - */ - it("abnormal_contactCard_delete_test_4500", 0, async function (done) { - console.info("------------abnormal_contactCard_delete_test_4500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaozhi" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_delete_test_4500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalDelete(); - await deleteRawContact("abnormal_contactCard_delete_test_4500"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_delete_test_4500: raw_contact insert error' + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profileRawContactUri, condition); - console.info("logMessage abnormal_contactCard_delete_test_4500: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaozhi"); - await contactsQuery(map, "abnormal_contactCard_delete_test_4500", profileRawContactUri); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_delete_test_4500: delete error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_delete_test_4600 - * @tc.name Abnormal use case, an incorrect table name is passed in when deleting - * @tc.desc Function test - */ - it("abnormal_contactCard_delete_test_4600", 0, async function (done) { - console.info("------------abnormal_contactCard_delete_test_4600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_delete_test_4600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalDelete(); - await deleteRawContact("abnormal_contactCard_delete_test_4600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_delete_test_4600: raw_contact insert error' + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info("logMessage abnormal_contactCard_delete_test_4600: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contactCard_delete_test_4600", profileRawContactUri); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_delete_test_4600: delete error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_query_test_4200 - * @tc.name Abnormal use case, an incorrect field is passed in when querying - * @tc.desc Function test - */ - it("abnormal_contactCard_query_test_4200", 0, async function (done) { - console.info("------------abnormal_contactCard_query_test_4200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaozhicheng" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues) - console.info("logMessage abnormal_contactCard_query_test_4200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contactCard_query_test_4200"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_query_test_4200: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info( - 'logMessage abnormal_contactCard_query_test_4200: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contactCard_query_test_4200: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_batchinsert_test_5100 - * @tc.name Abnormal use cases, when adding data in batches, some of them failed, check the processing logic - * @tc.desc Function test - */ - it("abnormal_contactCard_batchinsert_test_5100", 0, async function (done) { - console.info("--------logMessage abnormal_contactCard_batchinsert_test_5100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "display_name": "zhangsan" - }; - var addBulkValue2 = { - "display_names": "lisi" - }; - var addBulkValue3 = { - "display_name": "wangwu" - }; - var addBulkValue4 = { - "display_names": "laoliu" - }; - var addBulkValue5 = { - "display_name": "xiaozhang" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(profileRawContactUri, listAddBluk); - console.info("logMessage abnormal_contactCard_batchinsert_test_5100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_contactCard_batchinsert_test_5100: batch insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contactCard_insert_data_5300 - * @tc.name insert_data error no rawContactId - * @tc.desc Function test - */ - it("abnormal_contactCard_insert_data_5300", 0, async function (done) { - console.info("--------logMessage abnormal_contactCard_insert_data_5300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaotian" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage abnormal_contactCard_insert_data_5300 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("abnormal_contactCard_insert_data_5300"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_data_5300 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "content_type": "im", "detail_info": "aaaa" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage abnormal_contactCard_insert_data_5300 ; = ' + contactDataId); - expect(contactDataId == -1).assertTrue(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_data_5300 contact_data insert error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_insert_data_5400 - * @tc.name insert_data error no content_type - * @tc.desc Function test - */ - it("abnormal_contactCard_insert_data_5400", 0, async function (done) { - console.info("--------logMessage abnormal_contactCard_insert_data_5400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaotian" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info('logMessage abnormal_contactCard_insert_data_5400 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("abnormal_contactCard_insert_data_5400"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_data_5400 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "detail_info": "aaaa" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage abnormal_contactCard_insert_data_5400 ; = ' + contactDataId); - expect(contactDataId == -1).assertTrue(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_data_5400 contact_data insert error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_delete_test_5500 - * @tc.name batchDelete - * @tc.desc Function test - */ - it("contactCard_delete_test_5500", 0, async function (done) { - console.info("--------logMessage contactCard_delete_test_5500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - console.info("logMessage contactCard_delete_test_5500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_delete_test_5500", profileRawContactUri); - await executeBatch(); - } catch (error) { - console.info("logMessage contactCard_delete_test_5500: insert error = " + error); - done(); - } - async function executeBatch() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - DAHelper.executeBatch(URI_CONTACTS, [{ - uri: profileRawContactUri, - type: featureAbility.DataAbilityOperationType.TYPE_DELETE, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info( - "logMessage contactCard_delete_test_5500: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage contactCard_delete_test_5500: data_3 = " + data); - console.info("logMessage contactCard_delete_test_5500: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number contactCard_update_test_5600 - * @tc.name batchUpdate - * @tc.desc Function test - */ - it("contactCard_update_test_5600", 0, async function (done) { - console.info("--------logMessage contactCard_update_test_5600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - console.info("logMessage contactCard_update_test_5600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_update_test_5600", profileRawContactUri); - await executeBatch(); - } catch (error) { - console.info("logMessage contactCard_update_test_5600: insert error = " + error); - done(); - } - - async function executeBatch() { - var updateValues = { - "display_name": "xiaoxiaoxiao" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - DAHelper.executeBatch(URI_CONTACTS, [{ - uri: profileRawContactUri, - type: featureAbility.DataAbilityOperationType.TYPE_UPDATE, - valuesBucket: updateValues, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info( - "logMessage contactCard_update_test_5600: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage contactCard_update_test_5600: data_3 = " + data); - console.info("logMessage contactCard_update_test_5600: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number contactCard_insert_test_5700 - * @tc.name Insert Multiple raw_contact essential information - * @tc.desc Function test - */ - it("contactCard_insert_test_5700", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_5700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_insert_test_5700: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insert_test_5700", profileRawContactUri); - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_insert_test_5700: rawContactIdOne = ' + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactIdOne.toString()); - await contactsQuery(map, "contactCard_insert_test_5700", profileRawContactUri); - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_insert_test_5700: rawContactIdTwo = ' + rawContactIdTwo); - expect(rawContactIdTwo > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactIdTwo.toString()); - await contactsQuery(map, "contactCard_insert_test_5700", profileRawContactUri); - await deleteRawContact("contactCard_insert_test_5700"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_5700: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_insert_test_5800 - * @tc.name Add 20000 bytes of basic contact information and verify whether the text insertion is successful - * @tc.desc Function test - */ - it("contactCard_insert_test_5800", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_5800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var name; - for (var i = 0; i < 20000; i++) { - name += "i"; - } - var contcatvalues = { - "display_name": name - } - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, contcatvalues); - sleep(1000); - console.info('logMessage contactCard_insert_test_5800: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", name); - await contactsQuery(map, "contactCard_insert_test_5800", profileRawContactUri); - await deleteRawContact("contactCard_insert_test_5800"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_5800: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_insert_test_5900 - * @tc.name Add multiple contact details and verify that the insertion was successful - * @tc.desc Function test - */ - it("contactCard_insert_test_5900", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_5900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var contcatvalues = { - "display_name": "xiao5900" - } - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, contcatvalues); - console.info('logMessage contactCard_insert_test_5900: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "19960229" - }; - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - console.info('logMessage contactCard_insert_test_5900: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "19960229"); - await contactsQuery(map, "contactCard_insert_test_5900", profileContactDataUri); - - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, contcatvalues); - console.info('logMessage contactCard_insert_test_5900: rawContactId = ' + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - var contactDataValues2 = { - "raw_contact_id": rawContactIdOne, - "content_type": "phone", - "detail_info": "111111032" - }; - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - console.info('logMessage contactCard_insert_test_5900: contactDataId = ' + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "111111032"); - await contactsQuery(map, "contactCard_insert_test_5900", profileContactDataUri); - - await deleteRawContact("contactCard_insert_test_5900"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_5900"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_5900: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_insert_test_6000 - * @tc.name Add the basic information of a single contact and verify whether the insertion is successful (name, - * Pinyin, company, position, favorite) - * @tc.desc Function test - */ - it("contactCard_insert_test_6000", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_6000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "licheng", - "company": "TT", - "position": "developer", - "favorite": 1, - "phonetic_name": "licheng||lc" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_6000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "licheng"); - map.set("company", "TT"); - map.set("position", "developer"); - map.set("favorite", "1"); - map.set("phonetic_name", "licheng||lc"); - await contactsQuery(map, "contactCard_insert_test_6000", profileRawContactUri); - await deleteRawContact("contactCard_insert_test_6000"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_6000"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_6000: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertData_test_6100 - * @tc.name To contact_data Add a full field data to the data table and verify whether the insertion is - * successful - * @tc.desc Function test - */ - it("contactCard_insertData_test_6100", 0, async function (done) { - console.info("------logMessage contactCard_insertData_test_6100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertData_test_6100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - console.info('logMessage contactCard_insertData_test_6100: contactDataValues["raw_contact_id"] = ' + - contactDataValues.raw_contact_id); - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_insertData_test_6100: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - var map = common.getProfileContactDataMap(); - map.set("id", contactDataId.toString()); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insertData_test_6100", profileContactDataUri); - await deleteRawContact("contactCard_insertData_test_6100"); - await deleteAll(profileContactDataUri, "contactCard_insertData_test_6100"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertData_test_6100: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_update_test_6200 - * @tc.name Modify the basic information of multiple contacts and verify whether the modification is successful - * @tc.desc Function test - */ - it("contactCard_update_test_6200", 0, async function (done) { - console.info("--------logMessage contactCard_update_test_6200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - expect(rawContactId > 0).assertTrue(); - console.info("logMessage contactCard_update_test_6200: rawContactId = " + rawContactId); - var insertRawContactValuesOne = { - "display_name": "xiaocai1", - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - expect(rawContactIdOne > 0).assertTrue(); - console.info("logMessage contactCard_update_test_6200: rawContactIdOne = " + rawContactIdOne); - var insertRawContactValuesTwo = { - "display_name": "xiaocai1", - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - expect(rawContactIdTwo > 0).assertTrue(); - console.info("logMessage contactCard_update_test_6200: rawContactIdTwo = " + rawContactIdTwo); - - var updateValues = { - "display_name": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - var updataCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - console.info("logMessage contactCard_update_test_6200: updataCode = " + updataCode); - expect(updataCode == 0).assertTrue(); - sleep(1000); - await queryUpdateThree( - "contactCard_update_test_6200", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contactCard_update_test_6200"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_6200: insert error = " + error); - done(); - } - }); - - async function queryUpdateThree(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var name = resultSet.getString(resultSet.getColumnIndex("display_name")); - expect(name == "xiaosan").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - /** - * @tc.number contactCard_UpdateRawContcat_test_6300 - * @tc.name Update raw_contact The full field data of the contact table and verify whether the modification is - * successful - * @tc.desc Function test - */ - it("contactCard_UpdateRawContcat_test_6300", 0, async function (done) { - console.info("------logMessage contactCard_UpdateRawContcat_test_6300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - console.info("logMessage contactCard_UpdateRawContcat_test_6300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(2000); - var updateValues = common.getProfileRawContactUpdate(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var updataCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - console.info('logMessage contactCard_UpdateRawContcat_test_6300: updataCode = ' + updataCode); - sleep(3000); - var map = common.getProfileRawContactUpdateMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_UpdateRawContcat_test_6300", profileRawContactUri); - await deleteRawContact("contactCard_UpdateRawContcat_test_6300"); - await deleteAll(profileContactDataUri, "contactCard_UpdateRawContcat_test_6300"); - done(); - } catch (error) { - console.info("logMessage contactCard_UpdateRawContcat_test_6300: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertDataUpdate_test_6400 - * @tc.name Update contact_data table, and verify whether the modification is successful - * @tc.desc Function test - */ - it("contactCard_insertDataUpdate_test_6400", 0, async function (done) { - console.info("------logMessage contactCard_insertDataUpdate_test_6400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataUpdate_test_6400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - console.info('logMessage contactCard_insertDataUpdate_test_6400: contactDataValues.raw_contact_id = ' + - contactDataValues.raw_contact_id); - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_insertDataUpdate_test_6400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var updateValues = common.getProfileContactDataUpdate(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - var updataCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - console.info('logMessage contactCard_insertDataUpdate_test_6400: updataCode = ' + updataCode); - sleep(1000); - var map = common.getProfileContactDataUpdateMap(); - map.set("id", contactDataId.toString()); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insertDataUpdate_test_6400", profileContactDataUri); - await deleteRawContact("contactCard_insertDataUpdate_test_6400"); - await deleteAll(profileContactDataUri, "contactCard_insertDataUpdate_test_6400"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataUpdate_test_6400: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertDataUpdateAll_test_6500 - * @tc.name Update all contact details and verify that the modification was successful - * @tc.desc Function test - */ - it("contactCard_insertDataUpdateAll_test_6500", 0, async function (done) { - console.info("------logMessage contactCard_insertDataUpdateAll_test_6500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataUpdateAll_test_6500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaocai", ""); - await insertData(rawContactId, "phone", "6500", ""); - await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await insertData(rawContactId, "nickname", "xxxxcai", ""); - await insertData(rawContactId, "email", "111@fox.com", ""); - await insertData(rawContactId, "postal_address", "dddd", ""); - await insertData(rawContactId, "note", "caicai", ""); - await insertData(rawContactId, "im", "999999999", ""); - await insertData(rawContactId, "contact_event", "1125", ""); - await insertData(rawContactId, "website", "wwww.xxx.com", ""); - await insertData(rawContactId, "relation", "xiaobai", ""); - await insertData(rawContactId, "group_membership", 1, ""); - await insertData(rawContactId, "contact_misc", "5678", ""); - var updateValues = { - "detail_info": "xiaocai" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - var updataCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - console.info('logMessage contactCard_insertDataUpdateAll_test_6500: updataCode = ' + updataCode); - sleep(1000); - await queryUpdateAllData("contactCard_insertDataUpdateAll_test_6500", DAHelper, rawContactId); - await deleteRawContact("contactCard_insertDataUpdateAll_test_6500"); - await deleteAll(profileContactDataUri, "contactCard_insertDataUpdateAll_test_6500"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataUpdateAll_test_6500: raw_contact insert error = " + error); - done(); - } - }); - - async function queryUpdateAllData(tag, DAHelper, rawContactId) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("row_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var detail_info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - expect(detail_info == "xiaocai").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - /** - * @tc.number contactCard_insertFavorite_test_6600 - * @tc.name Add multiple contacts to favorites and verify that the favorites field is changed - * @tc.desc Function test - */ - it("contactCard_insertFavorite_test_6600", 0, async function (done) { - console.info("------logMessage contactCard_insertFavorite_test_6600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertFavorite_test_6600: rawContactId = " + rawContactId); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", "favorite": 1 - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - console.info("logMessage contactCard_insertFavorite_test_6600: rawContactId = " + rawContactIdOne); - - var insertRawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - console.info("logMessage contactCard_insertFavorite_test_6600: rawContactId = " + rawContactIdTwo); - - sleep(1000); - await queryThreeFavorite( - "contactCard_insertFavorite_test_6600", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 1); - await deleteRawContact("contactCard_insertFavorite_test_6600"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertFavorite_test_6600: raw_contact insert error = " + error); - done(); - } - }); - - async function queryThreeFavorite(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, favoritevalue) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryThreeFavorite start ! DAHelper = ' + DAHelper); - var resultColumns = ["favorite"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var favorite = resultSet.getInt(resultSet.getColumnIndex("favorite")); - expect(favorite == favoritevalue).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryThreeFavorite: error = " + error); - } - } - - /** - * @tc.number contactCard_unFavorite_test_6700 - * @tc.name Remove favorites from multiple contacts and verify that the favorites field has changed - * @tc.desc Function test - */ - it("contactCard_unFavorite_test_6700", 0, async function (done) { - console.info("------logMessage contactCard_unFavorite_test_6700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_unFavorite_test_6700: rawContactId = " + rawContactId); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", "favorite": 1 - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - console.info("logMessage contactCard_unFavorite_test_6700: rawContactId = " + rawContactIdOne); - - var insertRawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - console.info("logMessage contactCard_unFavorite_test_6700: rawContactId = " + rawContactIdTwo); - - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - var updataCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - console.info("logMessage contactCard_unFavorite_test_6700: updataCode = " + updataCode); - sleep(1000); - await queryThreeFavorite( - "contactCard_unFavorite_test_6700", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 0); - await deleteRawContact("contactCard_unFavorite_test_6700"); - done(); - } catch (error) { - console.info("logMessage contactCard_unFavorite_test_6700: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertContactBlocklist_test_6800 - * @tc.name Add multiple records to the black list and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contactCard_insertContactBlocklist_test_6800", 0, async function (done) { - console.info("--------logMessage contactCard_insertContactBlocklist_test_6800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_insertContactBlocklist_test_6800: insert = " + batchInsertCode); - var batchInsertCodeOne = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_insertContactBlocklist_test_6800: insert = " + batchInsertCodeOne); - var batchInsertCodeTwo = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_insertContactBlocklist_test_6800: insert = " + batchInsertCodeTwo); - sleep(1000); - expect(batchInsertCode > 0).assertTrue(); - await query(3); - await deleteAll(profileBlocklistUri, "contactCard_insertContactBlocklist_test_6800"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertContactBlocklist_test_6800: batchInsert error = " + error); - done(); - } - - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "123456789"); - try { - var resultSet = await DAHelper.query(profileBlocklistUri, resultColumns, condition); - sleep(1000); - console.info('contactCard_insertContactBlocklist_test_6800 :resultSet.goToFirstRow() = ' + - resultSet.goToFirstRow()); - console.info( - 'contactCard_insertContactBlocklist_test_6800 : query result is = ' + resultSet.rowCount == size); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contactCard_insertContactBlocklist_test_6800 error = " + error); - } - } - }); - - /** - * @tc.number contactCard_removeContactBlocklist_test_6900 - * @tc.name Delete multiple records from the black list and verify whether the deletion is successful - * @tc.desc Function test - */ - it("contactCard_removeContactBlocklist_test_6900", 0, async function (done) { - console.info("--------logMessage contactCard_removeContactBlocklist_test_6900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info( - "logMessage contactCard_removeContactBlocklist_test_6900: batchInsertCode = " + batchInsertCode); - var batchInsertCodeOne = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_removeContactBlocklist_test_6900: insert = " + batchInsertCodeOne); - var batchInsertCodeTwo = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_removeContactBlocklist_test_6900: insert = " + batchInsertCodeTwo); - sleep(1000); - expect(batchInsertCode > 0).assertTrue(); - await deleteAll(profileBlocklistUri, "contactCard_removeContactBlocklist_test_6900"); - await query(0); - done(); - } catch (error) { - console.info("logMessage contactCard_removeContactBlocklist_test_6900: batchInsert error = " + error); - done(); - } - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "123456789"); - try { - var resultSet = await DAHelper.query(profileBlocklistUri, resultColumns, condition); - console.info('contactCard_removeContactBlocklist_test_6900 : resultSet = ' + resultSet); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contactCard_removeContactBlocklist_test_6900 error = " + error); - } - } - }); - - /** - * @tc.number contactCard_insertGroup_test_7000 - * @tc.name Add multiple contacts to favorites and verify that the favorites field is changed - * @tc.desc Function test - */ - it("contactCard_insertGroup_test_7000", 0, async function (done) { - console.info("------logMessage contactCard_insertGroup_test_7000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertGroup_test_7000: rawContactId = " + rawContactId); - await insertData(rawContactId, "group_membership", 1, ""); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - console.info("logMessage contactCard_insertGroup_test_7000: rawContactId = " + rawContactIdOne); - await insertData(rawContactIdOne, "group_membership", 1, ""); - var insertRawContactValuesTwo = { - "display_name": "xiaoli", - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - console.info("logMessage contactCard_insertGroup_test_7000: rawContactId = " + rawContactIdTwo); - await insertData(rawContactIdTwo, "group_membership", 1, ""); - sleep(1000); - await queryThreeGroup( - "contactCard_insertGroup_test_7000", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 1); - await deleteRawContact("contactCard_insertGroup_test_7000"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertGroup_test_7000: raw_contact insert error = " + error); - done(); - } - }); - - async function queryThreeGroup(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, groupId) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryThreeGroup start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var group = resultSet.getInt(resultSet.getColumnIndex("detail_info")); - expect(group == groupId).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryThreeGroup: error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_7100 - * @tc.name Add a full field data to the groups table and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contactCard_insert_test_7100", 0, async function (done) { - console.info("---------logMessage contactCard_insert_test_7100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(profileGroupUri, common.getProfileGroup()); - console.info("logMessage contactCard_insert_test_7100: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await contactsQuery(map, "contactCard_insert_test_7100", profileGroupUri); - await deleteAll(profileGroupUri, "contactCard_insert_test_7100"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_7100: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_delete_test_7200 - * @tc.name Add a full field data to the groups table and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contactCard_delete_test_7200", 0, async function (done) { - console.info("------logMessage contactCard_delete_test_7200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_delete_test_7200: rawContactId = " + rawContactId); - await insertData(rawContactId, "group_membership", 1, ""); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - console.info("logMessage contactCard_delete_test_7200: rawContactId = " + rawContactIdOne); - await insertData(rawContactIdOne, "group_membership", 1, ""); - var insertRawContactValuesTwo = { - "display_name": "xiaoli", - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - console.info("logMessage contactCard_delete_test_7200: rawContactId = " + rawContactIdTwo); - await insertData(rawContactIdTwo, "group_membership", 1, ""); - sleep(1000); - await deleteAll(profileContactDataUri, "contactCard_delete_test_7200"); - sleep(1000); - await queryZeroGroup( - "contactCard_delete_test_7200", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contactCard_delete_test_7200"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_7200: raw_contact insert error = " + error); - done(); - } - }); - - async function queryZeroGroup(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryZeroGroup start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - console.info(tag + ': queryZeroGroup! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryZeroGroup: error = " + error); - } - } - - /** - * @tc.number contactCard_delete_test_7300 - * @tc.name Delete the full field data of a groups table and verify whether the deletion is successful - * @tc.desc Function test - */ - it("contactCard_delete_test_7300", 0, async function (done) { - console.info("---------logMessage contactCard_delete_test_7300 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(profileGroupUri, common.getProfileGroup()); - console.info("logMessage contactCard_delete_test_7300: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await contactsQuery(map, "contactCard_delete_test_7300", profileGroupUri); - await deleteAll(profileGroupUri, "contactCard_delete_test_7300"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_7300: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_delete_test_7400 - * @tc.name Add a raw_contact all fields, delete raw_contact - * @tc.desc Function test - */ - it("contactCard_delete_test_7400", 0, async function (done) { - console.info("------logMessage contactCard_delete_test_7400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_delete_test_7400: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - map.set("version", "2"); - map.set("is_deleted", "1"); - await deleteAll(profileRawContactUri, "contact_Delete_test_7400"); - sleep(1000); - await contactsQuery(map, "contactCard_delete_test_7400", profileRawContactUri); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - var code = await DAHelper.delete(profileDeletedContactsUri, conditionAll); - console.info('contactCard_delete_test_7400 : Completely delete code = ' + code); - expect(code == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contactCard_delete_test_7400: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_delete_test_7500 - * @tc.name Delete contact_data Single full field data in data table - * @tc.desc Function test - */ - it("contactCard_delete_test_7500", 0, async function (done) { - console.info("------logMessage contactCard_delete_test_7500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_delete_test_7500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_delete_test_7500: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await deleteAll(profileContactDataUri, "contactCard_delete_test_7500"); - var map = new Map(); - map.set("id", contactDataId.toString()); - await queryIdForDelete(map, "contactCard_delete_test_7500", profileContactDataUri); - await deleteRawContact("contactCard_delete_test_7500"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_7500: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertDataAll_test_7600 - * @tc.name Add all details of a single contact and verify whether the insertion is successful (name, mobile - * number, company, position, nickname, email, home, remarks, aim) - * @tc.desc Function test - */ - it("contactCard_insertDataAll_test_7600", 0, async function (done) { - console.info("------logMessage contactCard_insertDataAll_test_7600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataAll_test_7600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactdata1 = await insertData(rawContactId, "name", "xiaocai", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdata1, "xiaocai"); - var contactdata2 = await insertData(rawContactId, "phone", "6500", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdata2, "6500"); - var contactdatd3 = await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd3, "TTTTT"); - var contactdatd4 = await insertData(rawContactId, "nickname", "xxxxcai", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd4, "xxxxcai"); - var contactdatd5 = await insertData(rawContactId, "email", "111@fox.com", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd5, "111@fox.com"); - var contactdatd6 = await insertData(rawContactId, "postal_address", "dddd", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd6, "dddd"); - var contactdatd7 = await insertData(rawContactId, "note", "caicai", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd7, "caicai"); - var contactdatd8 = await insertData(rawContactId, "im", "999999999", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd8, "999999999"); - sleep(1000); - await deleteRawContact("contactCard_insertDataAll_test_7600"); - await deleteAll(profileContactDataUri, "contactCard_insertDataAll_test_7600"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataAll_test_7600: raw_contact insert error = " + error); - done(); - } - }); - - async function queryAlldata(tag, DAHelper, rawContactId, contactdata, values) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactdata.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("raw_contact_id")); - console.info(tag + " result raw_contact_id = " + id); - expect(id == rawContactId).assertEqual(true); - var info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - console.info(tag + "result info = " + info + " value = " + values); - expect(info == values).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - /** - * @tc.number contactCard_insertDataAll_test_7700 - * @tc.name Add all details of a single contact and verify whether the insertion is successful (name, mobile - * number, company, position, nickname, email, home, remarks, aim, birthday, website, assistant, group, phone ring) - * @tc.desc Function test - */ - it("contactCard_insertDataAll_test_7700", 0, async function (done) { - console.info("------logMessage contactCard_insertDataAll_test_7700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataAll_test_7700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactdata1 = await insertData(rawContactId, "name", "xiaocai", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdata1, "xiaocai"); - var contactdata2 = await insertData(rawContactId, "phone", "6500", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdata2, "6500"); - var contactdatd3 = await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd3, "TTTTT"); - var contactdatd4 = await insertData(rawContactId, "nickname", "xxxxcai", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd4, "xxxxcai"); - var contactdatd5 = await insertData(rawContactId, "email", "111@fox.com", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd5, "111@fox.com"); - var contactdatd6 = await insertData(rawContactId, "postal_address", "dddd", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd6, "dddd"); - var contactdatd7 = await insertData(rawContactId, "note", "caicai", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd7, "caicai"); - var contactdatd8 = await insertData(rawContactId, "im", "999999999", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd8, "999999999"); - var contactdatd9 = await insertData(rawContactId, "contact_event", "1125", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd9, "1125"); - var contactdatd10 = await insertData(rawContactId, "website", "wwww.xxx.com", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd10, "wwww.xxx.com"); - var contactdatd11 = await insertData(rawContactId, "relation", "xiaobai", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd11, "xiaobai"); - var contactdatd12 = await insertData(rawContactId, "group_membership", 1, ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd12, 1); - var contactdatd13 = await insertData(rawContactId, "contact_misc", "5678", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd13, "5678"); - sleep(1000); - await deleteRawContact("contactCard_insertDataAll_test_7700"); - await deleteAll(profileContactDataUri, "contactCard_insertDataAll_test_7700"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataAll_test_7700: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertDataUpdateMore_test_7800 - * @tc.name Modify multiple contact details and verify whether the modification is successful - * @tc.desc Function test - */ - it("contactCard_insertDataUpdateMore_test_7800", 0, async function (done) { - console.info("------logMessage contactCard_insertDataUpdateMore_test_7800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xiaocai" - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataUpdateMore_test_7800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var insertRawContactValues = { - "display_name": "xiaotian" - }; - var rawContactIdFirst = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataUpdateMore_test_7800: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaotian", ""); - - var updateValues = { - "detail_info": "xiaocai7800" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()) - var updataCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - console.info('logMessage contactCard_insertDataUpdateMore_test_7800: updataCode = ' + updataCode); - sleep(1000); - await insertDataUpdateMoreQuery( - "contactCard_insertDataUpdateMore_test_7800", DAHelper, rawContactId, rawContactIdFirst); - await deleteRawContact("contactCard_insertDataUpdateMore_test_7800"); - await deleteAll(profileContactDataUri, "contactCard_insertDataUpdateMore_test_7800"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataUpdateMore_test_7800: raw_contact insert error = " + error); - done(); - } - }); - - async function insertDataUpdateMoreQuery(tag, DAHelper, rawContactId, rawContactIdFirst) { - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()) - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - console.info(tag + "result info = " + info); - expect(info == "xiaocai7800").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage : error = " + error); - } - } - - /** - * @tc.number contactCard_deleterestore_test_7900 - * @tc.name Modify multiple contact details and verify whether the modification is successful - * @tc.desc Function test - */ - it("contactCard_deleterestore_test_7900", 0, async function (done) { - console.info("------logMessage contactCard_deleterestore_test_7900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli7900" - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_deleterestore_test_7900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(1000); - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(profileRawContactUri, condition1); - console.info("contactCard_deleterestore_test_7900 : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - sleep(1000); - - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("id", rawContactId.toString()); - var updatevalue = { - "is_deleted": 0 - }; - var updateCode = await DAHelper.update(profileRawContactUri, updatevalue, condition2); - console.info('contactCard_deleterestore_test_7900 : update = ' + updateCode); - sleep(1000); - - var condition3 = new ohosDataAbility.DataAbilityPredicates(); - condition3.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(profileDeletedRawContactRecord, condition3); - - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("is_deleted", "0"); - await contactsQuery(map, "contactCard_deleterestore_test_7900", profileRawContactUri); - done(); - } catch (error) { - console.info("logMessage contactCard_deleterestore_test_7900: raw_contact insert error = " + error); - done(); - } - }); - - afterAll(async function () { - var tag = "Contacts_test_start_deleted"; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var DAHelperContact = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': start ! DAHelperContact = ' + DAHelperContact); - var deleteBlockList = await DAHelperContact.delete(profileBlocklistUri, condition); - console.info(tag + " : logMessage : deleteBlockList = " + deleteBlockList); - var deletedGroup = await DAHelperContact.delete(profileGroupUri, condition); - console.info(tag + " : logMessage : deletedGroup = " + deletedGroup); - var dataDeletedCode = await DAHelperContact.delete(profileContactDataUri, condition); - sleep(2000); - console.info(tag + " : logMessage : dataDeletedCode = " + dataDeletedCode); - var rawContactDeleted = await DAHelperContact.delete(profileRawContactUri, condition); - sleep(2000); - console.info(tag + " : logMessage : rawContactDeleted = " + rawContactDeleted); - var deleted = await DAHelperContact.delete(profileDeletedContactsUri, condition); - sleep(2000); - console.info(tag + " : logMessage : deleted = " + deleted); - }); - }); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactClass_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactClass_test.js deleted file mode 100644 index 38c4158bd6ed99d46cf9db4856f228f5d4b18ec8..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactClass_test.js +++ /dev/null @@ -1,310 +0,0 @@ -/* - * 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 contact from '@ohos.contact'; -import utils from '../Utils.ets' -import {describe, expect, it} from 'deccjsunit/index' - -export default function ContactClassTest() { - describe('ContactClassTest', function () { - console.log('*************ContactClassTest is start*************'); - - /* * - * @tc.number : telephony_contact_phoneNumber_test_0100 - * @tc.name : CUSTOM_LABEL NUM_HOME NUM_MOBILE NUM_WORK NUM_FAX_WORK - * @tc.desc : check class PhoneNumber - */ - it("telephony_contact_phoneNumber_test_0100", 0, async function (done) { - console.log("************* telephony_contact_phoneNumber_test_0100 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - try { - expect(0).assertEqual(contact.PhoneNumber.CUSTOM_LABEL); - expect(1).assertEqual(contact.PhoneNumber.NUM_HOME); - expect(2).assertEqual(contact.PhoneNumber.NUM_MOBILE); - expect(3).assertEqual(contact.PhoneNumber.NUM_WORK); - expect(4).assertEqual(contact.PhoneNumber.NUM_FAX_WORK); - done(); - } catch (error) { - console.log("telephony_contact_phoneNumber_test_0100 error " + error.message); - } - console.log("************* telephony_contact_phoneNumber_test_0100 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_phoneNumber_test_0200 - * @tc.name : NUM_FAX_HOME NUM_PAGER NUM_OTHER NUM_CALLBACK NUM_CAR - * @tc.desc : check class PhoneNumber - */ - it("telephony_contact_phoneNumber_test_0200", 0, async function (done) { - console.log("************* telephony_contact_phoneNumber_test_0200 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - expect(5).assertEqual(contact.PhoneNumber.NUM_FAX_HOME); - expect(6).assertEqual(contact.PhoneNumber.NUM_PAGER); - expect(7).assertEqual(contact.PhoneNumber.NUM_OTHER); - expect(8).assertEqual(contact.PhoneNumber.NUM_CALLBACK); - expect(9).assertEqual(contact.PhoneNumber.NUM_CAR); - done(); - console.log("************* telephony_contact_phoneNumber_test_0200 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_phoneNumber_test_0300 - * @tc.name : NUM_COMPANY_MAIN NUM_ISDN NUM_MAIN NUM_OTHER_FAX NUM_RADIO - * @tc.desc : check class PhoneNumber - */ - it("telephony_contact_phoneNumber_test_0300", 0, async function (done) { - console.log("************* telephony_contact_phoneNumber_test_0300 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - expect(10).assertEqual(contact.PhoneNumber.NUM_COMPANY_MAIN); - expect(11).assertEqual(contact.PhoneNumber.NUM_ISDN); - expect(12).assertEqual(contact.PhoneNumber.NUM_MAIN); - expect(13).assertEqual(contact.PhoneNumber.NUM_OTHER_FAX); - expect(14).assertEqual(contact.PhoneNumber.NUM_RADIO); - done(); - console.log("************* telephony_contact_phoneNumber_test_0300 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_phoneNumber_test_0400 - * @tc.name : NUM_TELEX NUM_TTY_TDD NUM_WORK_MOBILE NUM_WORK_PAGER NUM_ASSISTANT NUM_MMS INVALID_LABEL_ID labelName - * @tc.desc : check class PhoneNumber - */ - it("telephony_contact_phoneNumber_test_0400", 0, async function (done) { - console.log("************* telephony_contact_phoneNumber_test_0400 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - expect(15).assertEqual(contact.PhoneNumber.NUM_TELEX); - expect(16).assertEqual(contact.PhoneNumber.NUM_TTY_TDD); - expect(17).assertEqual(contact.PhoneNumber.NUM_WORK_MOBILE); - expect(18).assertEqual(contact.PhoneNumber.NUM_WORK_PAGER); - expect(19).assertEqual(contact.PhoneNumber.NUM_ASSISTANT); - expect(20).assertEqual(contact.PhoneNumber.NUM_MMS); - expect(-1).assertEqual(contact.PhoneNumber.INVALID_LABEL_ID); - expect(typeof contact.PhoneNumber.labelName).assertEqual("string"); - done(); - console.log("************* telephony_contact_phoneNumber_test_0400 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_postalAddress_test_0100 - * @tc.name : CUSTOM_LABEL ADDR_HOME ADDR_WORK ADDR_OTHER INVALID_LABEL_ID - * @tc.desc : check class PostalAddress - */ - it("telephony_contact_postalAddress_test_0100", 0, async function (done) { - console.log("************* telephony_contact_postalAddress_test_0100 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - expect(0).assertEqual(contact.PostalAddress.CUSTOM_LABEL); - expect(1).assertEqual(contact.PostalAddress.ADDR_HOME); - expect(2).assertEqual(contact.PostalAddress.ADDR_WORK); - expect(3).assertEqual(contact.PostalAddress.ADDR_OTHER); - expect(-1).assertEqual(contact.PostalAddress.INVALID_LABEL_ID); - done(); - console.log("************* telephony_contact_postalAddress_test_0100 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_postalAddress_test_0200 - * @tc.name : labelName neighborhood pobox postalAddress postcode street - * @tc.desc : check class PostalAddress - */ - it("telephony_contact_postalAddress_test_0200", 0, async function (done) { - console.log("************* telephony_contact_postalAddress_test_0200 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - try { - var postalAddress = new contact.PostalAddress({ - 'labelName': 'testLabel', - 'neighborhood': 'beijing', - 'pobox': 'testBox', - 'postalAddress': 'testAddress', - 'postcode': 'testCode', - 'street': 'testStreet' - }) - expect(postalAddress.labelName).assertEqual('testLabel'); - expect(postalAddress.neighborhood).assertEqual('beijing'); - expect(postalAddress.pobox).assertEqual('testBox'); - expect(postalAddress.postalAddress).assertEqual('testAddress'); - expect(postalAddress.postcode).assertEqual('testCode'); - expect(postalAddress.street).assertEqual('testStreet'); - } catch (err) { - console.log("telephony_contact_postalAddress_test_0200 test error " + err.message); - } - done(); - console.log("************* telephony_contact_postalAddress_test_0200 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_relation_test_0100 - * @tc.name : CUSTOM_LABEL ADDR_HOME ADDR_WORK ADDR_OTHER INVALID_LABEL_ID - * @tc.desc : check class Relation - */ - it("telephony_contact_relation_test_0100", 0, async function (done) { - console.log("************* telephony_contact_relation_test_0100 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - expect(0).assertEqual(contact.Relation.CUSTOM_LABEL); - expect(1).assertEqual(contact.Relation.RELATION_ASSISTANT); - expect(2).assertEqual(contact.Relation.RELATION_BROTHER); - expect(3).assertEqual(contact.Relation.RELATION_CHILD); - expect(4).assertEqual(contact.Relation.RELATION_DOMESTIC_PARTNER); - done(); - console.log("************* telephony_contact_relation_test_0100 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_relation_test_0200 - * @tc.name : RELATION_FATHER RELATION_FRIEND RELATION_MANAGER RELATION_MOTHER RELATION_PARENT - * @tc.desc : check class Relation - */ - it("telephony_contact_relation_test_0200", 0, async function (done) { - console.log("************* telephony_contact_relation_test_0200 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - expect(5).assertEqual(contact.Relation.RELATION_FATHER); - expect(6).assertEqual(contact.Relation.RELATION_FRIEND); - expect(7).assertEqual(contact.Relation.RELATION_MANAGER); - expect(8).assertEqual(contact.Relation.RELATION_MOTHER); - expect(9).assertEqual(contact.Relation.RELATION_PARENT); - done(); - console.log("************* telephony_contact_relation_test_0200 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_Relation_test_0300 - * @tc.name : RELATION_PARTNER RELATION_REFERRED_BY RELATION_RELATIVE - RELATION_SISTER RELATION_SPOUSE INVALID_LABEL_ID - * @tc.desc : check class Relation - */ - it("telephony_contact_relation_test_0300", 0, async function (done) { - console.log("************* telephony_contact_relation_test_0300 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - expect(10).assertEqual(contact.Relation.RELATION_PARTNER); - expect(11).assertEqual(contact.Relation.RELATION_REFERRED_BY); - expect(12).assertEqual(contact.Relation.RELATION_RELATIVE); - expect(13).assertEqual(contact.Relation.RELATION_SISTER); - expect(14).assertEqual(contact.Relation.RELATION_SPOUSE); - expect(-1).assertEqual(contact.Relation.INVALID_LABEL_ID); - done(); - console.log("************* telephony_contact_relation_test_0300 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_relation_test_0400 - * @tc.name : labelName relationName - * @tc.desc : check class Relation - */ - it("telephony_contact_relation_test_0400", 0, async function (done) { - console.log("************* telephony_contact_relation_test_0400 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - try { - var relation = new contact.Relation({ - 'labelName': 'testLabel', - 'relationName': 'testRelation' - }) - expect(relation.labelName).assertEqual('testLabel'); - expect(relation.relationName).assertEqual('testRelation'); - } catch (err) { - console.log("telephony_contact_relation_test_0400 test error " + err.message); - } - done(); - console.log("************* telephony_contact_relation_test_0400 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_sipAddress_test_0100 - * @tc.name : CUSTOM_LABEL SIP_HOME SIP_WORK SIP_OTHER INVALID_LABEL_ID - * @tc.desc : check class SipAddress - */ - it("telephony_contact_sipAddress_test_0100", 0, async function (done) { - console.log("************* telephony_contact_sipAddress_test_0100 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - expect(0).assertEqual(contact.SipAddress.CUSTOM_LABEL); - expect(1).assertEqual(contact.SipAddress.SIP_HOME); - expect(2).assertEqual(contact.SipAddress.SIP_WORK); - expect(3).assertEqual(contact.SipAddress.SIP_OTHER); - expect(-1).assertEqual(contact.SipAddress.INVALID_LABEL_ID); - done(); - console.log("************* telephony_contact_sipAddress_test_0100 Test end*************"); - }); - - /* * - * @tc.number : telephony_contact_sipAddress_test_0200 - * @tc.name : labelName sipAddress - * @tc.desc : check class SipAddress - */ - it("telephony_contact_sipAddress_test_0200", 0, async function (done) { - console.log("************* telephony_contact_sipAddress_test_0200 Test start*************"); - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - - try { - var sip = new contact.SipAddress({ - 'labelName': 'testLabel', - 'sipAddress': 'testSip' - }) - expect(sip.labelName).assertEqual('testLabel'); - expect(sip.sipAddress).assertEqual('testSip'); - } catch (err) { - console.log("telephony_contact_sipAddress_test_0200 test error " + err.message); - } - done(); - console.log("************* telephony_contact_sipAddress_test_0200 Test end*************"); - }); - console.log('*************ContactClassTest is end*************'); - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContacterJsunit.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContacterJsunit.ets deleted file mode 100644 index a5e2873bfab59f8bf597a1190f6839e92841e89c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContacterJsunit.ets +++ /dev/null @@ -1,262 +0,0 @@ -// @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' -import contact from '@ohos.contact'; -import utils from '../Utils.ets' - -export default function contacterJsunit() { - describe('ContacterTest',function () { - /** - * @tc.number Telephony_contact_Contact_0100 - * @tc.name Test The Contact enum - * @tc.desc Function test - */ - - it('Telephony_contact_Contact_0100', 0, async function (done) { - console.info("Telephony_contact_Contact_0100 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.Contact.INVALID_CONTACT_ID === -1).assertTrue(); - expect(contact.Contact.id === 0).assertTrue(); - expect(contact.Contact.key !== "test").assertTrue(); - console.info("Telephony_contact_Contact_0100 end") - done(); - }); - - /** - * @tc.number Telephony_contact_Contact_0200 - * @tc.name Test The Contact enum - * @tc.desc Function test - */ - - it('Telephony_contact_Contact_0200', 0, async function (done) { - console.info("Telephony_contact_Contact_0200 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.Contact.INVALID_CONTACT_ID === -1).assertTrue(); - expect(contact.Contact.id === 1).assertTrue(); - expect(contact.Contact.key !== "key").assertTrue(); - console.info("Telephony_contact_Contact_0200 end") - done(); - }); - - /** - * @tc.number Telephony_contact_Attribute_0100 - * @tc.name Test The Attribute enum - * @tc.desc Function test - */ - it('Telephony_contact_Attribute_0100', 0, async function (done) { - console.info("Telephony_contact_Attribute_0100 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.Attribute.ATTR_CONTACT_EVENT === 0).assertTrue(); - expect(contact.Attribute.ATTR_EMAIL === 0).assertTrue(); - expect(contact.Attribute.ATTR_GROUP_MEMBERSHIP === 0).assertTrue(); - expect(contact.Attribute.ATTR_IM === 0).assertTrue(); - expect(contact.Attribute.ATTR_NAME === 0).assertTrue(); - expect(contact.Attribute.ATTR_NICKNAME === 0).assertTrue(); - expect(contact.Attribute.ATTR_NOTE === 0).assertTrue(); - expect(contact.Attribute.ATTR_ORGANIZATION === 0).assertTrue(); - expect(contact.Attribute.ATTR_PHONE === 0).assertTrue(); - expect(contact.Attribute.ATTR_PORTRAIT === 0).assertTrue(); - expect(contact.Attribute.ATTR_POSTAL_ADDRESS === 0).assertTrue(); - expect(contact.Attribute.ATTR_RELATION === 0).assertTrue(); - expect(contact.Attribute.ATTR_SIP_ADDRESS === 0).assertTrue(); - expect(contact.Attribute.ATTR_WEBSITE === 0).assertTrue(); - console.info("Telephony_contact_Attribute_0100 end") - done(); - }); - - /** - * @tc.number Telephony_contact_Attribute_0200 - * @tc.name Test The Attribute enum - * @tc.desc Function test - */ - it('Telephony_contact_Attribute_0200', 0, async function (done) { - console.info("Telephony_contact_Attribute_0100 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.Attribute.ATTR_CONTACT_EVENT === 1).assertTrue(); - expect(contact.Attribute.ATTR_EMAIL === 1).assertTrue(); - expect(contact.Attribute.ATTR_GROUP_MEMBERSHIP === 1).assertTrue(); - expect(contact.Attribute.ATTR_IM === 1).assertTrue(); - expect(contact.Attribute.ATTR_NAME === 1).assertTrue(); - expect(contact.Attribute.ATTR_NICKNAME === 1).assertTrue(); - expect(contact.Attribute.ATTR_NOTE === 1).assertTrue(); - expect(contact.Attribute.ATTR_ORGANIZATION === 1).assertTrue(); - expect(contact.Attribute.ATTR_PHONE === 1).assertTrue(); - expect(contact.Attribute.ATTR_PORTRAIT === 1).assertTrue(); - expect(contact.Attribute.ATTR_POSTAL_ADDRESS === 1).assertTrue(); - expect(contact.Attribute.ATTR_RELATION === 1).assertTrue(); - expect(contact.Attribute.ATTR_SIP_ADDRESS === 1).assertTrue(); - expect(contact.Attribute.ATTR_WEBSITE === 1).assertTrue(); - console.info("Telephony_contact_Attribute_0200 end") - done(); - }); - - /** - * @tc.number Telephony_contact_Email_0100 - * @tc.name Test The Attribute Email - * @tc.desc Function test - */ - it('Telephony_contact_Email_0100', 0, async function (done) { - console.info("Telephony_contact_Email_0100 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.Email.CUSTOM_LABEL === 0).assertTrue(); - expect(contact.Email.EMAIL_HOME === 1).assertTrue(); - expect(contact.Email.EMAIL_WORK === 2).assertTrue(); - expect(contact.Email.EMAIL_OTHER === 3).assertTrue(); - expect(contact.Email.INVALID_LABEL_ID === -1).assertTrue(); - expect(contact.Email.email !== "email").assertTrue(); - expect(contact.Email.labelName !== "email").assertTrue(); - expect(contact.Email.displayName !== "email").assertTrue(); - console.info("Telephony_contact_Email_0100 end") - done(); - }); - - /** - * @tc.number Telephony_contact_Email_0200 - * @tc.name Test The Attribute Email - * @tc.desc Function test - */ - it('Telephony_contact_Email_0200', 0, async function (done) { - console.info("Telephony_contact_Email_0200 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.Email.CUSTOM_LABEL === 0).assertTrue(); - expect(contact.Email.EMAIL_HOME === 1).assertTrue(); - expect(contact.Email.EMAIL_WORK === 2).assertTrue(); - expect(contact.Email.EMAIL_OTHER === 3).assertTrue(); - expect(contact.Email.INVALID_LABEL_ID === -1).assertTrue(); - expect(contact.Email.email !== "email2").assertTrue(); - expect(contact.Email.labelName !== "email2").assertTrue(); - expect(contact.Email.displayName !== "email2").assertTrue(); - console.info("Telephony_contact_Email_0200 end") - done(); - }); - - /** - * @tc.number Telephony_contact_Event_0100 - * @tc.name Test The Attribute Event - * @tc.desc Function test - */ - it('Telephony_contact_Event_0100', 0, async function (done) { - console.info("Telephony_contact_Event_0100 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.Event.CUSTOM_LABEL === 0).assertTrue(); - expect(contact.Event.EVENT_ANNIVERSARY === 1).assertTrue(); - expect(contact.Event.EVENT_OTHER === 2).assertTrue(); - expect(contact.Event.EVENT_BIRTHDAY === 3).assertTrue(); - expect(contact.Event.INVALID_LABEL_ID === -1).assertTrue(); - expect(contact.Event.eventDate !== "event").assertTrue(); - expect(contact.Event.labelName !== "event").assertTrue(); - console.info("Telephony_contact_Event_0100 end") - done(); - }); - - /** - * @tc.number Telephony_contact_Event_0200 - * @tc.name Test The Attribute Event - * @tc.desc Function test - */ - it('Telephony_contact_Event_0200', 0, async function (done) { - console.info("Telephony_contact_Event_0200 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.Event.CUSTOM_LABEL === 0).assertTrue(); - expect(contact.Event.EVENT_ANNIVERSARY === 1).assertTrue(); - expect(contact.Event.EVENT_OTHER === 2).assertTrue(); - expect(contact.Event.EVENT_BIRTHDAY === 3).assertTrue(); - expect(contact.Event.INVALID_LABEL_ID === -1).assertTrue(); - expect(contact.Event.eventDate !== "event2").assertTrue(); - expect(contact.Event.labelName !== "event2").assertTrue(); - console.info("Telephony_contact_Event_0200 end") - done(); - }); - - /** - * @tc.number Telephony_contact_ImAddress_0100 - * @tc.name Test The Attribute ImAddress - * @tc.desc Function test - */ - it('Telephony_contact_ImAddress_0100', 0, async function (done) { - console.info("Telephony_contact_ImAddress_0100 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.ImAddress.CUSTOM_LABEL === -1).assertTrue(); - expect(contact.ImAddress.IM_AIM === 0).assertTrue(); - expect(contact.ImAddress.IM_MSN === 1).assertTrue(); - expect(contact.ImAddress.IM_YAHOO === 2).assertTrue(); - expect(contact.ImAddress.IM_SKYPE === 3).assertTrue(); - expect(contact.ImAddress.IM_QQ === 4).assertTrue(); - expect(contact.ImAddress.IM_ICQ === 6).assertTrue(); - expect(contact.ImAddress.IM_JABBER === 7).assertTrue(); - expect(contact.ImAddress.INVALID_LABEL_ID === -2).assertTrue(); - expect(contact.ImAddress.imAddress !== "imAddress").assertTrue(); - expect(contact.ImAddress.labelName !== "imAddress").assertTrue(); - console.info("Telephony_contact_ImAddress_0100 end") - done(); - }); - - /** - * @tc.number Telephony_contact_ImAddress_0200 - * @tc.name Test The Attribute ImAddress - * @tc.desc Function test - */ - it('Telephony_contact_ImAddress_0200', 0, async function (done) { - console.info("Telephony_contact_ImAddress_0100 start") - if(utils.notCheck){ - done(); - return; - } - expect(contact.ImAddress.CUSTOM_LABEL === -1).assertTrue(); - expect(contact.ImAddress.IM_AIM === 0).assertTrue(); - expect(contact.ImAddress.IM_MSN === 1).assertTrue(); - expect(contact.ImAddress.IM_YAHOO === 2).assertTrue(); - expect(contact.ImAddress.IM_SKYPE === 3).assertTrue(); - expect(contact.ImAddress.IM_QQ === 4).assertTrue(); - expect(contact.ImAddress.IM_ICQ === 6).assertTrue(); - expect(contact.ImAddress.IM_JABBER === 7).assertTrue(); - expect(contact.ImAddress.INVALID_LABEL_ID === -2).assertTrue(); - expect(contact.ImAddress.imAddress !== "imAddress2").assertTrue(); - expect(contact.ImAddress.labelName !== "imAddress2").assertTrue(); - console.info("Telephony_contact_ImAddress_0200 end") - done(); - }); - - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Contacts_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Contacts_test.js deleted file mode 100644 index 420b2f75603bbfc5f12df6f707aeab9c245fbdec..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Contacts_test.js +++ /dev/null @@ -1,6306 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const contactUri = "dataability:///com.ohos.contactsdataability/contacts/contact"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; -const groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; -const contactBlocklistUri = "dataability:///com.ohos.contactsdataability/contacts/contact_blocklist"; -const deletedRawContactUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; -const searchContactUri = "dataability:///com.ohos.contactsdataability/contacts/search_contact"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; -const deletedRawContactRecord = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact_record"; - -export default function ContactsTest() { - describe('ContactsTest', function () { - console.info("-------ContactsTest is starting!--------"); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - async function contactsQuery(map, tag, uri) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - sleep(2000); - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' :logMessage contactsQuery key = ' + key + ' dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - async function queryBatch(map, tag, size) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryBatch start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", map.get("raw_contact_id")); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - console.info(tag + ': queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage resultSet.rowCount: error = " + error); - } - } - - async function queryIdForDelete(map, tag, uri) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryIdForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - sleep(1000); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage queryIdForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - async function deleteAll(uri, tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(uri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info(tag + ': deleteAll error = ' + error); - } - } - - async function deleteRawContact(tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - console.info(tag + ': deleteRawContact deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - sleep(1000); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - var code = await DAHelper.delete(deletedUri, conditionAll); - console.info(tag + ': Completely delete code = ' + code); - expect(code == 0).assertTrue(); - } catch (error) { - console.info(tag + ': deleteRawContact error = ' + error); - } - } - - async function insertData(rawContactId, type, value, position) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var contactDataValues1 = - { - "raw_contact_id": rawContactId, "content_type": type, "detail_info": value, "position": position - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("logMessage : contactDataId1 " + contactDataId1); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage : contact_data name insert error = " + error); - } - return contactDataId; - } - - /** - * @tc.number contact_insert_test_100 - * @tc.name Insert contact data - * @tc.desc Function test - */ - it("contact_insert_test_100", 0, async function (done) { - console.info("------logMessage contact_insert_test_100 is starting!-----"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_insert_test_100: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_insert_test_100", rawContactUri); - await deleteRawContact("contact_insert_test_100"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_100: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_insert_test_400 - * @tc.name Insert contact details (name, company, position, mobile phone number) - * @tc.desc Function test - */ - it("contact_insert_test_400", 0, async function (done) { - console.info("------logMessage contact_insert_test_400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataNameInsert(DAHelper, rawContactId); - await dataCompanyInsert(DAHelper, rawContactId); - await dataPhoneInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_400"); - await deleteAll(contactDataUri, "contact_insert_test_400"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_400: raw_contact insert error = " + error); - done(); - } - }); - - async function dataNameInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaocheng" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("logMessage contact_insert_test_400: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "xiaocheng"); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contact_insert_test_400", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_400: contact_data name insert error = " + error); - done(); - } - } - - async function dataCompanyInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "developer" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info("logMessage contact_insert_test_400: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "TT"); - map.set("position", "developer"); - contactsQuery(map, "contact_insert_test_400", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_400: contact_data company insert error = " + error); - done(); - } - } - - async function dataPhoneInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "12345678" - }; - try { - var contactDataId3 = await DAHelper.insert(contactDataUri, contactDataValues3); - sleep(1000); - console.info("logMessage contact_insert_test_400: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "12345678"); - await contactsQuery(map, "contact_insert_test_400", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_400: contact_data phone insert error = " + error); - done(); - } - } - - /** - * @tc.number contact_insert_test_500 - * @tc.name Insert contact details (nickname, email, home) - * @tc.desc Function test - */ - it("contact_insert_test_500", 0, async function (done) { - console.info("------logMessage contact_insert_test_500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataEmailInsert(DAHelper, rawContactId); - await dataNickNameInsert(DAHelper, rawContactId); - await dataPostalAddressInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_500"); - await deleteAll(contactDataUri, "contact_insert_test_500"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_500: raw_contact insert error = " + error); - done(); - } - }); - - async function dataEmailInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "166@163.com" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contact_insert_test_500: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "166@163.com"); - await contactsQuery(map, "contact_insert_test_500_1", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_500: contact_data email insert error = " + error); - } - } - - async function dataNickNameInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaocheng" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info("logMessage contact_insert_test_500: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "xiaocheng"); - await contactsQuery(map, "contact_insert_test_500_2", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_500: contact_data nickname insert error = " + error); - } - } - - async function dataPostalAddressInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "NanJingSoftRoad" - }; - try { - var contactDataId3 = await DAHelper.insert(contactDataUri, contactDataValues3); - console.info("logMessage contact_insert_test_500: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "NanJingSoftRoad"); - await contactsQuery(map, "contact_insert_test_500_3", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_500: contact_data postal_address insert error = " + error); - } - } - - /** - * @tc.number contact_insert_test_600 - * @tc.name Insert contact details (remarks, AIM, birthday) - * @tc.desc Function test - */ - it("contact_insert_test_600", 0, async function (done) { - console.info("------logMessage contact_insert_test_600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues) - console.info("logMessage contact_insert_test_600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataNoteInsert(DAHelper, rawContactId); - await dataAimInsert(DAHelper, rawContactId); - await dataEventInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_600"); - await deleteAll(contactDataUri, "contact_insert_test_600"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_600: raw_contact insert error = " + error); - done(); - } - }); - - async function dataNoteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "note", - "detail_info": "javaGangster" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("logMessage contact_insert_test_600: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "javaGangster"); - await contactsQuery(map, "contact_insert_test_600_1", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_600: contact_data note insert error = " + error); - done(); - } - } - - async function dataAimInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, "content_type": "im", "detail_info": "aaaaa" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info("logMessage contact_insert_test_600: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "aaaaa"); - await contactsQuery(map, "contact_insert_test_600_2", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_600: contact_data aim insert error = " + error); - } - } - - async function dataEventInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "contact_event", - "detail_info": "19960229" - }; - try { - var contactDataId3 = await DAHelper.insert(contactDataUri, contactDataValues3); - console.info("logMessage contact_insert_test_600: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "19960229"); - await contactsQuery(map, "contact_insert_test_600_3", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_600: contact_data event insert error = " + error); - } - } - - /** - * @tc.number contact_insert_test_700 - * @tc.name Insert contact details (URL, assistant, group) - * @tc.desc Function test - */ - it("contact_insert_test_700", 0, async function (done) { - console.info("------logMessage contact_insert_test_700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataWebsiteInsert(DAHelper, rawContactId); - await dataRelationInsert(DAHelper, rawContactId); - await dataWebsiteInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_700"); - await deleteAll(contactDataUri, "contact_insert_test_700"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_700: raw_contact insert error = " + error); - done(); - } - }); - - async function dataWebsiteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "website", - "detail_info": "www.com" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contact_insert_test_700: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "www.com"); - await contactsQuery(map, "contact_insert_test_700_1", contactDataUri); - await contactDataRelationInsert(); - } catch (error) { - console.info("logMessage contact_insert_test_700: contact_data website insert error = " + error); - } - } - - async function dataRelationInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "relation", - "detail_info": "Secretary" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues2); - sleep(1000); - console.info("logMessage contact_insert_test_700: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "Secretary"); - await contactsQuery(map, "contact_insert_test_700_2", contactDataUri); - await contactDataGroupInsert(); - } catch (error) { - console.info("logMessage contact_insert_test_700: contact_data relation insert error = " + error); - } - } - - async function dataGroupInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": "1" - }; - try { - var contactDataId3 = await DAHelper.insert(contactDataUri, contactDataValues3); - sleep(1000); - console.info("logMessage contact_insert_test_700: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "1"); - await contactsQuery(map, "contact_insert_test_700_3", contactDataUri); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_700: contact_data group insert error = " + error); - } - } - - /** - * @tc.number contact_insert_test_800 - * @tc.name Insert contact details (phone ringtone) - * @tc.desc Function test - */ - it("contact_insert_test_800", 0, async function (done) { - console.info("------logMessage contact_insert_test_800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataMiscInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_800"); - await deleteAll(contactDataUri, "contact_insert_test_800"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_800: raw_contact insert error = " + error); - done(); - } - }); - - async function dataMiscInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_misc", - "detail_info": "1234" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contact_insert_test_800: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "1234"); - await contactsQuery(map, "contact_insert_test_800_1", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_800: contact_data misc insert error = " + error); - } - } - - /** - * @tc.number contact_update_test_900 - * @tc.name Update contact data - * @tc.desc Function test - */ - it("contact_update_test_900", 0, async function (done) { - console.info("------logMessage contact_update_test_900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "licheng", - "company": "TT", - "position": "developer", - "favorite": 1, - "phonetic_name": "licheng||lc" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_900"); - await deleteAll(contactDataUri, "contact_update_test_900"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_900: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactUpdate(DAHelper, rawContactId) { - var updateValues = { - "display_name": "dacheng", - "company": "oo", - "position": "Testers", - "favorite": 0, - "phonetic_name": "dacheng||dc" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_900: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "dacheng"); - map.set("company", "oo"); - map.set("position", "Testers"); - map.set("favorite", "0"); - map.set("phonetic_name", "dacheng||dc"); - await contactsQuery(map, "contact_update_test_900", rawContactUri); - } catch (error) { - console.info('logMessage contact_update_test_900: raw_contact update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1200 - * @tc.name Update contact details (name) - * @tc.desc Function test - */ - it("contact_update_test_1200", 0, async function (done) { - console.info("------logMessage contact_update_test_1200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNameInsert(DAHelper, rawContactId); - await dataNameUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1200"); - await deleteAll(contactDataUri, "contact_update_test_1200"); - done(); - } catch (error) { - console.info('logMessage contact_update_test_1200: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataNameInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "xiaoyuan" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1200: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1200: contact_data insert error = ' + error); - } - } - - async function dataNameUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "dayuan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1200: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "dayuan"); - await contactsQuery(map, "contact_update_test_1200", rawContactUri); - } catch (error) { - console.info('logMessage contact_update_test_1200: contact_data update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1300 - * @tc.name Update contact details (company, position) - * @tc.desc Function test - */ - it("contact_update_test_1300", 0, async function (done) { - console.info("------logMessage contact_update_test_1300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataCompanyInsert(DAHelper, rawContactId); - await dataCompanyUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1300"); - await deleteAll(contactDataUri, "contact_update_test_1300"); - done(); - } catch (error) { - console.info('logMessage contact_update_test_1300: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataCompanyInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "Testers", - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1300: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1300: contact_data insert error = ' + error); - } - } - - async function dataCompanyUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "OOOO", "position": "developer" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1300: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("company", "OOOO"); - map.set("position", "developer"); - await contactsQuery(map, "contact_update_test_1300", rawContactUri); - } catch (error) { - console.info('logMessage contact_update_test_1300: contact_data update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1400 - * @tc.name Update contact details (mobile phone number) - * @tc.desc Function test - */ - it("contact_update_test_1400", 0, async function (done) { - console.info("------logMessage contact_update_test_1400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataPhoneInsert(DAHelper, rawContactId); - await dataPhoneUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1400"); - await deleteAll(contactDataUri, "contact_update_test_1400"); - done(); - } catch (error) { - console.info('logMessage contact_update_test_1400: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforeDataPhoneInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "phone", "detail_info": "123456" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1400: contact_data insert error = ' + error); - } - } - - async function dataPhoneUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "99663355" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1400: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "99663355"); - await contactsQuery(map, "contact_update_test_1400", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1400: contact_data update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1500 - * @tc.name Update contact details (nickname) - * @tc.desc Function test - */ - it("contact_update_test_1500", 0, async function (done) { - console.info("------logMessage contact_update_test_1500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNickNameInsert(DAHelper, rawContactId); - await dataNickNameUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1500"); - await deleteAll(contactDataUri, "contact_update_test_1500"); - done(); - } catch (error) { - console.info('logMessage contact_update_test_1500: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataNickNameInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaoyuan" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1500: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1500: contact_data insert error = ' + error); - } - } - - async function dataNickNameUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "fengyuan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1500: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "fengyuan"); - await contactsQuery(map, "contact_update_test_1500", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1500: contact_data update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1600 - * @tc.name Update contact details (email) - * @tc.desc Function test - */ - it("contact_update_test_1600", 0, async function (done) { - console.info("------logMessage contact_update_test_1600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataEmailInsert(DAHelper, rawContactId); - await dataEmailUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1600"); - await deleteAll(contactDataUri, "contact_update_test_1600"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_1600: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataEmailInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "166@163.com" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1600: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1600: contact_data insert error = ' + error); - } - } - - async function dataEmailUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "199@163.com" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition) - sleep(1000); - console.info('logMessage contact_update_test_1600: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "199@163.com"); - await contactsQuery(map, "contact_update_test_1600", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1600: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1700 - * @tc.name Update Contact Details (Residential) - * @tc.desc Function test - */ - it("contact_update_test_1700", 0, async function (done) { - console.info("------logMessage contact_update_test_1700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataPostalInsert(DAHelper, rawContactId); - await dataPostalUpdate(); - await deleteRawContact("contact_update_test_1700"); - await deleteAll(contactDataUri, "contact_update_test_1700"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_1700: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataPostalInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "NanJing" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1700: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_update_test_1700: contact_data insert error = " + error); - } - } - - async function dataPostalUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "BeiJing" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1700: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "BeiJing"); - await contactsQuery(map, "contact_update_test_1700", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1700: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1800 - * @tc.name Update contact details (remarks) - * @tc.desc Function test - */ - it("contact_update_test_1800", 0, async function (done) { - console.info("------logMessage contact_update_test_1800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNoteInsert(DAHelper, rawContactId); - await dataNoteUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1800"); - await deleteAll(contactDataUri, "contact_update_test_1800"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_1800: raw_contact insert error = " + error); - done(); - } - }); - - async function beforedataNoteInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "note", "detail_info": "Gangster" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1800: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1800: contact_data insert error = ' + error); - } - } - - async function dataNoteUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "God" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1800: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "God"); - await contactsQuery(map, "contact_update_test_1800", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1800: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1900 - * @tc.name Update Contact Details (AIM) - * @tc.desc Function test - */ - it("contact_update_test_1900", 0, async function (done) { - console.info("------logMessage contact_update_test_1900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues) - console.info("logMessage contact_update_test_1900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataAimInsert(DAHelper, rawContactId); - await dataAimUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1900"); - await deleteAll(contactDataUri, "contact_update_test_1900"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_1900: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataAimInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "im", "detail_info": "aaaaa" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1900: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_update_test_1900: contact_data insert error = " + error); - } - } - - async function dataAimUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "bbbbb" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1900: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "bbbbb"); - await contactsQuery(map, "contact_update_test_1900", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1900: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2000 - * @tc.name Update Contact Details (Birthday) - * @tc.desc Function test - */ - it("contact_update_test_2000", 0, async function (done) { - console.info("------logMessage contact_update_test_2000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_2000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataEventInsert(DAHelper, rawContactId); - await dataEventUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2000"); - await deleteAll(contactDataUri, "contact_update_test_2000"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2000: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataEventInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_event", - "detail_info": "19960229" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contact_update_test_2000: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2000: contact_data insert error = ' + error); - } - } - - async function dataEventUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "19971021" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2000: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "19971021"); - await contactsQuery(map, "contact_update_test_2000", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2000: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2100 - * @tc.name Update contact details (website) - * @tc.desc Function test - */ - it("contact_update_test_2100", 0, async function (done) { - console.info("------logMessage contact_update_test_2100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_2100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataWebsiteInsert(DAHelper, rawContactId); - await dataWebsiteUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2100"); - await deleteAll(contactDataUri, "contact_update_test_2100"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2100: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataWebsiteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "website", - "detail_info": "www.com" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contact_update_test_2100: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2100: contact_data insert error = ' + error); - } - } - - async function dataWebsiteUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "www.123.com" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2100: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "www.123.com"); - await contactsQuery(map, "contact_update_test_2100", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2100: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2200 - * @tc.name Update contact details (assistant) - * @tc.desc Function test - */ - it("contact_update_test_2200", 0, async function (done) { - console.info("------logMessage contact_update_test_2200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_2200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataRelationInsert(DAHelper, rawContactId); - await dataRelationUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2200"); - await deleteAll(contactDataUri, "contact_update_test_2200"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2200: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataRelationInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "relation", - "detail_info": "Secretary" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_update_test_2200: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2200: contact_data insert error = ' + error); - } - } - - async function dataRelationUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "spouse" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2200: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "spouse"); - await contactsQuery(map, "contact_update_test_2200", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2200: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2300 - * @tc.name Update contact detail data table (group) - * @tc.desc Function test - */ - it("contact_update_test_2300", 0, async function (done) { - console.info("------logMessage contact_update_test_2300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_2300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataGroupInsert(DAHelper, rawContactId); - await dataGroupUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2300"); - await deleteAll(contactDataUri, "contact_update_test_2300"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2300: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataGroupInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": "2" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_2300: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2300: contact_data insert error = ' + error); - } - } - - async function dataGroupUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "7" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2300: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "3"); - await contactsQuery(map, "contact_update_test_2300", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2300: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2400 - * @tc.name Update contact detail data table (phone ringtone) - * @tc.desc Function test - */ - it("contact_update_test_2400", 0, async function (done) { - console.info("------logMessage contact_update_test_2400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contact_update_test_2400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataMiscInsert(DAHelper, rawContactId); - await dataMiscUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2400"); - await deleteAll(contactDataUri, "contact_update_test_2400"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2400: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataMiscInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_misc", - "detail_info": "1234" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contact_update_test_2400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2400: contact_data insert error = ' + error); - } - } - - async function dataMiscUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "999" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2400: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "999"); - await contactsQuery(map, "contact_update_test_2300", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2400: update error = ' + error); - } - } - - /** - * @tc.number contact_favorite_test_2500 - * @tc.name Favorite contacts - * @tc.desc Function test - */ - it("contact_favorite_test_2500", 0, async function (done) { - console.info("-------logMessage contact_favorite_test_2500 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaocai", "company": "TT", "position": "Testers" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues) - console.info('logMessage contact_favorite_test_2500: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await updateFavorite(DAHelper, rawContactId); - await deleteRawContact("contact_favorite_test_2500"); - done(); - } catch (error) { - console.info('logMessage contact_favorite_test_2500: raw_contact insert error = ' + error); - done(); - } - }); - - async function updateFavorite(DAHelper, rawContactId) { - var updateValues = { - "favorite": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_favorite_test_2500: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaocai"); - map.set("company", "TT"); - map.set("position", "Testers"); - map.set("favorite", "1"); - await contactsQuery(map, "contact_favorite_test_2500", rawContactUri); - } catch (error) { - console.info('logMessage contact_favorite_test_2500: update error = ' + error); - } - } - - /** - * @tc.number contact_unfavorite_test_2600 - * @tc.name Unfavorite contacts - * @tc.desc Function test - */ - it("contact_unfavorite_test_2600", 0, async function (done) { - console.info("-------logMessage contact_unfavorite_test_2600 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaohong", "company": "TT", "position": "Testers", "favorite": 1 - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info('logMessage contact_unfavorite_test_2600: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await updateUnFavorite(DAHelper, rawContactId); - await deleteRawContact("contact_unfavorite_test_2600"); - done(); - } catch (error) { - console.info('logMessage contact_unfavorite_test_2600: raw_contact insert error = ' + error); - done(); - } - }); - - async function updateUnFavorite(DAHelper, rawContactId) { - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_unfavorite_test_2600: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaohong"); - map.set("company", "TT"); - map.set("position", "Testers"); - map.set("favorite", "0"); - await contactsQuery(map, "contact_favorite_test_2500", rawContactUri); - } catch (error) { - console.info("logMessage contact_unfavorite_test_2600: update error = " + error); - } - } - - /** - * @tc.number contact_insert_test_2700 - * @tc.name Insert contact black list - * @tc.desc Function test - */ - it("contact_insert_test_2700", 0, async function (done) { - console.info("-------logMessage contact_insert_test_2700 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var blocklistId = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - sleep(1000); - console.info('logMessage contact_insert_test_2700: blocklistId = ' + blocklistId); - expect(blocklistId > 0).assertTrue(); - var map = common.getProfileBlockListMap(); - map.set("id", blocklistId.toString()); - await contactsQuery(map, "contact_insert_test_2700", contactBlocklistUri); - await deleteAll(contactBlocklistUri, "contact_insert_test_2700"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_2700: blocklist insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_delete_test_2800 - * @tc.name Delete contact black list - * @tc.desc Function test - */ - it("contact_delete_test_2800", 0, async function (done) { - console.info("-------logMessage contact_delete_test_2800 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var blocklistId = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - sleep(1000); - console.info('logMessage contact_delete_test_2800: blocklistId = ' + blocklistId); - expect(blocklistId > 0).assertTrue(); - await blocklistDelete(); - done(); - } catch (error) { - console.info('logMessage contact_delete_test_2800: blocklist insert error = ' + error); - done(); - } - - async function blocklistDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", blocklistId.toString()); - try { - var deleteCode = await DAHelper.delete(contactBlocklistUri, condition); - sleep(1000); - console.info("logMessage contact_delete_test_2800: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", blocklistId.toString()); - await queryIdForDelete(map, "contact_delete_test_2800", contactBlocklistUri); - } catch (error) { - console.info('logMessage contact_delete_test_2800: delete error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contact_insert_test_2900 - * @tc.name Insert contact group - * @tc.desc Function test - */ - it("contact_insert_test_2900", 0, async function (done) { - console.info("-------logMessage contact_insert_test_2900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var groupValues = { - "group_name": "TestersThird" - }; - try { - var groupId = await DAHelper.insert(groupUri, groupValues); - sleep(1000); - console.info("logMessage contact_insert_test_2900: groupId =" + groupId); - expect(groupId > 0).assertTrue(); - await groupRawContactInsert(DAHelper); - await deleteRawContact("contact_insert_test_2900"); - await deleteAll(groupUri, "contact_insert_test_2900"); - await deleteAll(contactDataUri, "contact_insert_test_2900"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_2900: group insert error =" + error); - done(); - } - }); - - async function groupRawContactInsert(DAHelper) { - var rawContactValues = { - "display_name": "liyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_insert_test_2900: rawContactId =" + rawContactId); - expect(rawContactId > 0).assertTrue(); - await groupDataInsert(DAHelper, rawContactId); - } catch (error) { - console.info("logMessage contact_insert_test_2900: raw_contact insert error =" + error); - } - } - - async function groupDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues) - sleep(1000); - console.info("logMessage contact_insert_test_2900: contactDataId =" + contactDataId); - expect(contactDataId > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId); - map.set("raw_contact_id", rawContactId.toString()); - map.set("detail_info", groupId.toString()); - await contactsQuery(map, "contact_insert_test_2900", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_2900: contact_data insert error =" + error); - } - } - - /** - * @tc.number contact_delete_test_3000 - * @tc.name Delete contact group - * @tc.desc Function test - */ - it("contact_delete_test_3000", 0, async function (done) { - console.info("-------logMessage contact_delete_test_3000 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var groupValues = { - "group_name": "TestersFourth" - }; - try { - var groupId = await DAHelper.insert(groupUri, groupValues); - sleep(1000); - console.info("logMessage contact_delete_test_3000: groupId =" + groupId); - expect(groupId > 0).assertTrue(); - await groupAfterRawContactInsert(DAHelper); - await deleteRawContact("contact_delete_test_3000"); - await deleteAll(groupUri, "contact_delete_test_3000"); - await deleteAll(contactDataUri, "contact_delete_test_3000"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_3000: group insert error =" + error); - done(); - } - }); - - async function groupAfterRawContactInsert(DAHelper) { - var rawContactValues = { - "display_name": "liyuchen" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_delete_test_3000: rawContactId =" + rawContactId); - expect(rawContactId > 0).assertTrue(); - await deleteGroupContactDataInsert(DAHelper, rawContactId); - } catch (error) { - console.info("logMessage contact_delete_test_3000: raw_contact insert error =" + error); - } - } - - async function deleteGroupContactDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info("logMessage contact_delete_test_3000: contactDataId =" + contactDataId); - expect(contactDataId > 0).assertTrue(); - await deleteGroup(DAHelper, contactDataId); - } catch (error) { - console.info("logMessage contact_delete_test_3000: contact_data insert error =" + error); - } - } - - async function deleteGroup(DAHelper, contactDataId) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - try { - var deleteCode = await DAHelper.delete(contactDataUri, condition); - sleep(1000); - console.info("logMessage contact_delete_test_3000: deleteCode =" + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - await queryIdForDelete(map, "contact_delete_test_3000", contactDataUri); - } catch (error) { - console.info("logMessage contact_delete_test_3000: delete error =" + error); - } - } - - /** - * @tc.number contact_query_test_3100 - * @tc.name Query basic information of a single contact - * @tc.desc Function test - */ - it("contact_query_test_3100", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactQuery(DAHelper, rawContactId); - await deleteRawContact("contact_query_test_3100"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3100: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(2000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId).assertEqual(true); - console.info('logMessage contact_query_test_3100: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyu").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_3100: query error = " + error); - } - } - - /** - * @tc.number contact_query_test_3200 - * @tc.name Query basic information of multiple contacts - * @tc.desc Function test - */ - it("contact_query_test_3200", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues1 = { - "display_name": "xiaoyu" - }; - try { - var rawContactIdOne = await DAHelper.insert(rawContactUri, rawContactValues1); - sleep(1000); - console.info("logMessage contact_query_test_3200: rawContactId = " + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3200: raw_contact_1 insert error = " + error); - done(); - } - - var rawContactValues2 = { - "display_name": "xiaohong" - }; - try { - var rawContactIdTwo = await DAHelper.insert(rawContactUri, rawContactValues2); - sleep(1000); - console.info("logMessage contact_query_test_3200: rawContactId = " + rawContactIdTwo); - expect(rawContactIdTwo > 0).assertTrue(); - await queryTwoRaw(DAHelper, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contact_query_test_3200"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3200: raw_contact_2 insert error = " + error); - done(); - } - }); - - async function queryTwoRaw(DAHelper, rawContactIdOne, rawContactIdTwo) { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - console.info('logMessage contact_query_test_3200: goToFirstRow' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow()).assertEqual(true); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage contact_query_test_3200: columnNames :" + resultSet.columnNames); - console.info("logMessage contact_query_test_3200: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_query_test_3200: id = ' + resultSet.getString(0)); - console.info('logMessage contact_query_test_3200: displayName = ' + resultSet.getString(1)); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_query_test_3200: query error' + error); - } - } - - /** - * @tc.number contact_query_test_3300 - * @tc.name Query basic information of all contacts - * @tc.desc Function test - */ - it("contact_query_test_3300", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3300 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues1 = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues1); - sleep(1000); - console.info("logMessage contact_query_test_3300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3300: raw_contact_1 insert error = " + error); - done(); - } - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_query_test_3300: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyu").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - await deleteRawContact("contact_query_test_3300"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3300: query error = " + error); - done(); - } - }); - - /** - * @tc.number contact_query_test_3400 - * @tc.name Query all information of a single contact - * @tc.desc Function test - */ - it("contact_query_test_3400", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3400 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyuzhou", - "company": "TT", - "position": "Testers", - "favorite": 1, - "phonetic_name": "xiaoyu||xy" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryAllInformation(DAHelper, rawContactId); - await deleteRawContact("contact_query_test_3400"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3400: raw_contact insert error = " + error); - done(); - } - }); - - async function queryAllInformation(DAHelper, rawContactId) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("id")); - console.info('logMessage contact_query_test_3400: id = ' + id); - expect(id == rawContactId).assertEqual(true); - var favorite = resultSet.getString(resultSet.getColumnIndex("favorite")); - console.info('logMessage contact_query_test_3400: favorite = ' + favorite); - expect(favorite == "1").assertEqual(true); - var phoneticName = resultSet.getString(resultSet.getColumnIndex("phonetic_name")); - console.info('logMessage contact_query_test_3400: phoneticName = ' + phonetic_name); - expect(phoneticName == "xiaoyu||xy").assertEqual(true); - var company = resultSet.getString(resultSet.getColumnIndex("company")); - console.info('logMessage contact_query_test_3400: company = ' + company); - expect(company == "TT").assertEqual(true); - var displayName = resultSet.getString(resultSet.getColumnIndex("display_name")); - console.info('logMessage contact_query_test_3400: displayName = ' + displayName); - expect(displayName == "xiaoyuzhou").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_query_test_3400: query error = ' + error); - } - } - - /** - * @tc.number contact_query_test_3500 - * @tc.name Query group member ability - * @tc.desc Function test - */ - it("contact_query_test_3500", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3500: raw_contact insert error = " + error); - done(); - } - var groupValues = { - "group_name": "BossBoard3500" - }; - try { - var groupId = await DAHelper.insert(groupUri, groupValues); - sleep(1000); - console.info("logMessage contact_query_test_3500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3500: group insert error = " + error); - done(); - } - await groupBossBoardInsert(DAHelper, rawContactId, groupId); - await deleteRawContact("contact_query_test_3500"); - await deleteAll(groupUri, "contact_query_test_3500"); - await deleteAll(contactDataUri, "contact_query_test_3500"); - done(); - }); - - async function groupBossBoardInsert(DAHelper, rawContactId, groupId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_test_3500: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - await groupBossBoardQuery(DAHelper, rawContactId, groupId); - } catch (error) { - console.info("logMessage contact_query_test_3500: query error = " + error); - } - } - - async function groupBossBoardQuery(DAHelper, rawContactId, groupId) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 9 data is group - condition.equalTo("type_id", "9"); - condition.and(); - condition.equalTo("detail_info", groupId.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3500: raw_contact_id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId).assertEqual(true); - console.info('logMessage contact_query_test_3500: detail_info = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == groupId.toString()).assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_3500: query error :" + error); - } - } - - /** - * @tc.number contact_query_test_3600 - * @tc.name Query favorite contacts - * @tc.desc Function test - */ - it("contact_query_test_3600", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou", "favorite": 1 - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryFavorite(); - await deleteRawContact("contact_query_test_3600"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3600: raw_contact insert error = " + error); - done(); - } - - async function queryFavorite() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("favorite", "1"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3600: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_3600: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyuzhou").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_3600: query error :" + error); - done(); - } - } - }); - - /** - * @tc.number contact_query_test_3700 - * @tc.name Query recent contact ability - * @tc.desc Function test - */ - it("contact_query_test_3700", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3700 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou", "lastest_contacted_time": 60 - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryContacted(); - await deleteRawContact("contact_query_test_3700"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3700: raw_contact insert error = " + error); - done(); - } - - async function queryContacted() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.lessThan("lastest_contacted_time", "100"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3700: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_3700: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyuzhou").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_query_test_3700: query error' + error); - done(); - } - } - }); - - /** - * @tc.number contact_query_test_3800 - * @tc.name Query recently deleted contacts - * @tc.desc Function test - */ - it("contact_query_test_3800", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3800 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaocai" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactDelete(DAHelper, rawContactId); - await deletedRawContactQuery(DAHelper, rawContactId); - await deleteAll(deletedUri, "contact_query_test_3800") - done(); - } catch (error) { - console.info("logMessage contact_query_test_3800: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition1); - sleep(1000); - console.info('logMessage contact_query_test_3800: deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3800: raw_contact delete error = " + error); - done(); - } - } - - async function deletedRawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "display_name", "is_deleted"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info('logMessage contact_query_test_3800: id = ' + resultSet.getString(0)); - console.info('logMessage contact_query_test_3800: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_3800: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaocai").assertTrue(); - console.info('logMessage contact_query_test_3800: is_deleted = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == "1").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_3800: query error :" + error); - done(); - } - } - - /** - * @tc.number contact_query_test_3900 - * @tc.name Query all mobile phone numbers - * @tc.desc Function test - */ - it("contact_query_test_3900", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3900 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaocai" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryPhoneInsert(); - await phoneQuery(rawContactId); - await deleteRawContact("contact_query_test_3900"); - await deleteAll(contactDataUri, "contact_query_test_3900"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3900: raw_contact insert error = " + error); - done(); - } - }); - - async function queryPhoneInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "1853696321" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_test_3900: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3900: contact_data insert error = " + error); - } - } - - async function phoneQuery(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 5 data is phone - condition.equalTo("content_type", "phone"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3900: raw_contact_id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_3900: detail_info = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "1853696321").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_query_test_3900: query error' + error); - } - } - - /** - * @tc.number contact_query_test_4000 - * @tc.name Query all mailbox capabilities - * @tc.desc Function test - */ - it("contact_query_test_4000", 0, async function (done) { - console.info("-----------logMessage contact_query_test_4000 is starting!------------"); - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_4000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryEmailInsert(DAHelper, rawContactId); - await emailQuery(DAHelper, contactDataId, rawContactId); - await deleteRawContact("contact_query_test_4000"); - await deleteAll(contactDataUri, "contact_query_test_4000"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_4000: raw_contact insert error = " + error); - done(); - } - }); - - async function queryEmailInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "16658@163.com" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_test_4000: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_4000: contact_data insert error = " + error); - } - } - - async function emailQuery(DAHelper, contactDataId, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data content_type is email - condition.equalTo("type_id", "1").limitAs(3).orderByDesc("id"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_4000: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contact_query_test_4000: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_4000: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "16658@163.com").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_4000: query error :" + error); - } - } - - /** - * @tc.number contact_query_test_4100 - * @tc.name Query data information of a single contact - * @tc.desc Function test - */ - it("contact_query_test_4100", 0, async function (done) { - console.info("-----------logMessage contact_query_test_4100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_4100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryTwoDataInsert(DAHelper, rawContactId); - await queryTwoDataInsertCompany(DAHelper, rawContactId); - await queryTwo(DAHelper, rawContactId); - await deleteRawContact("contact_query_test_4100"); - await deleteAll(contactDataUri, "contact_query_test_4100"); - del - done(); - } catch (error) { - console.info("logMessage contact_query_test_4100: raw_contact insert error = " + error); - done(); - } - }); - - async function queryTwoDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "xiaoyu" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_test_4100: contactDataId = " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_4100: contact_data name insert error = " + error); - } - } - - async function queryTwoDataInsertCompany(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "OOOO", - "position": "Testers" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues); - console.info("logMessage contact_query_test_4100: contactDataId = " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_4100: contact_data company insert error = " + error); - } - } - - async function queryTwo(DAHelper, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "detail_info", "position"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - var array = [{ - detail_info: "xiaoyu", position: "" - }, { - detail_info: "OOOO", position: "Testers" - }]; - var i = 0; - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage contact_query_test_4100: columnNames :" + resultSet.columnNames); - console.info("logMessage contact_query_test_4100: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_query_test_4100: id = ' + resultSet.getString(0)); - console.info('logMessage contact_query_test_4100: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_query_test_4100: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == array[i].detail_info).assertEqual(true); - console.info('logMessage contact_query_test_4100: position = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == array[i].position).assertEqual(true); - i++; - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_4100: query error :" + error); - } - } - - /** - * @tc.number contact_delete_test_4400 - * @tc.name Delete the basic raw data of the contact and record the deleted basic raw data - * @tc.desc Function test - */ - it("contact_delete_test_4400", 0, async function (done) { - console.info("-------logMessage contact_delete_test_4400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contact_delete_test_4400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await deleteRaw(DAHelper, rawContactId); - await queryDelete(DAHelper, rawContactId); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_4400: raw_contact insert error :" + error); - done(); - } - }); - - async function deleteRaw(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition1); - sleep(1000); - console.info("logMessage contact_delete_test_4400: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_delete_test_4400: delete error = " + error); - } - } - - async function queryDelete(DAHelper, rawContactId) { - var resultColumns = ["id", "delete_time", "display_name"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info("logMessage contact_delete_test_4400: columnNames:" + resultSet.columnNames); - console.info("logMessage contact_delete_test_4400: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_delete_test_4400: id = ' + resultSet.getString(0)); - console.info('logMessage contact_delete_test_4400: delete_time = ' + resultSet.getString(1)); - console.info('logMessage contact_delete_test_4400: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaoming").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_delete_test_4400: query error:" + error); - } - } - - /** - * @tc.number contact_delete_test_4700 - * @tc.name Delete detailed contact data and record detailed data - * @tc.desc Function test - */ - it("contact_delete_test_4700", 0, async function (done) { - console.info("-------logMessage contact_delete_test_4700 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaozhang", "company": "OOOO", "position": "TestManager" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contact_delete_test_4700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryDeleteCompanyData(DAHelper, rawContactId); - await rawContactDelete(DAHelper, rawContactId); - await companyRawContactDeleteQuery(DAHelper, rawContactId); - await deleteAll(contactDataUri, "contact_delete_test_4700"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_4700: raw_contact insert error:" + error); - done(); - } - }); - - async function queryDeleteCompanyData(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "OOOO", - "position": "TestManager" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_delete_test_4700: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_delete_test_4700: contact_data insert error:" + error); - } - } - - async function rawContactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition1); - sleep(1000); - console.info("logMessage contact_delete_test_4700: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_delete_test_4700: delete error = " + error); - done(); - } - } - - async function companyRawContactDeleteQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name", "backup_data"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info("logMessage contact_delete_test_4700: columnNames:" + resultSet.columnNames); - console.info("logMessage contact_delete_test_4700: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_delete_test_4700: id = ' + resultSet.getString(0)); - console.info('logMessage contact_delete_test_4700: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaozhang").assertEqual(true); - console.info('logMessage contact_delete_test_4700: backup_data = ' + resultSet.getString(2)); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_delete_test_4700: query error:" + error); - } - } - - /** - * @tc.number contact_delete_test_4800 - * @tc.name Delete and record basic data of a single contact - * @tc.desc Function test - */ - it("contact_delete_test_4800", 0, async function (done) { - console.info("-------logMessage contact_delete_test_4800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaopeng" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contact_delete_test_4800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDelete(DAHelper, rawContactId); - await deletedRawContactQuery(DAHelper, rawContactId) - await deleteAll(contactDataUri, "contact_delete_test_4800"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_4800: raw_contact insert error:" + error); - done(); - } - }); - - async function contactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("name_raw_contact_id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(contactUri, condition1); - sleep(1000); - console.info("logMessage contact_delete_test_4800: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_delete_test_4800: delete error = " + error); - } - } - - async function deletedRawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "delete_time", "display_name"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition2); - sleep(1000) - if (resultSet.goToFirstRow()) { - console.info("logMessage contact_delete_test_4800: columnNames:" + resultSet.columnNames); - console.info("logMessage contact_delete_test_4800: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_delete_test_4800: id = ' + resultSet.getString(0)); - console.info('logMessage contact_delete_test_4800: delete_time = ' + resultSet.getString(1)); - console.info('logMessage contact_delete_test_4800: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaopeng").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_delete_test_4800: query error:" + error); - } - } - - /** - * @tc.number contact_batchinsert_test_4900 - * @tc.name Insert contacts in batches(raw_contact) - * @tc.desc Function test - */ - it("contact_batchinsert_test_4900", 0, async function (done) { - console.info("--------logMessage contact_batchinsert_test_4900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, common.getContactBatchCompany()); - sleep(1000); - console.info("logMessage contact_batchinsert_test_4900: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("company", "TT4900"); - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - console.info( - 'contact_batchinsert_test_4900 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 5).assertEqual(true); - resultSet.close(); - await deleteRawContact("contact_batchinsert_test_4900"); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_4900: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_batchinsert_test_5000 - * @tc.name Insert contact_data in batches of address book - * @tc.desc Function test - */ - it("contact_batchinsert_test_5000", 0, async function (done) { - console.info("--------logMessage contact_batchinsert_test_5000 start!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaozhi" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataBatchInsert(rawContactId); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5000: raw_contact insert error = " + error); - done(); - } - async function contactDataBatchInsert(rawContactId) { - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, common.getContactBatchCompanyTwo()); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5000: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var map = new Map(); - map.set("raw_contact_id", rawContactId.toString()); - await queryBatch(map, "contact_batchinsert_test_5000", 5); - await deleteRawContact("contact_batchinsert_test_5000"); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5000: batchInsert error = " + error); - done(); - } - } - }); - - /** - * @tc.number contact_batchinsert_test_5400 - * @tc.name Batch operation of contact black list - * @tc.desc Function test - */ - it("contact_batchinsert_test_5400", 0, async function (done) { - console.info("--------logMessage contact_batchinsert_test_5400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.batchInsert(contactBlocklistUri, common.getPhoneNumberBatch()); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5400: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await query(5); - await blocklistDelete(); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5400: batchInsert error = " + error); - done(); - } - - async function blocklistDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "85525040585400"); - try { - var deleteCode = await DAHelper.delete(contactBlocklistUri, condition); - console.info("logMessage contact_batchinsert_test_5400: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - await query(0); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5400: delete error = " + error); - done(); - } - } - - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "85525040585400"); - try { - var resultSet = await DAHelper.query(contactBlocklistUri, resultColumns, condition); - sleep(1000); - console.info( - 'contact_batchinsert_test_5400 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contact_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - }); - - /** - * @tc.number contact_update_test_5300 - * @tc.name Bulk favorites and unfavorites of contacts - * @tc.desc Function test - */ - it("contact_update_test_5300", 0, async function (done) { - console.info("--------logMessage contact_update_test_5300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValuesOne = { - "display_name": "fengyuan", "favorite": 1 - }; - var rawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactValuesThree = { - "display_name": "xiaoma", "favorite": 1 - }; - var listAddBluk = [] - listAddBluk[0] = rawContactValuesOne; - listAddBluk[1] = rawContactValuesTwo; - listAddBluk[2] = rawContactValuesThree; - try { - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_update_test_5300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await rawContactUpdateUnFavorites(DAHelper); - await queryUnFavorites(DAHelper); - await deleteRawContact("contact_update_test_5300"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_5300: batchInsert error = " + error); - done(); - } - }); - - async function rawContactUpdateUnFavorites(DAHelper) { - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("display_name", "fengyuan"); - condition.or(); - condition.equalTo("display_name", "xiaoma"); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_update_test_5300: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_update_test_5300: update error = " + error); - } - } - - async function queryUnFavorites(DAHelper) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("display_name", "fengyuan"); - condition.or(); - condition.equalTo("display_name", "xiaoma"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - console.info('contact_update_test_5300 : queryBatch start ! resultSet.rowCount = ' - + resultSet.rowCount); - expect(resultSet.rowCount == 2).assertEqual(true); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var dbresult = resultSet.getString(resultSet.getColumnIndex("favorite")); - console.info(' contact_update_test_5300 :logMessage contactsQuery dbresult :' + dbresult + - ' value : ' + value); - expect(dbresult == "0").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(" contact_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - - /** - * @tc.number contact_batchinsert_test_5500 - * @tc.name Contacts are added to and removed from groups in batches - * @tc.desc Function test - */ - it("contact_batchinsert_test_5500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var groupValues = { - "group_name": "ManagerGroup" - }; - try { - var groupId = await DAHelper.insert(groupUri, groupValues); - console.info("logMessage contact_batchinsert_test_5500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: group insert error = " + error); - done(); - } - try { - var rawContactValues1 = { - "display_name": "xiaohuang" - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, rawContactValues1); - console.info("logMessage contact_batchinsert_test_5500: rawContactIdOne = " + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: raw_contact_1 insert error = " + error); - done(); - } - try { - var rawContactValues2 = { - "display_name": "xiaolv" - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, rawContactValues2); - console.info("logMessage contact_batchinsert_test_5500: rawContactIdTwo = " + rawContactIdTwo); - expect(rawContactIdTwo > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: raw_contact_2 insert error = " + error); - done(); - } - try { - var rawContactValues3 = { - "display_name": "xiaobai" - }; - var rawContactIdThird = await DAHelper.insert(rawContactUri, rawContactValues3); - console.info("logMessage contact_batchinsert_test_5500: rawContactIdThird = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: raw_contact_3 insert error = " + error); - done(); - } - await threeDataInsert(DAHelper, rawContactIdOne, rawContactIdTwo, rawContactIdThird, groupId); - await deleteRawContact("contact_batchinsert_test_5500"); - await deleteAll(groupUri, "contact_batchinsert_test_5500"); - await deleteAll(contactDataUri, "contact_batchinsert_test_5500"); - done(); - }); - - async function threeDataInsert(DAHelper, rawContactIdOne, rawContactIdTwo, rawContactIdThird, groupId) { - var contactDataValues1 = { - "raw_contact_id": rawContactIdOne, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var contactDataValues2 = { - "raw_contact_id": rawContactIdTwo, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var contactDataValues3 = { - "raw_contact_id": rawContactIdThird, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValues1; - listAddBluk[1] = contactDataValues2; - listAddBluk[2] = contactDataValues3; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await contactDataDelete(DAHelper, rawContactIdOne, rawContactIdThird); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: batchInsert error = " + error); - } - } - - async function contactDataDelete(DAHelper, rawContactIdOne, rawContactIdThird) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdThird.toString()); - try { - var deleteCode = await DAHelper.delete(contactDataUri, condition); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5500: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - await queryTwoData(DAHelper, rawContactIdOne, rawContactIdThird); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: delete error = " + error); - } - } - - async function queryTwoData(DAHelper, rawContactIdOne, rawContactIdThird) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdThird.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - console.info( - 'contact_batchinsert_test_5500 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contact_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - - /** - * @tc.number contact_pinyin_query_test_200 - * @tc.name Contact name to pinyin (Chinese Simplified) - * @tc.desc Function test - */ - it("contact_pinyin_query_test_200", 0, async function (done) { - console.info("--------logMessage contact_pinyin_query_test_200 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "小黄" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info('logMessage contact_pinyin_query_test_200 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contact_pinyin_query_test_100"); - await deleteAll(contactDataUri, "contact_pinyin_query_test_100"); - done(); - } catch (error) { - console.info("logMessage contact_pinyin_query_test_200: raw_contact insert error = " + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaohuang" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_pinyin_query_test_200 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchQuery(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_200 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - var map = common.getSearchMap(); - map.set("raw_contact_id", rawContactId.toString()); - if (resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ':contact_pinyin_query_test_200 key = ' + key + ' dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_200 query error = ' + error); - } - } - - /** - * @tc.number contact_pinyin_query_test_100 - * @tc.name Contact name to pinyin (Chinese Traditional) - * @tc.desc Function test - */ - it("contact_pinyin_query_test_100", 0, async function (done) { - console.info("--------logMessage contact_pinyin_query_test_100 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "鍵盤" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_pinyin_query_test_100 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contact_pinyin_query_test_100"); - await deleteAll(contactDataUri, "contact_pinyin_query_test_100"); - done(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_100 raw_contact insert error = ' + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "鍵盤" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_pinyin_query_test_100 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchContactQueryChinese(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_100 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchContactQueryChinese(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_pinyin_query_test_100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_pinyin_query_test_100: search_name = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "鍵盤||jianpan||jp").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_100 query error = ' + error); - } - } - - /** - * @tc.number contact_pinyin_query_test_300 - * @tc.name Contact name to pinyin (English) - * @tc.desc Function test - */ - it("contact_pinyin_query_test_300", 0, async function (done) { - console.info("--------logMessage contact_pinyin_query_test_300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "Tom" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_pinyin_query_test_300 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contact_pinyin_query_test_300"); - done(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_300 raw_contact insert error = ' + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "Tom" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_pinyin_query_test_300 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchContactQuery(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_300 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchContactQuery(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_pinyin_query_test_300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_pinyin_query_test_300: search_name = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "Tom||Tom||Tom").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_300 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_400 - * @tc.name Contact fuzzy search query interface (name) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_400", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "400xiaoming400" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_400 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactNameQuery(); - await deleteRawContact("contact_fuzzyquery_test_400"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_400 raw_contact insert error = ' + error); - done(); - } - - async function rawContactNameQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("display_name", "%xiaoming40%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_400: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contact_fuzzyquery_test_400: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "400xiaoming400").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_400 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contact_fuzzyquery_test_500 - * @tc.name Contact fuzzy search query interface (name pinyin, pinyin name) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_500", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_500 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var rawContactValues = { - "display_name": "500xiaoming500", "phonetic_name": "500xiaoming500||xm" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_500 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactPhoneticNameQuery(); - await deleteRawContact("contact_fuzzyquery_test_500"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_500 raw_contact insert error = ' + error); - done(); - } - - async function rawContactPhoneticNameQuery() { - var resultColumns = ["id", "display_name", "phonetic_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phonetic_name", "%xiaoming%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - condition.or(); - condition.like("phonetic_name", "%xm%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_500: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contact_fuzzyquery_test_500: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "500xiaoming500").assertTrue(); - console.info( - 'logMessage contact_fuzzyquery_test_500: phoneticName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "500xiaoming500||xm").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_500 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contact_fuzzyquery_test_600 - * @tc.name Contact fuzzy search query interface (company, position) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_600", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_600 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming", "company": "TT600", "position": "Testers600" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_600 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactCompanyQuery(DAHelper, rawContactId); - await deleteRawContact("contact_fuzzyquery_test_600"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_600 raw_contact insert error = ' + error); - done(); - } - }); - - async function rawContactCompanyQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name", "company", "position"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("company", "%TT6%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - condition.or(); - condition.like("position", "%Testers6%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_600: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_600: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoming").assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_600: company = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "TT600").assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_600: position = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == "Testers600").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_600 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_700 - * @tc.name Contact fuzzy search query interface (mobile phone number) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_700", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_700 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_700 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataPhoneInsert(); - await deleteRawContact("contact_fuzzyquery_test_700"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_700"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_700 raw_contact insert error = ' + error); - done(); - } - - async function contactDataPhoneInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "14528963" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_700 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryPhone(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_700 contact_data insert error = ' + contactDataId); - done(); - } - } - }); - - async function fuzzyQueryPhone(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 5 data is phone - condition.like("detail_info", "%52896%"); - condition.and(); - condition.equalTo("type_id", "5"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_700: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_700: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_700: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "14528963").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_700 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_800 - * @tc.name Contact fuzzy search query interface (nickname) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_800", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_800 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactNickNameInsert(); - await deleteRawContact("contact_fuzzyquery_test_800"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_800"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_800 raw_contact insert error = ' + error); - done(); - } - - async function contactNickNameInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "daming" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_fuzzyquery_test_800 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryPhoneNickName(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_800 contact_data insert error = ' + contactDataId); - done(); - } - } - }); - - async function fuzzyQueryPhoneNickName(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 3 data is nickname - condition.like("detail_info", "%daming%"); - condition.and(); - condition.equalTo("type_id", "3"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_800: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_800: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_800: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "daming").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_800 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_900 - * @tc.name Contact fuzzy search query interface (mailbox) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_900", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_900 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataEmailInsert(); - await deleteRawContact("contact_fuzzyquery_test_900"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_900"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_900 raw_contact insert error = ' + error); - done(); - } - - async function contactDataEmailInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "1564@163.com" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_fuzzyquery_test_900 ; = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryEmail(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_900 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryEmail(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data is email - condition.like("detail_info", "%1564%"); - condition.and(); - condition.equalTo("type_id", "1"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_900: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_900: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_900: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "1564@163.com").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_900 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_1000 - * @tc.name Contact fuzzy search query interface (residential) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_1000", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_1000 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_1000 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataPostalInsert(); - await deleteRawContact("contact_fuzzyquery_test_1000"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_1000"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1000 raw_contact insert error = ' + error); - done(); - } - - async function contactDataPostalInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "nanjing1000" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_1000 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryAddress(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1000 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryAddress(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data is postal_address - condition.like("detail_info", "%nanjing10%"); - condition.and(); - condition.equalTo("type_id", "7"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_1000: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_1000: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_1000: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "nanjing1000").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1000: query error' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_1100 - * @tc.name Contact fuzzy search query interface (remarks) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_1100", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_1100 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_1100 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataNoteInsert(); - await deleteRawContact("contact_fuzzyquery_test_1100"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_1100"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1100 raw_contact insert error = ' + error); - done(); - } - - async function contactDataNoteInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "note", - "detail_info": "java1100" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_1100 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryNote(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1100 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryNote(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 10 data is note - condition.like("detail_info", "%java11%"); - condition.and(); - condition.equalTo("type_id", "10"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_1100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_1100: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_1100: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "java1100").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1100: query error' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_1200 - * @tc.name Contact fuzzy search query interface (AIM) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_1200", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_1200 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info('logMessage contact_fuzzyquery_test_1200 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("contact_fuzzyquery_test_1200"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_1200"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1200 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "im", - "detail_info": "aaaa1200" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_fuzzyquery_test_1200 ; = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryIM(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1200 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryIM(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 10 data is im account number - condition.like("detail_info", "%aa12%"); - condition.and(); - condition.equalTo("type_id", "2"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_1200: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_1200: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_1200: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "aaaa1200").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1200: query error' + error); - } - } - - /** - * @tc.number abnormal_contact_insert_test_200 - * @tc.name Abnormal use case, an incorrect field is passed in when inserting - * @tc.desc Function test - */ - it("abnormal_contact_insert_test_200", 0, async function (done) { - console.info("------------abnormal_contact_insert_test_200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_names": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insert_test_200: rawContactId = " + rawContactId); - expect(rawContactId).assertEqual(-1); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_test_200: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_insert_test_300 - * @tc.name Abnormal use case, an incorrect table name is passed in when inserting - * @tc.desc Function test - */ - it("abnormal_contact_insert_test_300", 0, async function (done) { - console.info("------------abnormal_contact_insert_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(errorUri, rawContactValues); - console.info("logMessage abnormal_contact_insert_test_300: rawContactId = " + rawContactId); - expect(rawContactId == -1).assertTrue(); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_test_300: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_update_test_1100 - * @tc.name Abnormal use case, an incorrect field is passed in when updating - * @tc.desc Function test - */ - it("abnormal_contact_update_test_1100", 0, async function (done) { - console.info("------------abnormal_contact_update_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_update_test_1100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalUpdate(); - await deleteRawContact("abnormal_contact_update_test_1100"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_update_test_1100: raw_contact insert error' + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "display_names": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var updataCode = await DAHelper.update(rawContactUri, updateValues, condition) - console.info("logMessage abnormal_contact_update_test_1100: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contact_update_test_1100", rawContactUri); - } catch (error) { - console.info('logMessage abnormal_contact_update_test_1100: update error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_update_test_1000 - * @tc.name Abnormal use case, an incorrect table name is passed in when updating - * @tc.desc Function test - */ - it("abnormal_contact_update_test_1000", 0, async function (done) { - console.info("------------abnormal_contact_update_test_1000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_update_test_1000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalUpdate(); - await deleteRawContact("abnormal_contact_update_test_1000"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_update_test_1000: raw_contact insert error' + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "display_name": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updataCode = await DAHelper.update(errorUri, updateValues, condition); - console.info("logMessage abnormal_contact_update_test_1000: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contact_update_test_1000", rawContactUri); - } catch (error) { - console.info("logMessage abnormal_contact_update_test_1000: updata error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_delete_test_4500 - * @tc.name Abnormal use case, an incorrect field is passed in when deleting - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_4500", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_4500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaozhi" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_4500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalDelete(); - await deleteRawContact("abnormal_contact_delete_test_4500"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_4500: raw_contact insert error' + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition); - console.info("logMessage abnormal_contact_delete_test_4500: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaozhi"); - await contactsQuery(map, "abnormal_contact_delete_test_4500", rawContactUri); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_4500: delete error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_delete_test_4600 - * @tc.name Abnormal use case, an incorrect table name is passed in when deleting - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_4600", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_4600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_4600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalDelete(); - await deleteRawContact("abnormal_contact_delete_test_4600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_4600: raw_contact insert error' + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info("logMessage abnormal_contact_delete_test_4600: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contact_delete_test_4600", rawContactUri); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_4600: delete error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_4200 - * @tc.name Abnormal use case, an incorrect field is passed in when querying - * @tc.desc Function test - */ - it("abnormal_contact_query_test_4200", 0, async function (done) { - console.info("------------abnormal_contact_query_test_4200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaozhicheng" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_4200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_4200"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_4200: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_4200: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_4200: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_batchinsert_test_5100 - * @tc.name Abnormal use cases, when adding data in batches, some of them failed, check the processing logic - * @tc.desc Function test - */ - it("abnormal_contact_batchinsert_test_5100", 0, async function (done) { - console.info("--------logMessage abnormal_contact_batchinsert_test_5100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "display_name": "zhangsan" - }; - var addBulkValue2 = { - "display_names": "lisi" - }; - var addBulkValue3 = { - "display_name": "wangwu" - }; - var addBulkValue4 = { - "display_names": "laoliu" - }; - var addBulkValue5 = { - "display_name": "xiaozhang" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - console.info("logMessage abnormal_contact_batchinsert_test_5100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_batchinsert_test_5100: batch insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_insert_data_5300 - * @tc.name insert_data error no rawContactId - * @tc.desc Function test - */ - it("abnormal_contact_insert_data_5300", 0, async function (done) { - console.info("--------logMessage abnormal_contact_insert_data_5300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaotian" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage abnormal_contact_insert_data_5300 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("abnormal_contact_insert_data_5300"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_data_5300 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "content_type": "im", "detail_info": "aaaa" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage abnormal_contact_insert_data_5300 ; = ' + contactDataId); - expect(contactDataId == -1).assertTrue(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_data_5300 contact_data insert error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_insert_data_5400 - * @tc.name insert_data error no content_type - * @tc.desc Function test - */ - it("abnormal_contact_insert_data_5400", 0, async function (done) { - console.info("--------logMessage abnormal_contact_insert_data_5400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaotian" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info('logMessage abnormal_contact_insert_data_5400 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("abnormal_contact_insert_data_5400"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_data_5400 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "detail_info": "aaaa" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage abnormal_contact_insert_data_5400 ; = ' + contactDataId); - expect(contactDataId == -1).assertTrue(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_data_5400 contact_data insert error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contact_delete_test_5500 - * @tc.name batchDelete - * @tc.desc Function test - */ - it("contact_delete_test_5500", 0, async function (done) { - console.info("--------logMessage contact_delete_test_5500 is starting!------------"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - console.info("logMessage contact_delete_test_5500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_delete_test_5500", rawContactUri); - await executeBatch(); - } catch (error) { - console.info("logMessage contact_delete_test_5500: insert error = " + error); - done(); - } - async function executeBatch() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - DAHelper.executeBatch(URI_CONTACTS, [{ - uri: rawContactUri, - type: featureAbility.DataAbilityOperationType.TYPE_DELETE, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage contact_delete_test_5500: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage contact_delete_test_5500: data_3 = " + data); - console.info("logMessage contact_delete_test_5500: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number contact_update_test_5600 - * @tc.name batchUpdate - * @tc.desc Function test - */ - it("contact_update_test_5600", 0, async function (done) { - console.info("--------logMessage contact_update_test_5600 is starting!------------"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - console.info("logMessage contact_update_test_5600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_update_test_5600", rawContactUri); - await executeBatch(); - } catch (error) { - console.info("logMessage contact_update_test_5600: insert error = " + error); - done(); - } - - async function executeBatch() { - var updateValues = { - "display_name": "xiaoxiaoxiao" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - DAHelper.executeBatch(URI_CONTACTS, [{ - uri: rawContactUri, - type: featureAbility.DataAbilityOperationType.TYPE_UPDATE, - valuesBucket: updateValues, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage contact_update_test_5600: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage contact_update_test_5600: data_3 = " + data); - console.info("logMessage contact_update_test_5600: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number contact_insert_test_5700 - * @tc.name Insert Multiple raw_contact essential information - * @tc.desc Function test - */ - it("contact_insert_test_5700", 0, async function (done) { - console.info("------logMessage contact_insert_test_5700 is starting!-----"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_insert_test_5700: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_insert_test_5700", rawContactUri); - var rawContactIdOne = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_insert_test_5700: rawContactIdOne = ' + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactIdOne.toString()); - await contactsQuery(map, "contact_insert_test_5700", rawContactUri); - var rawContactIdTwo = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_insert_test_5700: rawContactIdTwo = ' + rawContactIdTwo); - expect(rawContactIdTwo > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactIdTwo.toString()); - await contactsQuery(map, "contact_insert_test_5700", rawContactUri); - await deleteRawContact("contact_insert_test_5700"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_5700: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_insert_test_5800 - * @tc.name Add 20000 bytes of basic contact information and verify whether the text insertion is successful - * @tc.desc Function test - */ - it("contact_insert_test_5800", 0, async function (done) { - console.info("------logMessage contact_insert_test_5800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var name; - for (var i = 0; i < 20000; i++) { - name += "i"; - } - var contcatvalues = { - "display_name": name - } - try { - var rawContactId = await DAHelper.insert(rawContactUri, contcatvalues); - sleep(1000); - console.info('logMessage contact_insert_test_5800: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", name); - await contactsQuery(map, "contact_insert_test_5800", rawContactUri); - await deleteRawContact("contact_insert_test_5800"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_5800: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_insert_test_5900 - * @tc.name Add multiple contact details and verify that the insertion was successful - * @tc.desc Function test - */ - it("contact_insert_test_5900", 0, async function (done) { - console.info("------logMessage contact_insert_test_5900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var contcatvalues = { - "display_name": "xiao5900" - } - try { - var rawContactId = await DAHelper.insert(rawContactUri, contcatvalues); - console.info('logMessage contact_insert_test_5900: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "19960229" - }; - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info('logMessage contact_insert_test_5900: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "19960229"); - await contactsQuery(map, "contact_insert_test_5900", contactDataUri); - - var rawContactIdOne = await DAHelper.insert(rawContactUri, contcatvalues); - console.info('logMessage contact_insert_test_5900: rawContactId = ' + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - var contactDataValues2 = { - "raw_contact_id": rawContactIdOne, - "content_type": "phone", - "detail_info": "111111032" - }; - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info('logMessage contact_insert_test_5900: contactDataId = ' + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "111111032"); - await contactsQuery(map, "contact_insert_test_5900", contactDataUri); - - await deleteRawContact("contact_insert_test_5900"); - await deleteAll(contactDataUri, "contact_insert_test_5900"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_5900: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_insert_test_6000 - * @tc.name Add the basic information of a single contact and verify whether the insertion is successful (name, - * Pinyin, company, position, favorite) - * @tc.desc Function test - */ - it("contact_insert_test_6000", 0, async function (done) { - console.info("------logMessage contact_insert_test_6000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "licheng", - "company": "TT", - "position": "developer", - "favorite": 1, - "phonetic_name": "licheng||lc" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_6000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "licheng"); - map.set("company", "TT"); - map.set("position", "developer"); - map.set("favorite", "1"); - map.set("phonetic_name", "licheng||lc"); - await contactsQuery(map, "contact_insert_test_6000", rawContactUri); - await deleteRawContact("contact_insert_test_6000"); - await deleteAll(contactDataUri, "contact_insert_test_6000"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_6000: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertData_test_6100 - * @tc.name To contact_data Add a full field data to the data table and verify whether the insertion is - * successful - * @tc.desc Function test - */ - it("contact_insertData_test_6100", 0, async function (done) { - console.info("------logMessage contact_insertData_test_6100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertData_test_6100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - console.info('logMessage contact_insertData_test_6100: contactDataValues["raw_contact_id"] = ' + - contactDataValues.raw_contact_id); - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_insertData_test_6100: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - var map = common.getProfileContactDataMap(); - map.set("id", contactDataId.toString()); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contact_insertData_test_6100", contactDataUri); - await deleteRawContact("contact_insertData_test_6100"); - await deleteAll(contactDataUri, "contact_insertData_test_6100"); - done(); - } catch (error) { - console.info("logMessage contact_insertData_test_6100: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_update_test_6200 - * @tc.name Modify the basic information of multiple contacts and verify whether the modification is successful - * @tc.desc Function test - */ - it("contact_update_test_6200", 0, async function (done) { - console.info("--------logMessage contact_update_test_6200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - expect(rawContactId > 0).assertTrue(); - console.info("logMessage contact_update_test_6200: rawContactId = " + rawContactId); - var insertRawContactValuesOne = { - "display_name": "xiaocai1", - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - expect(rawContactIdOne > 0).assertTrue(); - console.info("logMessage contact_update_test_6200: rawContactIdOne = " + rawContactIdOne); - var insertRawContactValuesTwo = { - "display_name": "xiaocai1", - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - expect(rawContactIdTwo > 0).assertTrue(); - console.info("logMessage contact_update_test_6200: rawContactIdTwo = " + rawContactIdTwo); - - var updateValues = { - "display_name": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - var updataCode = await DAHelper.update(rawContactUri, updateValues, condition); - console.info("logMessage contact_update_test_6200: updataCode = " + updataCode); - expect(updataCode == 0).assertTrue(); - sleep(1000); - await queryUpdateThree( - "contact_update_test_6200", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contact_update_test_6200"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_6200: insert error = " + error); - done(); - } - }); - - async function queryUpdateThree(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var name = resultSet.getString(resultSet.getColumnIndex("display_name")); - expect(name == "xiaosan").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - /** - * @tc.number contact_UpdateRawContcat_test_6300 - * @tc.name Update raw_contact The full field data of the contact table and verify whether the modification is - * successful - * @tc.desc Function test - */ - it("contact_UpdateRawContcat_test_6300", 0, async function (done) { - console.info("------logMessage contact_UpdateRawContcat_test_6300 is starting!-----"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - console.info("logMessage contact_UpdateRawContcat_test_6300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(2000); - var updateValues = common.getProfileRawContactUpdate(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var updataCode = await DAHelper.update(rawContactUri, updateValues, condition); - console.info('logMessage contact_UpdateRawContcat_test_6300: updataCode = ' + updataCode); - sleep(3000); - var map = common.getProfileRawContactUpdateMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_UpdateRawContcat_test_6300", rawContactUri); - await deleteRawContact("contact_UpdateRawContcat_test_6300"); - await deleteAll(contactDataUri, "contact_UpdateRawContcat_test_6300"); - done(); - } catch (error) { - console.info("logMessage contact_UpdateRawContcat_test_6300: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertDataUpdate_test_6400 - * @tc.name Update contact_data table, and verify whether the modification is successful - * @tc.desc Function test - */ - it("contact_insertDataUpdate_test_6400", 0, async function (done) { - console.info("------logMessage contact_insertDataUpdate_test_6400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataUpdate_test_6400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - console.info('logMessage contact_insertDataUpdate_test_6400: contactDataValues.raw_contact_id = ' + - contactDataValues.raw_contact_id); - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_insertDataUpdate_test_6400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var updateValues = common.getProfileContactDataUpdate(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - var updataCode = await DAHelper.update(contactDataUri, updateValues, condition); - console.info('logMessage contact_insertDataUpdate_test_6400: updataCode = ' + updataCode); - sleep(1000); - var map = common.getProfileContactDataUpdateMap(); - map.set("id", contactDataId.toString()); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contact_insertDataUpdate_test_6400", contactDataUri); - await deleteRawContact("contact_insertDataUpdate_test_6400"); - await deleteAll(contactDataUri, "contact_insertDataUpdate_test_6400"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataUpdate_test_6400: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertDataUpdateAll_test_6500 - * @tc.name Update all contact details and verify that the modification was successful - * @tc.desc Function test - */ - it("contact_insertDataUpdateAll_test_6500", 0, async function (done) { - console.info("------logMessage contact_insertDataUpdateAll_test_6500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataUpdateAll_test_6500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaocai", ""); - await insertData(rawContactId, "phone", "6500", ""); - await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await insertData(rawContactId, "nickname", "xxxxcai", ""); - await insertData(rawContactId, "email", "111@fox.com", ""); - await insertData(rawContactId, "postal_address", "dddd", ""); - await insertData(rawContactId, "note", "caicai", ""); - await insertData(rawContactId, "im", "999999999", ""); - await insertData(rawContactId, "contact_event", "1125", ""); - await insertData(rawContactId, "website", "wwww.xxx.com", ""); - await insertData(rawContactId, "relation", "xiaobai", ""); - await insertData(rawContactId, "group_membership", 1, ""); - await insertData(rawContactId, "contact_misc", "5678", ""); - var updateValues = { - "detail_info": "xiaocai" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - var updataCode = await DAHelper.update(contactDataUri, updateValues, condition); - console.info('logMessage contact_insertDataUpdateAll_test_6500: updataCode = ' + updataCode); - sleep(1000); - await queryUpdateAllData("contact_insertDataUpdateAll_test_6500", DAHelper, rawContactId); - await deleteRawContact("contact_insertDataUpdateAll_test_6500"); - await deleteAll(contactDataUri, "contact_insertDataUpdateAll_test_6500"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataUpdateAll_test_6500: raw_contact insert error = " + error); - done(); - } - }); - - async function queryUpdateAllData(tag, DAHelper, rawContactId) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("row_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var detail_info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - expect(detail_info == "xiaocai").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - /** - * @tc.number contact_insertFavorite_test_6600 - * @tc.name Add multiple contacts to favorites and verify that the favorites field is changed - * @tc.desc Function test - */ - it("contact_insertFavorite_test_6600", 0, async function (done) { - console.info("------logMessage contact_insertFavorite_test_6600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertFavorite_test_6600: rawContactId = " + rawContactId); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", "favorite": 1 - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - console.info("logMessage contact_insertFavorite_test_6600: rawContactId = " + rawContactIdOne); - - var insertRawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - console.info("logMessage contact_insertFavorite_test_6600: rawContactId = " + rawContactIdTwo); - - sleep(1000); - await queryThreeFavorite( - "contact_insertFavorite_test_6600", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 1); - await deleteRawContact("contact_insertFavorite_test_6600"); - done(); - } catch (error) { - console.info("logMessage contact_insertFavorite_test_6600: raw_contact insert error = " + error); - done(); - } - }); - - async function queryThreeFavorite(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, favoritevalue) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryThreeFavorite start ! DAHelper = ' + DAHelper); - var resultColumns = ["favorite"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var favorite = resultSet.getInt(resultSet.getColumnIndex("favorite")); - expect(favorite == favoritevalue).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryThreeFavorite: error = " + error); - } - } - - /** - * @tc.number contact_unFavorite_test_6700 - * @tc.name Remove favorites from multiple contacts and verify that the favorites field has changed - * @tc.desc Function test - */ - it("contact_unFavorite_test_6700", 0, async function (done) { - console.info("------logMessage contact_unFavorite_test_6700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_unFavorite_test_6700: rawContactId = " + rawContactId); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", "favorite": 1 - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - console.info("logMessage contact_unFavorite_test_6700: rawContactId = " + rawContactIdOne); - - var insertRawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - console.info("logMessage contact_unFavorite_test_6700: rawContactId = " + rawContactIdTwo); - - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - var updataCode = await DAHelper.update(rawContactUri, updateValues, condition); - console.info("logMessage contact_unFavorite_test_6700: updataCode = " + updataCode); - sleep(1000); - await queryThreeFavorite( - "contact_unFavorite_test_6700", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 0); - await deleteRawContact("contact_unFavorite_test_6700"); - done(); - } catch (error) { - console.info("logMessage contact_unFavorite_test_6700: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertContactBlocklist_test_6800 - * @tc.name Add multiple records to the black list and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contact_insertContactBlocklist_test_6800", 0, async function (done) { - console.info("--------logMessage contact_insertContactBlocklist_test_6800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_insertContactBlocklist_test_6800: insert = " + batchInsertCode); - var batchInsertCodeOne = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_insertContactBlocklist_test_6800: insert = " + batchInsertCodeOne); - var batchInsertCodeTwo = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_insertContactBlocklist_test_6800: insert = " + batchInsertCodeTwo); - sleep(1000); - expect(batchInsertCode > 0).assertTrue(); - await query(3); - await deleteAll(contactBlocklistUri, "contact_insertContactBlocklist_test_6800"); - done(); - } catch (error) { - console.info("logMessage contact_insertContactBlocklist_test_6800: insert error = " + error); - done(); - } - - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "123456789"); - try { - var resultSet = await DAHelper.query(contactBlocklistUri, resultColumns, condition); - sleep(1000); - console.info('contact_insertContactBlocklist_test_6800 :resultSet.goToFirstRow() = ' + - resultSet.goToFirstRow()); - console.info( - 'contact_insertContactBlocklist_test_6800 : query result is = ' + resultSet.rowCount == size); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contact_insertContactBlocklist_test_6800 error = " + error); - } - } - }); - - /** - * @tc.number contact_removeContactBlocklist_test_6900 - * @tc.name Delete multiple records from the black list and verify whether the deletion is successful - * @tc.desc Function test - */ - it("contact_removeContactBlocklist_test_6900", 0, async function (done) { - console.info("--------logMessage contact_removeContactBlocklist_test_6900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_removeContactBlocklist_test_6900: batchInsertCode = " + batchInsertCode); - var batchInsertCodeOne = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_removeContactBlocklist_test_6900: insert = " + batchInsertCodeOne); - var batchInsertCodeTwo = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_removeContactBlocklist_test_6900: insert = " + batchInsertCodeTwo); - sleep(1000); - expect(batchInsertCode > 0).assertTrue(); - await deleteAll(contactBlocklistUri, "contact_removeContactBlocklist_test_6900"); - await query(0); - done(); - } catch (error) { - console.info("logMessage contact_removeContactBlocklist_test_6900: batchInsert error = " + error); - done(); - } - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "123456789"); - try { - var resultSet = await DAHelper.query(contactBlocklistUri, resultColumns, condition); - console.info('contact_removeContactBlocklist_test_6900 : resultSet = ' + resultSet); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contact_removeContactBlocklist_test_6900 error = " + error); - } - } - }); - - /** - * @tc.number contact_insertGroup_test_7000 - * @tc.name Add multiple contacts to favorites and verify that the favorites field is changed - * @tc.desc Function test - */ - it("contact_insertGroup_test_7000", 0, async function (done) { - console.info("------logMessage contact_insertGroup_test_7000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertGroup_test_7000: rawContactId = " + rawContactId); - await insertData(rawContactId, "group_membership", 1, ""); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - console.info("logMessage contact_insertGroup_test_7000: rawContactId = " + rawContactIdOne); - await insertData(rawContactIdOne, "group_membership", 1, ""); - var insertRawContactValuesTwo = { - "display_name": "xiaoli", - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - console.info("logMessage contact_insertGroup_test_7000: rawContactId = " + rawContactIdTwo); - await insertData(rawContactIdTwo, "group_membership", 1, ""); - sleep(1000); - await queryThreeGroup( - "contact_insertGroup_test_7000", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 1); - await deleteRawContact("contact_insertGroup_test_7000"); - done(); - } catch (error) { - console.info("logMessage contact_insertGroup_test_7000: raw_contact insert error = " + error); - done(); - } - }); - - async function queryThreeGroup(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, groupId) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryThreeGroup start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var group = resultSet.getInt(resultSet.getColumnIndex("detail_info")); - expect(group == groupId).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryThreeGroup: error = " + error); - } - } - - /** - * @tc.number contact_insert_test_7100 - * @tc.name Add a full field data to the groups table and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contact_insert_test_7100", 0, async function (done) { - console.info("---------logMessage contact_insert_test_7100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage contact_insert_test_7100: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await contactsQuery(map, "contact_insert_test_7100", groupUri); - await deleteAll(groupUri, "contact_insert_test_7100"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_7100: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_delete_test_7200 - * @tc.name Add a full field data to the groups table and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contact_delete_test_7200", 0, async function (done) { - console.info("------logMessage contact_delete_test_7200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_delete_test_7200: rawContactId = " + rawContactId); - await insertData(rawContactId, "group_membership", 1, ""); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - console.info("logMessage contact_delete_test_7200: rawContactId = " + rawContactIdOne); - await insertData(rawContactIdOne, "group_membership", 1, ""); - var insertRawContactValuesTwo = { - "display_name": "xiaoli", - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - console.info("logMessage contact_delete_test_7200: rawContactId = " + rawContactIdTwo); - await insertData(rawContactIdTwo, "group_membership", 1, ""); - sleep(1000); - await deleteAll(contactDataUri, "contact_delete_test_7200"); - sleep(1000); - await queryZeroGroup("contact_delete_test_7200", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contact_delete_test_7200"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_7200: raw_contact insert error = " + error); - done(); - } - }); - - async function queryZeroGroup(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryZeroGroup start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - console.info(tag + ': queryZeroGroup! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryZeroGroup: error = " + error); - } - } - - /** - * @tc.number contact_delete_test_7300 - * @tc.name Delete the full field data of a groups table and verify whether the deletion is successful - * @tc.desc Function test - */ - it("contact_delete_test_7300", 0, async function (done) { - console.info("---------logMessage contact_delete_test_7300 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage contact_delete_test_7300: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await contactsQuery(map, "contact_delete_test_7300", groupUri); - await deleteAll(groupUri, "contact_delete_test_7300"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_7300: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_delete_test_7400 - * @tc.name Add a raw_contact all fields, delete raw_contact - * @tc.desc Function test - */ - it("contact_delete_test_7400", 0, async function (done) { - console.info("------logMessage contact_Delete_test_7400 is starting!-----"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_Delete_test_7400: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - map.set("version", "2"); - map.set("is_deleted", "1"); - await deleteAll(rawContactUri, "contact_Delete_test_7400"); - sleep(1000); - await contactsQuery(map, "contact_Delete_test_7400", rawContactUri); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - var code = await DAHelper.delete(deletedUri, conditionAll); - console.info('contact_Delete_test_7400 : Completely delete code = ' + code); - expect(code == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_Delete_test_7400: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_delete_test_7500 - * @tc.name Delete contact_data Single full field data in data table - * @tc.desc Function test - */ - it("contact_delete_test_7500", 0, async function (done) { - console.info("------logMessage contact_delete_test_7500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_delete_test_7500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_delete_test_7500: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await deleteAll(contactDataUri, "contact_delete_test_7500"); - var map = new Map(); - map.set("id", contactDataId.toString()); - await queryIdForDelete(map, "contact_delete_test_7500", contactDataUri); - await deleteRawContact("contact_delete_test_7500"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_7500: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertDataAll_test_7600 - * @tc.name Add all details of a single contact and verify whether the insertion is successful (name, mobile - * number, company, position, nickname, email, home, remarks, aim) - * @tc.desc Function test - */ - it("contact_insertDataAll_test_7600", 0, async function (done) { - console.info("------logMessage contact_insertDataAll_test_7600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataAll_test_7600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactdata1 = await insertData(rawContactId, "name", "xiaocai", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdata1, "xiaocai"); - var contactdata2 = await insertData(rawContactId, "phone", "6500", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdata2, "6500"); - var contactdatd3 = await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd3, "TTTTT"); - var contactdatd4 = await insertData(rawContactId, "nickname", "xxxxcai", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd4, "xxxxcai"); - var contactdatd5 = await insertData(rawContactId, "email", "111@fox.com", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd5, "111@fox.com"); - var contactdatd6 = await insertData(rawContactId, "postal_address", "dddd", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd6, "dddd"); - var contactdatd7 = await insertData(rawContactId, "note", "caicai", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd7, "caicai"); - var contactdatd8 = await insertData(rawContactId, "im", "999999999", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd8, "999999999"); - sleep(1000); - await deleteRawContact("contact_insertDataAll_test_7600"); - await deleteAll(contactDataUri, "contact_insertDataAll_test_7600"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataAll_test_7600: raw_contact insert error = " + error); - done(); - } - }); - - async function queryAlldata(tag, DAHelper, rawContactId, contactdata, values) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactdata.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("raw_contact_id")); - console.info(tag + " result raw_contact_id = " + id); - expect(id == rawContactId).assertEqual(true); - var info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - console.info(tag + " result info = " + info + " value = " + values); - expect(info == values).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - /** - * @tc.number contact_insertDataAll_test_7700 - * @tc.name Add all details of a single contact and verify whether the insertion is successful (name, mobile - * number, company, position, nickname, email, home, remarks, aim, birthday, website, assistant, group, phone ring) - * @tc.desc Function test - */ - it("contact_insertDataAll_test_7700", 0, async function (done) { - console.info("------logMessage contact_insertDataAll_test_7700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataAll_test_7700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactdata1 = await insertData(rawContactId, "name", "xiaocai", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdata1, "xiaocai"); - var contactdata2 = await insertData(rawContactId, "phone", "6500", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdata2, "6500"); - var contactdatd3 = await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd3, "TTTTT"); - var contactdatd4 = await insertData(rawContactId, "nickname", "xxxxcai", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd4, "xxxxcai"); - var contactdatd5 = await insertData(rawContactId, "email", "111@fox.com", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd5, "111@fox.com"); - var contactdatd6 = await insertData(rawContactId, "postal_address", "dddd", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd6, "dddd"); - var contactdatd7 = await insertData(rawContactId, "note", "caicai", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd7, "caicai"); - var contactdatd8 = await insertData(rawContactId, "im", "999999999", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd8, "999999999"); - var contactdatd9 = await insertData(rawContactId, "contact_event", "1125", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd9, "1125"); - var contactdatd10 = await insertData(rawContactId, "website", "wwww.xxx.com", ""); - await queryAlldata( - "contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd10, "wwww.xxx.com"); - var contactdatd11 = await insertData(rawContactId, "relation", "xiaobai", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd11, "xiaobai"); - var contactdatd12 = await insertData(rawContactId, "group_membership", 1, ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd12, 1); - var contactdatd13 = await insertData(rawContactId, "contact_misc", "5678", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd13, "5678"); - sleep(1000); - await deleteRawContact("contact_insertDataAll_test_7700"); - await deleteAll(contactDataUri, "contact_insertDataAll_test_7700"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataAll_test_7700: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertDataUpdateMore_test_7800 - * @tc.name Modify multiple contact details and verify whether the modification is successful - * @tc.desc Function test - */ - it("contact_insertDataUpdateMore_test_7800", 0, async function (done) { - console.info("------logMessage contact_insertDataUpdateMore_test_7800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xiaocai" - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataUpdateMore_test_7800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaotian", ""); - - var insertRawContactValues1 = { - "display_name": "xiaotian" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - console.info("logMessage contact_insertDataUpdateMore_test_7800: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaotian", ""); - - var updateValues = { - "detail_info": "xiaocai7800" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()) - var updataCode = await DAHelper.update(contactDataUri, updateValues, condition); - console.info('logMessage contact_insertDataUpdateMore_test_7800: updataCode = ' + updataCode); - sleep(1000); - await insertDataUpdateMoreQuery( - "contact_insertDataUpdateMore_test_7800", DAHelper, rawContactId, rawContactIdFirst); - await deleteRawContact("contact_insertDataUpdateMore_test_7800"); - await deleteAll(contactDataUri, "contact_insertDataUpdateMore_test_7800"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataUpdateMore_test_7800: raw_contact insert error = " + error); - done(); - } - }); - - async function insertDataUpdateMoreQuery(tag, DAHelper, rawContactId, rawContactIdFirst) { - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()) - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - console.info(tag + " result info = " + info); - expect(info == "xiaocai7800").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage : error = " + error); - } - } - - /** - * @tc.number contact_deleterestore_test_7900 - * @tc.name Delete contacts and restore - * @tc.desc Function test - */ - it("contact_deleterestore_test_7900", 0, async function (done) { - console.info("------logMessage contact_deleterestore_test_7900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli7900" - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_deleterestore_test_7900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(1000); - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(rawContactUri, condition1); - console.info("contact_deleterestore_test_7900 " + - ': deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - sleep(1000); - - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("id", rawContactId.toString()); - var updatevalue = { - "is_deleted": 0 - }; - var updateCode = await DAHelper.update(rawContactUri, updatevalue, condition2); - console.info('contact_deleterestore_test_7900 : update = ' + updateCode); - sleep(1000); - - var condition3 = new ohosDataAbility.DataAbilityPredicates(); - condition3.equalTo("id", rawContactId.toString()); - var code = await DAHelper.delete(deletedRawContactRecord, condition3); - console.info('contact_deleterestore_test_7900 : record code = ' + code); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("is_deleted", "0"); - await contactsQuery(map, "contact_deleterestore_test_7900", rawContactUri); - await deleteRawContact("contact_deleterestore_test_7900"); - done(); - } catch (error) { - console.info("logMessage contact_deleterestore_test_7900: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_updateData_test_8000 - * @tc.name When modifying contact_data table, incorrect field or table name or nonexistent value is passed in - * @tc.desc Function test - */ - it("abnormal_contact_updateData_test_8000", 0, async function (done) { - console.info("------logMessage abnormal_contact_updateData_test_8000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli8000" - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage abnormal_contact_updateData_test_8000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(1000); - var contactDataId = await insertData(rawContactId, "name", "xaioli8000", ""); - console.info("logMessage abnormal_contact_updateData_test_8000: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = { - "display_namess": "xaioli80000000" - }; - condition.equalTo("id", contactDataId.toString()); - var code = await DAHelper.update(contactDataUri, updateValues, condition); - console.info('abnormal_contact_updateData_test_8000 : update code = ' + code); - expect(code == -1).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("display_name", "xaioli8000"); - await contactsQuery(map, "abnormal_contact_updateData_test_8000", contactDataUri); - await deleteRawContact("abnormal_contact_updateData_test_8000"); - await deleteAll(contactDataUri, "abnormal_contact_updateData_test_8000"); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_updateData_test_8000: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_favorite_test_8100 - * @tc.name When collecting contacts, an incorrect field was passed in - * @tc.desc Function test - */ - it("abnormal_contact_favorite_test_8100", 0, async function (done) { - console.info("------logMessage abnormal_contact_favorite_test_8100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli8100", "favoriteeee": 1 - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage abnormal_contact_favorite_test_8100: rawContactId = " + rawContactId); - expect(rawContactId == -1).assertTrue(); - sleep(1000); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_favorite_test_8100: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_blocklist_test_8200 - * @tc.name When adding to the blocklist, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_blocklist_test_8200", 0, async function (done) { - console.info("------logMessage abnormal_contact_blocklist_test_8200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertValues = { - "phone_numberss": "9999999", - }; - var id = await DAHelper.insert(contactBlocklistUri, insertValues); - console.info("logMessage abnormal_contact_blocklist_test_8200: id = " + id); - expect(id == -1).assertTrue(); - sleep(1000); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_blocklist_test_8200: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_group_test_8300 - * @tc.name When joining a group, an incorrect field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_group_test_8300", 0, async function (done) { - console.info("------logMessage abnormal_contact_group_test_8300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli8100" - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage abnormal_contact_group_test_8300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_typess": "group_membership", - "detail_info": 1 - }; - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("abnormal_contact_group_test_8300 logMessage : contactDataId " + contactDataId); - expect(contactDataId == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_group_test_8300: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_query_test_8400 - * @tc.name When querying the basic information of multiple contacts, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8400", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8400" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli8400" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8400"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8400: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - condition.or(); - condition.equalTo("ids", rawContactIdFirst.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8400: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8400: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8500 - * @tc.name When querying the basic information of all contacts, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8500", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8500" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli8500" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8500"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8500: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("ids", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8500: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8500: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8600 - * @tc.name When querying all the information of a single contact, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8600", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8600" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8600: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_names"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8600: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8600: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8700 - * @tc.name An incorrect field was passed in when querying group members - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8700", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8700" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "group_membership", 1, ""); - console.info("logMessage abnormal_contact_query_test_8700: dataId = " + dataId); - expect(dataId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8700"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8700: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["raw_contact_id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("content_typess", "group_membership"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8700: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8700: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8800 - * @tc.name An incorrect field was passed in when querying favorite contacts - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8800", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8700", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8800"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8800: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8800: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8800: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8900 - * @tc.name An incorrect field was passed in when querying recent contacts - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8900", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8900 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaoyuzhou", "lastest_contacted_time": 60 - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8900"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8900: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("lastest_contacted_timess", "50"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8900: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8900: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_9000 - * @tc.name An error field was passed in when querying the recently deleted contact - * @tc.desc Function test - */ - it("abnormal_contact_query_test_9000", 0, async function (done) { - console.info("------------abnormal_contact_query_test_9000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_9000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - console.info(tag + ': deleteRawContact deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_9000"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9000: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.orderByDesc("delete_timess"); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_9000: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9000: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_9100 - * @tc.name When querying all mobile phone numbers, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_9100", 0, async function (done) { - console.info("------------abnormal_contact_query_test_9100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9100" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_9100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "phone", "11159100", ""); - console.info("logMessage abnormal_contact_query_test_9100: dataId = " + dataId); - var dataId1 = await insertData(rawContactId, "phone", "111591009100", ""); - console.info("logMessage abnormal_contact_query_test_9100: dataId1 = " + dataId1); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_9100"); - await deleteAll(contactDataUri, "abnormal_contact_query_test_9100"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9100: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("content_typess", "phone"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_9100: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9100: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_9200 - * @tc.name When querying all mailboxes, an error field was passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_9200", 0, async function (done) { - console.info("------------abnormal_contact_query_test_9200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9100" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_9200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "email", "fox@1.com", ""); - console.info("logMessage abnormal_contact_query_test_9200: dataId = " + dataId); - var dataId1 = await insertData(rawContactId, "phone", "fox@2.com", ""); - console.info("logMessage abnormal_contact_query_test_9200: dataId1 = " + dataId1); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_9200"); - await deleteAll(contactDataUri, "abnormal_contact_query_test_9200"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9200: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("content_typess", "email"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_9200: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9200: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_delete_test_10000 - * @tc.name When querying all mailboxes, an error field was passed in - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_10000", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_10000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9300" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_10000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "email", "fox@1.com", ""); - console.info("logMessage abnormal_contact_delete_test_10000: dataId = " + dataId); - var dataId1 = await insertData(rawContactId, "phone", "fox@2.com", ""); - console.info("logMessage abnormal_contact_delete_test_10000: dataId1 = " + dataId1); - - var errorUri = "dataability:///com.ohos.contactsdataability/contacts/contact_datasss"; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", dataId.toString()); - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", dataId.toString()); - map.set("datail_info", "fox@1.com"); - await contactsQuery(map, "abnormal_contact_delete_test_10000", contactDataUri); - await deleteRawContact("abnormal_contact_delete_test_10000"); - await deleteAll(contactDataUri, "abnormal_contact_delete_test_10000"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_10000: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_delete_test_9300 - * @tc.name When deleting, an incorrect URI was passed in - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_9300", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_9300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9300" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_9300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "email", "fox@1.com", ""); - console.info("logMessage abnormal_contact_delete_test_9300: dataId = " + dataId); - var dataId1 = await insertData(rawContactId, "phone", "fox@2.com", ""); - console.info("logMessage abnormal_contact_delete_test_9300: dataId1 = " + dataId1); - - var errorUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contactsss"; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaotian9300"); - await contactsQuery(map, "abnormal_contact_delete_test_9300", rawContactUri); - await deleteRawContact("abnormal_contact_delete_test_9300"); - await deleteAll(contactDataUri, "abnormal_contact_delete_test_9300"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_9300: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_delete_test_9400 - * @tc.name When deleting contacts in batch, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_9400", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_9400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9400" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_9400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli9400" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_9400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - condition.or(); - condition.equalTo("ids", rawContactIdFirst.toString()) - var deleteCode = await DAHelper.delete(rawContactUri, condition); - console.info('abnormal_contact_delete_test_9400 : deleteCode = ' + deleteCode); - expect(deleteCode == -1).assertTrue(); - await deleteRawContact("abnormal_contact_delete_test_9400"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_9400: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_favorite_test_9500 - * @tc.name When collecting contacts in batch, the error field is transferred - * @tc.desc Function test - */ - it("abnormal_contact_favorite_test_9500", 0, async function (done) { - console.info("------------abnormal_contact_favorite_test_9500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9500", "favorite": 0 - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_favorite_test_9500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli9500", "favorite": 0 - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_favorite_test_9500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = { - "favorites": 1 - }; - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdFirst.toString()) - var code = await DAHelper.update(rawContactUri, updateValues, condition); - console.info(' abnormal_contact_favorite_test_9500 : update code = ' + deleteCode); - expect(code == -1).assertTrue(); - await deleteRawContact("abnormal_contact_favorite_test_9500"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_favorite_test_9500: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_insertblocklist_test_9600 - * @tc.name When collecting contacts in batch, the error field is transferred - * @tc.desc Function test - */ - it("abnormal_contact_insertblocklist_test_9600", 0, async function (done) { - console.info("------------abnormal_contact_insertblocklist_test_9600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9600", - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insertblocklist_test_9600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "phone", "1234567899600", ""); - console.info("logMessage abnormal_contact_insertblocklist_test_9600: dataId = " + dataId); - var rawContactValues = { - "display_name": "xiaoli9600", - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insertblocklist_test_9600: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var dataId1 = await insertData(rawContactIdFirst, "phone", "1234567899600", ""); - console.info("logMessage abnormal_contact_insertblocklist_test_9600: dataId1 = " + dataId1); - - var blist = { - "phone_numbers": "1234567899600" - }; - var code = await DAHelper.insert(contactBlocklistUri, blist); - expect(code == -1).assertTrue(); - await deleteRawContact("abnormal_contact_insertblocklist_test_9600"); - await deleteAll(contactDataUri, "abnormal_contact_insertblocklist_test_9600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insertblocklist_test_9600: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_insertGroup_test_9700 - * @tc.name When a contact joins a group in batch, an error field is passed - * @tc.desc Function test - */ - it("abnormal_contact_insertGroup_test_9700", 0, async function (done) { - console.info("------------abnormal_contact_insertGroup_test_9700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9700" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insertGroup_test_9700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_typess": "group_membership", - "detail_info": 1 - }; - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("abnormal_contact_insertGroup_test_9700 logMessage : contactDataId " + contactDataId); - expect(contactDataId == -1).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli9700" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insertGroup_test_9700: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var contactDataValues2 = { - "raw_contact_id": rawContactIdFirst, - "content_typess": "group_membership", - "detail_info": 1 - }; - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info("abnormal_contact_insertGroup_test_9700 logMessage : contactDataId1 " + contactDataId1); - expect(contactDataId1 == -1).assertTrue(); - await deleteRawContact("abnormal_contact_insertblocklist_test_9600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insertblocklist_test_9600: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_pinyinquery_test_9800 - * @tc.name Insert a name with special characters to view the converted Pinyin - * @tc.desc Function test - */ - it("abnormal_contact_pinyinquery_test_9800", 0, async function (done) { - console.info("--------logMessage abnormal_contact_pinyinquery_test_9800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "李bp玉成욱" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage abnormal_contact_pinyinquery_test_9800 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "name", "李bp玉成욱", ""); - console.info('logMessage abnormal_contact_pinyinquery_test_9800 dataId = ' + dataId); - expect(dataId > 0).assertTrue(); - await query(); - await deleteRawContact("abnormal_contact_pinyinquery_test_9800"); - await deleteAll(contactDataUri, "abnormal_contact_pinyinquery_test_9800") - done(); - } catch (error) { - console.info('logMessage abnormal_contact_pinyinquery_test_9800 raw_contact insert error = ' + error); - done(); - } - - async function query() { - var resultColumns = ["search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var name = resultSet.getString(resultSet.getColumnIndex("search_name")); - console.info( - ' abnormal_contact_pinyinquery_test_9800 :logMessage contactsQuery name = ' + name); - expect(name == "李bp玉成욱||libpyucheng욱||lbpyc욱").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_pinyinquery_test_9800 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_9900 - * @tc.name An incorrect field name was passed in during retrieval - * @tc.desc Function test - */ - it("abnormal_contact_query_test_9900", 0, async function (done) { - console.info("--------logMessage abnormal_contact_query_test_9900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "键盘" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage abnormal_contact_query_test_9900 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "name", "键盘", ""); - console.info('logMessage abnormal_contact_query_test_9900 dataId = ' + dataId); - expect(dataId > 0).assertTrue(); - await query(); - await deleteRawContact("abnormal_contact_query_test_9900"); - await deleteAll(contactDataUri, "abnormal_contact_query_test_9900") - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9900 raw_contact insert error = ' + error); - done(); - } - - async function query() { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("search_namesss", "%jp%"); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - console.info( - ' abnormal_contact_query_test_9900 :resultSet.goToFirstRow() = ' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow() == false).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_pinyinquery_test_9800 query error = ' + error); - done(); - } - } - }); - - afterAll(async function () { - var tag = "Contacts_test_start_deleted"; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var DAHelperContact = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': start ! DAHelperContact = ' + DAHelperContact); - var deleteBlockList = await DAHelperContact.delete(contactBlocklistUri, condition); - console.info(tag + " : logMessage : deleteBlockList = " + deleteBlockList); - var deletedGroup = await DAHelperContact.delete(groupUri, condition); - console.info(tag + " : logMessage : deletedGroup = " + deletedGroup); - var dataDeletedCode = await DAHelperContact.delete(contactDataUri, condition); - sleep(2000); - console.info(tag + " : logMessage : dataDeletedCode = " + dataDeletedCode); - var rawContactDeleted = await DAHelperContact.delete(rawContactUri, condition); - sleep(2000); - console.info(tag + " : logMessage : rawContactDeleted = " + rawContactDeleted); - var deleted = await DAHelperContact.delete(deletedUri, condition); - sleep(2000); - console.info(tag + " : logMessage : deleted = " + deleted); - }); - }); -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Groups_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Groups_test.js deleted file mode 100644 index 7d6285b6fe388de712505a36eeefdf675a63b953..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Groups_test.js +++ /dev/null @@ -1,574 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; -import common from './common.js'; - -export default function GroupsTest() { - describe('GroupsTest', function () { - console.info('logMessage GroupsTest start! '); - - async function groupsQuery(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': groupsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ': logMessage groupsQuery key =' + key + 'dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertTrue(); - } - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info(tag + ': logMessage groupsQuery: error = ' + error); - } - } - - async function queryIdForDelete(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryIdForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage queryIdForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - async function deleteAll(uri, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(uri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } - - /** - * @tc.number group_insert_test_100 - * @tc.name Insert group - * @tc.desc Function test - */ - it("group_insert_test_100", 0, async function (done) { - console.info("---------logMessage group_insert_test_100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage group_insert_test_100: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await groupsQuery(map, "group_insert_test_100"); - await deleteAll(groupUri, "group_insert_test_100"); - done(); - } catch (error) { - console.info("logMessage group_insert_test_100: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number group_update_test_500 - * @tc.name Update group - * @tc.desc Function test - */ - it("group_update_test_500", 0, async function (done) { - console.info("---------logMessage group_update_test_500 is starting!----------"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage group_update_test_500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupUpdate(); - await deleteAll(groupUri, "group_update_test_500"); - done(); - } catch (error) { - console.info("logMessage group_update_test_500: group insert error = " + error); - done(); - } - - async function groupUpdate() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", groupId.toString()); - try { - var updateCode = await DAHelper.update(groupUri, common.getProfileUpdateGroup(), condition); - console.info("logMessage group_update_test_500: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = common.getProfileUpdateGroupMap(); - map.set("id", groupId.toStirng()); - await groupsQuery(map, "group_update_test_500"); - } catch (error) { - console.info("logMessage group_update_test_500: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number group_delete_test_200 - * @tc.name Delete group - * @tc.desc Function test - */ - it("group_delete_test_200", 0, async function (done) { - console.info("---------logMessage group_delete_test_200 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage group_delete_test_200: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupDelete(); - done(); - } catch (error) { - console.info("logMessage group_delete_test_200: group insert error = " + error); - done(); - } - async function groupDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", groupId.toString()); - try { - var deleteCode = await DAHelper.delete(groupUri, condition); - console.info("logMessage group_delete_test_200 : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", groupId.toString()); - await queryIdForDelete(map, "group_delete_test_200"); - } catch (error) { - console.info("logMessage group_delete_test_200 : delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number group_query_test_300 - * @tc.name Query a group - * @tc.desc Function test - */ - it("group_query_test_300", 0, async function (done) { - console.info("------------logMessage group_query_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage group_query_test_300: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await groupsQuery(map, "logMessage group_query_test_300"); - await deleteAll(groupUri, "group_query_test_300"); - done(); - } catch (error) { - console.info("logMessage group_query_test_300: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number group_query_test_400 - * @tc.name Query all groups - * @tc.desc Function test - */ - it("group_query_test_400", 0, async function (done) { - console.info("------------logMessage group_query_test_400 is starting!-----------"); - console.info("---------logMessage getDbHelper start!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_CONTACTS); - var groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; - - var insertValues = { - "group_name": "ManagerSecondGroup" - }; - try { - var groupId = await DAHelper.insert(groupUri, insertValues); - console.info("logMessage group_query_test_400: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupQuery(); - await deleteAll(groupUri, "group_query_test_400"); - done(); - } catch (error) { - console.info("logMessage group_query_test_400: group insert error = " + error); - done(); - } - - async function groupQuery() { - var resultColumns = ["id", "group_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info("logMessage group_query_test_400: resultSet.rowCount = " + resultSet.rowCount); - expect(resultSet.rowCount == 1).assertTrue(); - resultSet.close(); - } catch (error) { - console.info("group_query_test_400 resultSet query error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_group_insert_test_600 - * @tc.name abnormal insert - * @tc.desc Function test - */ - it("abnormal_group_insert_test_600", 0, async function (done) { - console.info("---------logMessage abnormal_group_insert_test_600 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - const errorUri = "dataability:///com.ohos.contactsdataability/contacts/groupssss"; - try { - var groupId = await DAHelper.insert(errorUri, common.getProfileGroup()); - console.info("logMessage abnormal_group_insert_test_600: groupId = " + groupId); - expect(groupId == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_group_insert_test_600: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_group_update_test_700 - * @tc.name abnormal update - * @tc.desc Function test - */ - it("abnormal_group_update_test_700", 0, async function (done) { - console.info("---------logMessage abnormal_group_update_test_700 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage abnormal_group_update_test_700: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupUpdate(); - await deleteAll(groupUri, "abnormal_group_update_test_700"); - done(); - } catch (error) { - console.info("logMessage abnormal_group_update_test_700: group insert error = " + error); - done(); - } - - async function groupUpdate() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", groupId.toString()); - var updateValue = { - "group_notesss": "6666" - } - try { - var updateCode = await DAHelper.update(groupUri, updateValue, condition); - console.info("logMessage abnormal_group_update_test_700: updateCode = " + updateCode); - expect(updateCode == -1).assertTrue(); - var map = common.getProfileUpdateGroupMap(); - map.set("id", groupId.toStirng()); - await groupsQuery(map, "abnormal_group_update_test_700"); - } catch (error) { - console.info("logMessage abnormal_group_update_test_700: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_group_delete_test_800 - * @tc.name abnormal delete - * @tc.desc Function test - */ - it("abnormal_group_delete_test_800", 0, async function (done) { - console.info("---------logMessage abnormal_group_delete_test_800 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage abnormal_group_delete_test_800: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupDelete(); - await deleteAll(groupUri, "abnormal_group_delete_test_800"); - done(); - } catch (error) { - console.info("logMessage abnormal_group_delete_test_800: group insert error = " + error); - done(); - } - async function groupDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("idss", groupId.toString()); - try { - var deleteCode = await DAHelper.delete(groupUri, condition); - console.info("logMessage abnormal_group_delete_test_800 : deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = common.getProfileUpdateGroupMap(); - map.set("id", groupId.toStirng()); - await groupsQuery(map, "abnormal_group_delete_test_800"); - } catch (error) { - console.info("logMessage abnormal_group_delete_test_800 : delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_group_query_test_900 - * @tc.name abnormal query - * @tc.desc Function test - */ - it("abnormal_group_query_test_900", 0, async function (done) { - console.info("------------logMessage abnormal_group_insert_test_900 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "group_name": "PersonnelDepartment" - }; - try { - var groupId = await DAHelper.insert(groupUri, insertValues); - console.info("logMessage abnormal_group_insert_test_900: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupQuery(DAHelper); - await deleteAll(groupUri, "abnormal_group_insert_test_900"); - done(); - } catch (error) { - console.info("logMessage abnormal_group_insert_test_900: group insert error = " + error); - done(); - } - - async function groupQuery(DAHelper) { - var resultColumns = ["id", "group_namesss"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", groupId.toString()); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info('abnormal_group_insert_test_900 resultSet.goToFirstRow() = ' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow() == false).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('abnormal_group_insert_test_900 query error ' + error); - done(); - } - } - }); - - /** - * @tc.number group_insert_test_1000 - * @tc.name Adding multiple groups - * @tc.desc Function test - */ - it("group_insert_test_1000", 0, async function (done) { - console.info("------------logMessage group_insert_test_1000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "group_name": "test1000" - }; - var insertValuesTwo = { - "group_name": "test1000" - }; - var insertValuesThree = { - "group_name": "test1000" - }; - var array = [] - array[0] = insertValuesOne; - array[1] = insertValuesTwo; - array[2] = insertValuesThree; - try { - var code = await DAHelper.batchInsert(groupUri, array); - console.info("logMessage group_insert_test_1000: batchInsert code = " + code); - expect(code == 0).assertTrue(); - await groupQuery(DAHelper); - await deleteAll(groupUri, "group_insert_test_1000"); - done(); - } catch (error) { - console.info("logMessage group_insert_test_1000: group insert error = " + error); - done(); - } - - async function groupQuery(DAHelper) { - var groupSize = 3; - var resultColumns = ["id", "group_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("group_name", "test1000"); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info('group_insert_test_1000 resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == groupSize).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('group_insert_test_1000 query error ' + error); - done(); - } - } - }); - - /** - * @tc.number group_delete_test_1100 - * @tc.name delete multiple groups - * @tc.desc Function test - */ - it("group_delete_test_1100", 0, async function (done) { - console.info("------------logMessage group_delete_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "group_name": "test1100" - }; - var insertValuesTwo = { - "group_name": "test1100" - }; - var insertValuesThree = { - "group_name": "test1100" - }; - var array = [] - array[0] = insertValuesOne; - array[1] = insertValuesTwo; - array[2] = insertValuesThree; - try { - var code = await DAHelper.batchInsert(groupUri, array); - console.info("logMessage group_delete_test_1100: batchInsert code = " + code); - expect(code == 0).assertTrue(); - await deleteAll(groupUri, "group_delete_test_1100"); - await groupQuery(DAHelper); - done(); - } catch (error) { - console.info("logMessage group_delete_test_1100: group insert error = " + error); - done(); - } - - async function groupQuery(DAHelper) { - var groupSize = 0; - var resultColumns = ["id", "group_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("group_name", "test1100"); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info('group_delete_test_1100 resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == groupSize).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('group_delete_test_1100 query error ' + error); - done(); - } - } - }); - - /** - * @tc.number group_update_test_1200 - * @tc.name update multiple groups - * @tc.desc Function test - */ - it("group_update_test_1200", 0, async function (done) { - console.info("------------logMessage group_update_test_1200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "group_name": "test1200" - }; - var insertValuesTwo = { - "group_name": "test1200" - }; - var insertValuesThree = { - "group_name": "test1200" - }; - var array = [] - array[0] = insertValuesOne; - array[1] = insertValuesTwo; - array[2] = insertValuesThree; - try { - var code = await DAHelper.batchInsert(groupUri, array); - console.info("logMessage group_update_test_1200: batchInsert code = " + code); - expect(code == 0).assertTrue(); - await groupUpdateThree(DAHelper); - await groupQuery(DAHelper); - await deleteAll(groupUri, "group_update_test_1200"); - done(); - } catch (error) { - console.info("logMessage group_update_test_1200: group insert error = " + error); - done(); - } - - async function groupQuery(DAHelper) { - var groupSize = 3; - var resultColumns = ["id", "group_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("group_name", "test120000"); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info("logMessage group_update_test_1200: resultSet.rowCount = " + resultSet.rowCount); - expect(resultSet.rowCount == groupSize).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('group_update_test_1200 query error ' + error); - done(); - } - } - }); - - async function groupUpdateThree(DAHelper) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("group_name", "test1200"); - var updateValue = { - "group_name": "test120000" - } - try { - var updateCode = await DAHelper.update(groupUri, updateValue, condition); - console.info("logMessage group_update_test_1200: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage group_update_test_1200: update error = " + error); - } - } - - afterAll(async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", "0"); - try { - var deleteCode = await DAHelper.delete(groupUri, condition); - console.info("logMessage group_deleted : deleteCode = " + deleteCode); - done(); - } catch (error) { - console.info("logMessage group_deleted: group insert error = " + error); - done(); - } - }); - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ObjectInterface_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ObjectInterface_test.js deleted file mode 100644 index 7c39baeda761de8880fbaa66e027cd6e59e0bced..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ObjectInterface_test.js +++ /dev/null @@ -1,915 +0,0 @@ -/* - * 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 contactsapi from "@ohos.contact"; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const profileRawContactUri = "dataability:///com.ohos.contactsdataability/profile/raw_contact"; - -export default function ObjectInterfaceTest() { - describe('ObjectInterfaceTest', function () { - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - var contactData = { - id: 0, - key: "0", - contactAttributes: { - attributes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - }, - emails: [{ - email: "email", labelName: "自定义邮箱", labelId: 1, displayName: "emailDisplayName" - }], - events: [{ - eventDate: "event", labelName: "自定义event", labelId: 2 - }], - groups: [{ - groupId: 1, title: "群组" - }], - imAddresses: [{ - imAddress: "imAddress", labelName: "自定义", labelId: 3 - }], - phoneNumbers: [{ - phoneNumber: "183", labelName: "自定义phoneNumbers", labelId: 4 - }], - portrait: { - uri: "content://head/0" - }, - postalAddresses: [{ - city: "南京", - country: "中国", - labelName: "labelName", - neighborhood: "neighborhood", - pobox: "pobox", - postalAddress: "postalAddress", - postcode: "postcode", - region: "region", - street: "street", - labelId: 5 - }], - relations: [{ - relationName: "relationName", labelName: "自定义relationName", labelId: 6 - }], - sipAddresses: [{ - sipAddress: "sipAddress", labelName: "自定义sipAddress", labelId: 6 - }], - websites: [{ - website: "website" - }], - name: { - familyName: "familyName", - familyNamePhonetic: "familyNamePhonetic", - fullName: "小李", - givenName: "givenName", - givenNamePhonetic: "givenNamePhonetic", - middleName: "middleName", - middleNamePhonetic: "middleNamePhonetic", - namePrefix: "namePrefix", - nameSuffix: "nameSuffix" - }, - nickName: { - nickName: "nickName" - }, - note: { - noteContent: "note" - }, - organization: { - name: "TT", title: "开发" - } - }; - - var gRawContactId; - var gGroup; - - /** - * @tc.number contactsApi_insert_test_100 - * @tc.name Insert contact information - * @tc.desc Function test - */ - it("contactsApi_insert_test_100", 0, async function (done) { - try { - var rawContactId = await contactsapi.addContact(contactData); - console.info("contactsApi_insert_test_100 : rawContactId = " + rawContactId); - gRawContactId = rawContactId; - expect(gRawContactId > 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_insert_test_100 : raw_contact insert error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_delete_test_200 - * @tc.name Delete contact information - * @tc.desc Function test - */ - it("contactsApi_delete_test_200", 0, async function (done) { - var deleteId = gRawContactId; - try { - var deleteCode = await contactsapi.deleteContact(deleteId); - var gDelete = deleteCode; - console.info("contactsApi_delete_test_200 : deleteCode = " + deleteCode); - expect(gDelete == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_delete_test_200 : delete error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_update_test_300 - * @tc.name Update contact information - * @tc.desc Function test - */ - it("contactsApi_update_test_300", 0, async function (done) { - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var rawContactId = await contactsapi.addContact(contactData); - console.info("contactsApi_insert_test_300 : rawContactId = " + rawContactId); - gRawContactId = rawContactId; - expect(rawContactId > 0).assertTrue(); - - var updateValues = { - id: gRawContactId, name: { - fullName: "小红" - } - }; - var condition = { - attributes: [6] - } - try { - var updateCode = await contactsapi.updateContact(updateValues, condition); - console.info("contactsApi_update_test_300 : updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_update_test_300 : update error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contact_test_400 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contact_test_400", 0, async function (done) { - var queryId = gRawContactId; - try { - var resultSet = await contactsapi.queryContact(queryId); - console.info("contactsApi_query_contact_test_400 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contact_test_400 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contact_test_500 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contact_test_500", 0, async function (done) { - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - var queryId = gRawContactId.toString(); - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryContact(queryId, holder); - console.info("contactsApi_query_contact_test_500 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contact_test_500 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contact_test_600 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contact_test_600", 0, async function (done) { - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - var queryId = gRawContactId.toString(); - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - }; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContact(queryId, holder, ContactAttributes); - console.info("contactsApi_query_contact_test_600 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contact_test_600 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contacts_test_700 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contacts_test_700", 0, async function (done) { - try { - var resultSet = await contactsapi.queryContacts(); - console.info("contactsApi_query_contacts_test_700 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contacts_test_700 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contacts_test_800 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contacts_test_800", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryContacts(holder); - console.info("contactsApi_query_contacts_test_800 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contacts_test_800 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contacts_test_900 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contacts_test_900", 0, async function (done) { - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContacts(ContactAttributes); - console.info("contactsApi_query_contacts_test_900 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contacts_test_900 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contacts_test_1000 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contacts_test_1000", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - }; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContacts(holder, ContactAttributes); - console.info("contactsApi_query_contacts_test_1000 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contacts_test_1000 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_email_test_1100 - * @tc.name Query email information - * @tc.desc Function test - */ - it("contactsApi_query_email_test_1100", 0, async function (done) { - var email = "email"; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryContactsByEmail(email, holder); - console.info("contactsApi_query_email_test_1100 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_email_test_1100 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_email_test_1200 - * @tc.name Query email information - * @tc.desc Function test - */ - it("contactsApi_query_email_test_1200", 0, async function (done) { - var email = "email"; - try { - var resultSet = await contactsapi.queryContactsByEmail(email); - console.info("contactsApi_query_email_test_1200 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_email_test_1200 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_email_test_1300 - * @tc.name Query email information - * @tc.desc Function test - */ - it("contactsApi_query_email_test_1300", 0, async function (done) { - var email = "email"; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - }; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContactsByEmail(email, holder, ContactAttributes); - console.info("contactsApi_query_email_test_1300 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_email_test_1300 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_email_test_1400 - * @tc.name Query email information - * @tc.desc Function test - */ - it("contactsApi_query_email_test_1400", 0, async function (done) { - var email = "email"; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContactsByEmail(email, ContactAttributes); - console.info("contactsApi_query_email_test_1400 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_email_test_1400 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_phoneNumber_test_1500 - * @tc.name Query phoneNumber information - * @tc.desc Function test - */ - it("contactsApi_query_phoneNumber_test_1500", 0, async function (done) { - var phoneNumber = "183"; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber, holder); - console.info("contactsApi_query_phoneNumber_test_1500 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_phoneNumber_test_1500 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_phoneNumber_test_1600 - * @tc.name Query phoneNumber information - * @tc.desc Function test - */ - it("contactsApi_query_phoneNumber_test_1600", 0, async function (done) { - var phoneNumber = "183"; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - }; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber, holder, ContactAttributes); - console.info("contactsApi_query_phoneNumber_test_1600 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_phoneNumber_test_1600 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_phoneNumber_test_1700 - * @tc.name Query phoneNumber information - * @tc.desc Function test - */ - it("contactsApi_query_phoneNumber_test_1700", 0, async function (done) { - var phoneNumber = "183"; - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber); - console.info("contactsApi_query_phoneNumber_test_1700 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_phoneNumber_test_1700 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_phoneNumber_test_1800 - * @tc.name Query phoneNumber information - * @tc.desc Function test - */ - it("contactsApi_query_phoneNumber_test_1800", 0, async function (done) { - var phoneNumber = "183"; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber, ContactAttributes); - console.info("contactsApi_query_phoneNumber_test_1800 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_phoneNumber_test_1800 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_group_test_1900 - * @tc.name Query group - * @tc.desc Function test - */ - it("contactsApi_query_group_test_1900", 0, async function (done) { - try { - var resultSet = await contactsapi.queryGroups(); - console.info("contactsApi_query_group_test_1900 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_group_test_1900 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_group_test_2000 - * @tc.name Query group - * @tc.desc Function test - */ - it("contactsApi_query_group_test_2000", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryGroups(holder); - console.info("contactsApi_query_group_test_2000 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_group_test_2000 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_holders_test_2200 - * @tc.name Query holders information - * @tc.desc Function test - */ - it("contactsApi_query_holders_test_2200", 0, async function (done) { - try { - var resultSet = await contactsapi.queryHolders(); - console.info("contactsApi_query_holders_test_2200 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_holders_test_2200 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_key_test_2300 - * @tc.name Query key information - * @tc.desc Function test - */ - it("contactsApi_query_key_test_2300", 0, async function (done) { - var idtest = gRawContactId; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryKey(idtest, holder); - console.info("contactsApi_query_key_test_2300 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length != 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_key_test_2300 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_key_test_2400 - * @tc.name Query key information - * @tc.desc Function test - */ - it("contactsApi_query_key_test_2400", 0, async function (done) { - var idtest = gRawContactId; - console.info("contactsApi_query_key_test_2400 : query gRawContactId = " + idtest); - try { - var resultSet = await contactsapi.queryKey(idtest); - console.info("contactsApi_query_key_test_2400 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length != 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_key_test_2400 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_mycard_test_2500 - * @tc.name Query mycard information - * @tc.desc Function test - */ - it("contactsApi_query_mycard_test_2500", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryMyCard(holder); - console.info("contactsApi_query_mycard_test_2500 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_mycard_test_2500 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_isMyCard_test_2600 - * @tc.name Query mycard exist - * @tc.desc Function test - */ - it("contactsApi_isMyCard_test_2600", 0, async function (done) { - var id = 1; - try { - var isExist = await contactsapi.isMyCard(id); - console.info("contactsApi_isMyCard_test_2600 : query isExist = " + isExist); - expect(isExist == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_isMyCard_test_2600 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_isLocalContact_test_2700 - * @tc.name Query isLocalContact exist - * @tc.desc Function test - */ - it("contactsApi_isLocalContact_test_2700", 0, async function (done) { - var id = gRawContactId; - try { - var isExist = await contactsapi.isLocalContact(id); - console.info("logMessage contactsApi_isLocalContact_test_2700 isExist = " + isExist); - expect(isExist == 1).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_isLocalContact_test_2700 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_insert_test_2800 - * @tc.name contactsApi_insert error - * @tc.desc Function test - */ - it("abnormal_contactsApi_insert_test_2800", 0, async function (done) { - var contactDataError = {}; - try { - var rawContactId = await contactsapi.addContact(contactDataError); - console.info("abnormal_contactsApi_insert_test_2800 : rawContactId = " + rawContactId); - expect(rawContactId == -1).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_insert_test_100 : raw_contact insert error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_update_test_3000 - * @tc.name contactsApi_update error - * @tc.desc Function test - */ - it("abnormal_contactsApi_update_test_3000", 0, async function (done) { - var rawContactId = -1; - var updateValues = { - id: rawContactId, name: { - fullName: "小红" - } - }; - var condition = { - attributes: [6] - } - try { - var updateCode = await contactsapi.updateContact(updateValues, condition); - console.info("abnormal_contactsApi_update_test_3000 : updateCode = " + updateCode); - expect(updateCode == -1).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_update_test_3000 : update error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_contact_test_3100 - * @tc.name contactsApi_query_contact error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_contact_test_3100", 0, async function (done) { - var queryId = "-1"; - try { - var resultSet = await contactsapi.queryContact(queryId); - if (resultSet == null) { - console.info("abnormal_contactsApi_query_contact_test_3100 is null"); - } - if (resultSet == undefined) { - console.info("abnormal_contactsApi_query_contact_test_3100 is undefined"); - } - console.info("abnormal_contactsApi_query_contact_test_3100 : updateCode = " + JSON.stringify(resultSet)); - expect(resultSet == undefined).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_contact_test_3100 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_contacts_test_3200 - * @tc.name contactsApi_query_contacts error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_contacts_test_3200", 0, async function (done) { - var ContactAttributes = { - attributes: [100] - } - try { - var resultSet = await contactsapi.queryContacts(ContactAttributes); - if (resultSet == null) { - console.info("abnormal_contactsApi_query_contacts_test_3200 is null"); - } - if (resultSet == undefined) { - console.info("abnormal_contactsApi_query_contacts_test_3200 is undefined"); - } - console.info( - "abnormal_contactsApi_query_contacts_test_3200 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_contacts_test_3200 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_email_test_3300 - * @tc.name contactsApi_query_email error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_email_test_3300", 0, async function (done) { - var email = "email2222"; - try { - var resultSet = await contactsapi.queryContactsByEmail(email); - console.info("abnormal_contactsApi_query_email_test_3300 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_email_test_3300 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_phoneNumber_test_3400 - * @tc.name contactsApi_query_phoneNumber error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_phoneNumber_test_3400", 0, async function (done) { - var phoneNumber = "19999999"; - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber); - console.info( - "abnormal_contactsApi_query_phoneNumber_test_3400 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_phoneNumber_test_3400 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_group_test_3500 - * @tc.name contactsApi_query_group error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_group_test_3500", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts2", displayName: "phone2", holderId: 2 - } - try { - var resultSet = await contactsapi.queryGroups(holder); - console.info("abnormal_contactsApi_query_group_test_3500 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_group_test_2000 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_key_test_3600 - * @tc.name contactsApi_query_key error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_key_test_3600", 0, async function (done) { - var idtest = -1; - try { - var resultSet = await contactsapi.queryKey(idtest); - console.info("abnormal_contactsApi_query_key_test_3600 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_key_test_3600 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_mycard_test_3700 - * @tc.name contactsApi_query_mycard error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_mycard_test_3700", 0, async function (done) { - var ContactAttributes = { - attributes: [100] - }; - try { - var resultSet = await contactsapi.queryMyCard(ContactAttributes); - console.info( - "abnormal_contactsApi_query_mycard_test_3700 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_mycard_test_3700 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_isMyCard_test_3800 - * @tc.name isMyCard is not exist - * @tc.desc Function test - */ - it("abnormal_contactsApi_isMyCard_test_3800", 0, async function (done) { - var id = 999; - try { - var isExist = await contactsapi.isMyCard(id); - console.info("abnormal_contactsApi_isMyCard_test_3800 : query isExist = " + isExist); - expect(isExist == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_isMyCard_test_3800 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_isLocalContact_test_3900 - * @tc.name contactsApi_isLocalContact is not exist - * @tc.desc Function test - */ - it("abnormal_contactsApi_isLocalContact_test_3900", 0, async function (done) { - var id = 999; - try { - var isExist = await contactsapi.isLocalContact(id); - console.info("abnormal_contactsApi_isLocalContact_test_3900 : query isExist = " + isExist); - expect(isExist == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_isLocalContact_test_3900 query error = " + error); - done(); - } - sleep(2000) - }); - }); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Voicemail_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Voicemail_test.js deleted file mode 100644 index 81a54115772b3e4236fa812ec6c335a51ef6c176..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Voicemail_test.js +++ /dev/null @@ -1,1329 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_VOICEMAIL = "dataability:///com.ohos.voicemailability"; -const voicemailUri = "dataability:///com.ohos.voicemailability/calls/voicemail"; - -export default function VoicemailTest() { - describe('VoicemailTest', function () { - console.log("----------VoicemailTest is starting!----------"); - - async function voiceMailQuery(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ':calllogInsertQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' :logMessage voiceMailQuery key = ' + key + ' dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertTrue(); - } - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info(tag + ":logMessage voiceMailQuery: error = " + error); - } - } - - async function voiceMailQueryForDelete(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': voiceMailQueryForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage voiceMailQueryForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage voiceMailQueryForDelete: error = " + error); - } - } - - async function voiceMailQueryError(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': voiceMailQueryError start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", map.get("phone_number")); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage voiceMailQueryError: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage voiceMailQueryError: error = " + error); - } - } - - async function voiceMailQueryForBatchInsert(array, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': voiceMailQueryForBatchInsert start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", array[0].get("phone_number")); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - var size = array.size(); - console.info(tag + ' : logMessage voiceMailQueryForBatchInsert: size' + size); - expect(resultSet.rowCount == size).assertEqual(true); - var i = 0; - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of array[i]) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' : logMessage voiceMailQueryForBatchInsert dbresult :' + dbresult + - ' value : ' + value); - console.info( - tag + ' : logMessage voiceMailQueryForBatchInsert value ' + (value == dbresult)); - expect(value == dbresult).assertTrue(); - } - i++; - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage calllogQueryByInsert: error = " + error); - } - } - - async function voiceMailDelete(tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info(tag + ': voiceMailDelete deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } - - /** - * @tc.number voicemail_insert_test_100 - * @tc.name Insert voicemail data - * @tc.desc Function test - */ - it("voicemail_insert_test_100", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_100 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var voicemailId = await DAHelper.insert(voicemailUri, common.getVoiceMail()); - console.info("logMessage voicemail_insert_test_100: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - var map = common.getVoiceMailMap(); - map.set("id", voicemailId.toString()); - await voiceMailQuery(map, "voicemail_insert_test_100"); - await voiceMailDelete("voicemail_insert_test_100"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_100: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_200 - * @tc.name Insert voicemail status - * @tc.desc Function test - */ - it("voicemail_insert_test_200", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_200 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "1557254", "voice_status": 1 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - console.info("logMessage voicemail_insert_test_200: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("phone_number", "1557254"); - map.set("voice_status", "1"); - await voiceMailQuery(map, "voicemail_insert_test_200"); - await voiceMailDelete("voicemail_insert_test_200"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_200: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_100000 - * @tc.name Insert voicemail status - * @tc.desc Function test - */ - it("voicemail_insert_test_100000", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_100000 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "1557254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - console.info("logMessage voicemail_insert_test_100000: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("phone_number", "1557254"); - map.set("voice_status", "0"); - await voiceMailQuery(map, "voicemail_insert_test_100000"); - await voiceMailDelete("voicemail_insert_test_100000"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_100000: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_update_test_1000 - * @tc.name Update voicemail data - * @tc.desc Function test - */ - it("voicemail_update_test_1000", 0, async function (done) { - console.info("------------logMessage voicemail_update_test_1000 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var voicemailId = await DAHelper.insert(voicemailUri, common.getVoiceMail()); - console.info("logMessage voicemail_update_test_1000: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await voicemailUpdate(); - await voiceMailDelete("voicemail_update_test_1000"); - done(); - } catch (error) { - console.info("logMessage voicemail_update_test_1000: voicemail insert error = " + error); - done(); - } - - async function voicemailUpdate() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var updateCode = await DAHelper.update(voicemailUri, common.getVoiceMailUpdate(), condition); - console.info("logMessage voicemail_update_test_1000: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = common.getVoiceMailUpdateMap(); - map.set("id", voicemailId.toString()); - await voiceMailQuery(map, "voicemail_update_test_1000"); - } catch (error) { - console.info("logMessage voicemail_update_test_1000: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_update_test_900 - * @tc.name Update voicemail status - * @tc.desc Function test - */ - it("voicemail_update_test_900", 0, async function (done) { - console.info("------------logMessage voicemail_update_test_900 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "18862013", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage voicemail_update_test_900: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await voicemailUpdate(); - await voiceMailDelete("voicemail_update_test_900"); - done(); - } catch (error) { - console.info("logMessage voicemail_update_test_900: voicemail insert error = " + error); - done(); - } - - async function voicemailUpdate() { - var updateValues = { - "voice_status": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - console.info("logMessage voicemail_update_test_900: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("voice_status", "1"); - await voiceMailQuery(map, "voicemail_update_test_900"); - } catch (error) { - console.info("logMessage voicemail_update_test_900: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_delete_test_500 - * @tc.name Delete voicemail data - * @tc.desc Function test - */ - it("voicemail_delete_test_500", 0, async function (done) { - console.info("-------------logMessage voicemail_delete_test_500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "100578615", "display_name": "zhangming" - }; - try { - var voiceMailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage voicemail_delete_test_500: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - await VoicemailDelete(); - await voiceMailDelete("voicemail_delete_test_500"); - done(); - } catch (error) { - console.info("logMessage voicemail_delete_test_500: voicemail insert error = " + error); - done(); - } - - async function VoicemailDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info('logMessage voicemail_delete_test_500: deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - await voiceMailQueryForDelete(map, "voicemail_delete_test_500"); - } catch (error) { - console.info("logMessage voicemail_delete_test_500: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_update_test_600 - * @tc.name Delete voicemail status - * @tc.desc Function test - */ - it("voicemail_update_test_600", 0, async function (done) { - console.info("-------------logMessage voicemail_update_test_600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues1 = { - "phone_number": "100578615", "voice_status": 1 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues1); - console.info("logMessage voicemail_update_test_600: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await voicemailUpdate(); - await voiceMailDelete("voicemail_update_test_600"); - done(); - } catch (error) { - console.info("logMessage voicemail_update_test_600: voicemail insert error = " + error); - done(); - } - - async function voicemailUpdate() { - var updateValues = { - "voice_status": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - console.info('logMessage voicemail_update_test_600: deleteCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("voice_status", "0"); - await voiceMailQuery(map, "voicemail_update_test_600"); - } catch (error) { - console.info("logMessage voicemail_update_test_600: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_batchInsert_test_1800 - * @tc.name Insert voicemail data in batches - * @tc.desc Function test - */ - it("voicemail_batchInsert_test_1800", 0, async function (done) { - console.info("-------------logMessage voicemail_batchInsert_test_1800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "phone_number": "10086", "display_name": "xiaoming" - }; - var insertValuesTwo = { - "phone_number": "12580", "display_name": "xiaohei" - }; - var insertValuesThree = { - "phone_number": "123456", "display_name": "xiaohong" - }; - var insertValuesFour = { - "phone_number": "9996325", "display_name": "xiaohei" - }; - var insertValuesFive = { - "phone_number": "18862013", "display_name": "xiaofen" - }; - var listAddBluk = []; - listAddBluk[0] = insertValuesOne; - listAddBluk[1] = insertValuesTwo; - listAddBluk[2] = insertValuesThree; - listAddBluk[3] = insertValuesFour; - listAddBluk[4] = insertValuesFive; - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - console.info("logMessage voicemail_batchInsert_test_1800: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await voiceMailDelete("voicemail_batchInsert_test_1800"); - done(); - } catch (error) { - console.info("logMessage voicemail_batchInsert_test_1800: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_batchInsert_test_1700 - * @tc.name Insert voicemail status in batches - * @tc.desc Function test - */ - it("voicemail_batchInsert_test_1700", 0, async function (done) { - console.info("-------------logMessage voicemail_batchInsert_test_1700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "phone_number": "1600", "display_name": "xiaoming", "voice_status": 0 - }; - var insertValuesTwo = { - "phone_number": "1600", "display_name": "xiaohei", "voice_status": 1 - }; - var insertValuesThree = { - "phone_number": "1600", "display_name": "xiaohong", "voice_status": 0 - }; - var insertValuesFour = { - "phone_number": "1600", "display_name": "xiaohei", "voice_status": 0 - }; - var insertValuesFive = { - "phone_number": "1600", "display_name": "xiaofen", "voice_status": 1 - }; - var listAddBluk = []; - listAddBluk[0] = insertValuesOne; - listAddBluk[1] = insertValuesTwo; - listAddBluk[2] = insertValuesThree; - listAddBluk[3] = insertValuesFour; - listAddBluk[4] = insertValuesFive; - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - console.info("logMessage voicemail_batchInsert_test_1700: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var array = common.getvoiceMailBatchInsert(); - await voiceMailQueryForBatchInsert(array, "voicemail_batchInsert_test_1700"); - await voiceMailDelete("voicemail_batchInsert_test_1700"); - done(); - } catch (error) { - console.info("logMessage voicemail_batchInsert_test_1700: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_query_test_1400 - * @tc.name Query voicemail data - * @tc.desc Function test - */ - it("voicemail_query_test_1400", 0, async function (done) { - console.info("------------voicemail_query_test_1400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "8855220011", "display_name": "daming" - }; - try { - var voiceMailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage voicemail_query_test_1400: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - await voiceMailQuery(); - await voiceMailDelete("voicemail_query_test_1400"); - done(); - } catch (error) { - console.info("logMessage voicemail_query_test_1400: voicemial insert error = " + error); - done(); - } - async function voiceMailQuery() { - var resultColumns = ["id", "display_name", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('voicemail_query_test_1400 id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == voicemailId.toString()).assertTrue(); - console.info('voicemail_query_test_1400 displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "daming").assertTrue(); - console.info('voicemail_query_test_1400 phone_number = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "8855220011").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("voicemail_query_test_1400 query error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_query_test_1300 - * @tc.name Query voicemail's status - * @tc.desc Function test - */ - it("voicemail_query_test_1300", 0, async function (done) { - console.info("------------voicemail_query_test_1300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "1158220165", "display_name": "xiaoming", "voice_status": 1 - }; - try { - var voiceMailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage voicemail_query_test_1300: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - await voiceMailQuery(); - await voiceMailDelete("voicemail_query_test_1300"); - done(); - } catch (error) { - console.info("logMessage voicemail_query_test_1300: voicemial insert error = " + error); - done(); - } - async function voiceMailQuery() { - var resultColumns = ["id", "display_name", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("voice_status", "1"); - condition.and(); - condition.equalTo("phone_number", "1158220165"); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('voicemail_query_test_1300 id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == voicemailId.toString()).assertTrue(); - console.info('voicemail_query_test_1300 displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoming").assertTrue(); - console.info('voicemail_query_test_1300 phone_number = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "1158220165").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("voicemail_query_test_1300 query error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_insert_test_300 - * @tc.name Abnormal use case, an incorrect field is passed in when inserting data - * @tc.desc Function test - */ - it("abnormal_voicemail_insert_test_300", 0, async function (done) { - console.info("------------abnormal_voicemail_insert_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_numbers": "18942010321", "display_name": "xiaoming" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_insert_test_300: voicemialId = " + voicemailId); - expect(voicemailId == -1).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_voicemail_insert_test_300 insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_insert_test_400 - * @tc.name Exception use case, an incorrect table name is passed in when inserting data - * @tc.desc Function test - */ - it("abnormal_voicemail_insert_test_400", 0, async function (done) { - console.info("------------abnormal_voicemail_insert_test_400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/voicemails"; - - var insertValues = { - "phone_number": "18942010321", "display_name": "xiaoming" - }; - try { - var voicemialId = await DAHelper.insert(errorUri, insertValues) - console.info("logMessage abnormal_voicemail_insert_test_400: voicemialId = " + voicemialId); - expect(voicemialId == -1).assertTrue(); - var map = new Map(); - map.set("phone_number", "18942010321"); - await voiceMailQueryError(map, "abnormal_voicemail_insert_test_400"); - done(); - } catch (error) { - console.info("abnormal_voicemail_insert_test_400 insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_update_test_1100 - * @tc.name Abnormal use case, passing in a wrong field when updating data - * @tc.desc Function test - */ - it("abnormal_voicemail_update_test_1100", 0, async function (done) { - console.info("------------abnormal_voicemail_update_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "18942010321" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_update_test_1100: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalUpdate(); - await voiceMailDelete("abnormal_voicemail_update_test_1100"); - done(); - } catch (error) { - console.info("abnormal_voicemail_update_test_1100 insert error = " + error); - done(); - } - async function abnormalUpdate() { - var updateValues = { - "phone_numbers": "11111111111111111" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", voicemailId.toString()); - try { - var updataCode = await DAHelper.update(voicemailUri, updateValues, condition); - console.info("logMessage abnormal_voicemail_update_test_1100: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("phone_number", "11111111111111111"); - await voiceMailQueryError(map, "abnormal_voicemail_insert_test_400"); - } catch (error) { - console.info("logMessage abnormal_voicemail_update_test_1100: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_update_test_1200 - * @tc.name Abnormal use case, an incorrect table name is passed in when updating data - * @tc.desc Function test - */ - it("abnormal_voicemail_update_test_1200", 0, async function (done) { - console.info("------------abnormal_voicemail_update_test_1200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/voicemails"; - - var insertValues = { - "phone_number": "9952364" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_update_test_1200: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalUpdate(); - await voiceMailDelete("abnormal_voicemail_update_test_1200"); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_update_test_1200: insert error = " + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "phone_number": "22001122" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var updataCode = await DAHelper.update(errorUri, updateValues, condition) - console.info("logMessage abnormal_voicemail_update_test_1200: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("phone_number", "22001122"); - await voiceMailQueryError(map, "abnormal_voicemail_insert_test_400"); - } catch (error) { - console.info("logMessage abnormal_voicemail_update_test_1200: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_delete_test_700 - * @tc.name Abnormal use case, passing in a wrong field when deleting data - * @tc.desc Function test - */ - it("abnormal_voicemail_delete_test_700", 0, async function (done) { - console.info("------------abnormal_voicemail_delete_test_700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "789130" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_delete_test_700: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalDelete(); - await voiceMailDelete("abnormal_voicemail_delete_test_700"); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_delete_test_700: insert error = " + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", voicemailId.toString()); - try { - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info("logMessage abnormal_voicemail_delete_test_700: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - } catch (error) { - console.info("logMessage abnormal_voicemail_delete_test_700: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_delete_test_800 - * @tc.name Abnormal use case, passing in an incorrect table name when deleting data - * @tc.desc Function test - */ - it("abnormal_voicemail_delete_test_800", 0, async function (done) { - console.info("------------abnormal_voicemail_delete_test_800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/voicemails"; - - var insertValues = { - "phone_number": "1564721" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_delete_test_800: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalDelete(); - await voiceMailDelete("abnormal_voicemail_delete_test_800"); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_delete_test_800: insert error = " + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info("logMessage abnormal_voicemail_delete_test_800: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - } catch (error) { - console.info("logMessage abnormal_voicemail_delete_test_800: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_query_test_1500 - * @tc.name Abnormal use case, an incorrect field is passed in when querying - * @tc.desc Function test - */ - it("abnormal_voicemail_query_test_1500", 0, async function (done) { - console.info("------------abnormal_voicemail_query_test_1500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1564721" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_query_test_1500: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalQuery(); - await voiceMailDelete("abnormal_voicemail_query_test_1500"); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_query_test_1500: insert error = " + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "phone_number"]; - - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", voicemailId.toString()); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition) - console.info('logMessage abnormal_voicemail_query_test_1500: goToFirstRow' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow()).assertEqual(false); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_voicemail_query_test_1500: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_batchinsert_test_1900 - * @tc.name Abnormal use cases, when inserting data in batches, some of them failed, check the processing logic - * @tc.desc Function test - */ - it("abnormal_voicemail_batchinsert_test_1900", 0, async function (done) { - console.info("--------logMessage abnormal_voicemail_batchinsert_test_1900 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "phone_number": "5555555555", "ring_duration": "500" - }; - var addBulkValue2 = { - "phone_number": "1511002", "ring_duration": "100" - }; - var addBulkValue3 = { - "phone_numbers": "1521003", "ring_duration": "100" - }; - var addBulkValue4 = { - "phone_number": "1521004", "ring_durations": "100" - }; - var addBulkValue5 = { - "phone_number": "1521005", "ring_duration": "100" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk) - console.info("logMessage abnormal_voicemail_batchinsert_test_1900: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - done(); - } catch (error) { - console.info('logMessage abnormal_voicemail_batchinsert_test_1900: batchInsert error = ' + error); - done(); - } - }); - - /** - * @tc.number voiceMail_delete_test_2000 - * @tc.name batchDelete - * @tc.desc Function test - */ - it("voiceMail_delete_test_2000", 0, async function (done) { - console.info("--------logMessage voiceMail_delete_test_2000 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var voiceMailId = await DAHelper.insert(voicemailUri, common.getVoiceMail()); - console.info("logMessage voiceMail_delete_test_2000: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - var map = common.getVoiceMailMap() - map.set("id", voiceMailId.toString()); - await voiceMailQuery(map, "voiceMail_delete_test_2000"); - await executeBatch(); - } catch (error) { - console.info("logMessage voiceMail_delete_test_2000: voiceMailId insert error = " + error); - done(); - } - async function executeBatch() { - console.info("logMessage voiceMail_delete_test_2000: executeBatch start "); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voiceMailId.toString()); - DAHelper.executeBatch(URI_VOICEMAIL, [{ - uri: voicemailUri, - type: featureAbility.DataAbilityOperationType.TYPE_DELETE, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage voiceMail_delete_test_2000: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage voiceMail_delete_test_2000: data_3 = " + data); - console.info("logMessage voiceMail_delete_test_2000: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number voiceMail_update_test_2100 - * @tc.name batchUpdate - * @tc.desc Function test - */ - it("voiceMail_update_test_2100", 0, async function (done) { - console.info("--------logMessage voiceMail_update_test_2100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var voiceMailId = await DAHelper.insert(voicemailUri, common.getVoiceMail()); - console.info("logMessage voiceMail_update_test_2100: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - var map = common.getVoiceMailMap(); - map.set("id", voiceMailId.toString()); - await voiceMailQuery(map, "voiceMail_update_test_2100"); - await executeBatch(); - } catch (error) { - console.info("logMessage voiceMail_update_test_2100: calllog insert error = " + error); - done(); - } - async function executeBatch() { - var updateValues = { - "phone_number": "123456789" - }; - console.info("logMessage voiceMail_update_test_2100: executeBatch start "); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voiceMailId.toString()); - DAHelper.executeBatch(URI_VOICEMAIL, [{ - uri: voicemailUri, - type: featureAbility.DataAbilityOperationType.TYPE_UPDATE, - valuesBucket: updateValues, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage voiceMail_update_test_2100: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage voiceMail_update_test_2100: data_3 = " + data); - console.info("logMessage voiceMail_update_test_2100: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number voicemail_insert_test_2200 - * @tc.name Insert voicemail status 0 - * @tc.desc Function test - */ - it("voicemail_insert_test_2200", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_2200 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "1557544452542200", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - console.info("logMessage voicemail_insert_test_2200: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("phone_number", "1557544452542200"); - map.set("voice_status", "0"); - await voiceMailQuery(map, "voicemail_insert_test_2200"); - await voiceMailDelete("voicemail_insert_test_2200"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_2200: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_2300 - * @tc.name Insert 3 pieces of voice mail data first, then delete 2 pieces of data, - * and verify whether the deletion is successful - * @tc.desc Function test - */ - it("voicemail_insert_test_2300", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_2300 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "155754445254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdOne = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdTwo = await DAHelper.insert(voicemailUri, stringValue) - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - condition.or(); - condition.equalTo("id", voicemailIdOne.toString()); - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info("logMessage voicemail_insert_test_2300: deleteCode = " + deleteCode); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - await voiceMailDelete("voicemail_insert_test_2300"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_2300: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_2400 - * @tc.name Insert 3 pieces of voice mail data first, then update 2 pieces of data, - * and verify whether the deletion is successful - * @tc.desc Function test - */ - it("voicemail_insert_test_2400", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_2400 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "155754445254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdOne = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdTwo = await DAHelper.insert(voicemailUri, stringValue) - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - condition.or(); - condition.equalTo("id", voicemailIdOne.toString()); - var updateValue = { - "phone_number": "14541555754445254", "voice_status": 1 - }; - var updateCode = await DAHelper.update(voicemailUri, updateValue, condition); - console.info("logMessage voicemail_insert_test_2400: deleteCode = " + updateCode); - - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("phone_number", "14541555754445254"); - map.set("voice_status", "1"); - await voiceMailQuery(map, "voicemail_insert_test_2400"); - - var mapOne = new Map(); - mapOne.set("id", voicemailIdOne.toString()); - mapOne.set("phone_number", "14541555754445254"); - mapOne.set("voice_status", "1"); - await voiceMailQuery(mapOne, "voicemail_insert_test_2400"); - await voiceMailDelete("voicemail_insert_test_2400"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_2400: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_2500 - * @tc.name Query the voice mailbox with status 0 or id and return the query result - * @tc.desc Function test - */ - it("voicemail_query_test_2500", 0, async function (done) { - console.info("---------logMessage voicemail_query_test_2500 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - var stringValue = { - "phone_number": "4454445254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdOne = await DAHelper.insert(voicemailUri, stringValue) - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.beginWrap(); - condition.equalTo("id", voicemailId.toString()); - condition.or(); - condition.equalTo("id", voicemailIdOne.toString()); - condition.endWrap(); - condition.and(); - condition.equalTo("voice_status", "0"); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 2).assertTrue(); - resultSet.close(); - await voiceMailDelete("voicemail_query_test_2500"); - done(); - } catch (error) { - console.info("logMessage voicemail_query_test_2500: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_query_test_2600 - * @tc.name Query the voice mailbox and return the query result - * @tc.desc Function test - */ - it("voicemail_query_test_2600", 0, async function (done) { - console.info("---------logMessage voicemail_query_test_2600 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - var stringValue = { - "phone_number": "445444445254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue); - console.info('voicemail_query_test_2600 voicemailId = ' + voicemailId); - var voicemailIdOne = await DAHelper.insert(voicemailUri, stringValue); - console.info('voicemail_query_test_2600 voicemailIdOne = ' + voicemailIdOne); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 2).assertTrue(); - resultSet.close(); - await voiceMailDelete("voicemail_query_test_2600"); - done(); - } catch (error) { - console.info("logMessage voicemail_query_test_2600: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_insert_test_2700 - * @tc.name When the voicemail status is added, a non-existent field is passed in - * @tc.desc Function test - */ - it("abnormal_voicemail_insert_test_2700", 0, async function (done) { - console.info("---------logMessage abnormal_voicemail_insert_test_2700 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var insertValues = { - display_name: "2700name", voice_statuss: "1" - }; - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - expect(voicemailId == -1).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - await voiceMailDelete("abnormal_voicemail_insert_test_2700"); - done(); - } catch (error) { - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_delete_test_2800 - * @tc.name When deleting the voicemail status, pass in a non-existent field - * @tc.desc Function test - */ - it("abnormal_voicemail_delete_test_2800", 0, async function (done) { - console.info("---------logMessage abnormal_voicemail_delete_test_2800 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var insertValues = { - display_name: "2800name", voice_status: "1" - }; - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - expect(voicemailId > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - var updateValues = { - display_name: "2800name", voice_statuss: "0" - }; - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - expect(updateCode == -1).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("display_name", "2800name"); - map.set("voice_status", "1"); - await voiceMailQuery(map, "abnormal_voicemail_delete_test_2800"); - await voiceMailDelete("abnormal_voicemail_delete_test_2800"); - done(); - } catch (error) { - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_update_test_2900 - * @tc.name When update the voicemail status, pass in a non-existent field - * @tc.desc Function test - */ - it("abnormal_voicemail_update_test_2900", 0, async function (done) { - console.info("---------logMessage abnormal_voicemail_update_test_2900 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var insertValues = { - display_name: "2900name", voice_status: "1" - }; - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - expect(voicemailId > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - var updateValues = { - display_name: "2900name", voice_statuss: "0" - }; - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - expect(updateCode == -1).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("display_name", "2900name"); - map.set("voice_status", "1"); - await voiceMailQuery(map, "abnormal_voicemail_update_test_2900"); - await voiceMailDelete("abnormal_voicemail_update_test_2900"); - done(); - } catch (error) { - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_update_test_3000 - * @tc.name When update the voicemail status, pass in a non-existent field - * @tc.desc Function test - */ - it("abnormal_voicemail_update_test_3000", 0, async function (done) { - console.info("---------logMessage abnormal_voicemail_update_test_3000 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var insertValues = { - display_name: "2900name", voice_status: "1" - }; - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - expect(voicemailId > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", voicemailId.toString()); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == -1).assertTrue(); - resultSet.close(); - await voiceMailDelete("abnormal_voicemail_update_test_3000"); - done(); - } catch (error) { - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_batchInsert_test_3100 - * @tc.name Insert voicemail data in batches , pass in a non-existent field - * @tc.desc Function test - */ - it("abnormal_voicemail_batchInsert_test_3100", 0, async function (done) { - console.info("-------------logMessage abnormal_voicemail_batchInsert_test_3100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "voice_status": "0", "display_name": "xiaoming" - }; - var insertValuesTwo = { - "voice_status": "1", "display_name": "xiaohei" - }; - var insertValuesThree = { - "voice_statusss": "1", "display_name": "xiaohong" - }; - var insertValuesFour = { - "voice_status": "0", "display_name": "xiaohei" - }; - var insertValuesFive = { - "voice_status": "0", "display_name": "xiaofen" - }; - var listAddBluk = []; - listAddBluk[0] = insertValuesOne; - listAddBluk[1] = insertValuesTwo; - listAddBluk[2] = insertValuesThree; - listAddBluk[3] = insertValuesFour; - listAddBluk[4] = insertValuesFive; - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - console.info("logMessage abnormal_voicemail_batchInsert_test_3100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_batchInsert_test_3100: batchInsert error = " + error); - done(); - } - }); - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('voicemai afterAll logMessage get DAHelper success! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info('voicemai afterAll logMessage deleteCode = ' + deleteCode); - }); - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/common.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/common.js deleted file mode 100644 index 2baf2262c2f528455b609f5c593ba85cbad226ce..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/common.js +++ /dev/null @@ -1,726 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const contactUri = "dataability:///com.ohos.contactsdataability/contacts/contact"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; -const groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; -const contactBlocklistUri = "dataability:///com.ohos.contactsdataability/contacts/contact_blocklist"; -const deletedRawContactUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; -const profileRawContactUri = "dataability:///com.ohos.contactsdataability/profile/raw_contact"; -const profilecontactUri = "dataability:///com.ohos.contactsdataability/profile/contact"; -const profileContactDataUri = "dataability:///com.ohos.contactsdataability/profile/contact_data"; -const profileGroupUri = "dataability:///com.ohos.contactsdataability/profile/groups"; -const profileBlocklistUri = "dataability:///com.ohos.contactsdataability/profile/contact_blocklist"; -const profileDeletedContactsUri = "dataability:///com.ohos.contactsdataability/profile/deleted_raw_contact"; - -const URI_CALLLOG = "dataability:///com.ohos.calllogability"; -const calllogUri = "dataability:///com.ohos.calllogability/calls/calllog"; - -export default { - data: {}, - getCallLogInsertMap: - function () { - var calllogInsert100Map = new Map([ - ["phone_number", "123456789"], ["display_name", "xxw"], ["voicemail_uri", "uri"], - ["sim_type", "1"], ["is_hd", "2"], ["is_read", "1"], ["ring_duration", "900"], - ["talk_duration", "200"], ["format_number", "123 456 789"], ["quicksearch_key", "2"], - ["number_type", "2"], ["number_type_name", "tian"], ["begin_time", "200"], ["end_time", "300"], - ["answer_state", "1"], ["create_time", "400"], ["number_location", "dizhi"], ["photo_id", "1"], - ["photo_uri", "666"], ["country_iso_code", "2"], ["extra1", "test1"], ["extra2", "test2"], - ["extra3", "test3"], ["extra4", "test4"], ["extra5", "test5"], ["extra6", "test6"] - ]); - return calllogInsert100Map; - }, - getCallLogInsert: - function () { - var calllogInsert100 = { - "phone_number": "123456789", - "display_name": "xxw", - "voicemail_uri": "uri", - "sim_type": 1, - "is_hd": 2, - "is_read": 1, - "ring_duration": 900, - "talk_duration": 200, - "format_number": "123 456 789", - "quicksearch_key": "2", - "number_type": 2, - "number_type_name": "tian", - "begin_time": 200, - "end_time": 300, - "answer_state": 1, - "create_time": 400, - "number_location": "dizhi", - "photo_id": 1, - "photo_uri": "666", - "country_iso_code": 2, - "extra1": "test1", - "extra2": "test2", - "extra3": "test3", - "extra4": "test4", - "extra5": "test5", - "extra6": "test6", - }; - return calllogInsert100; - }, - getCallLogResultColumns: - function () { - var resultColumns = [ - "id", "phone_number", "display_name", "call_direction", "voicemail_uri", "sim_type", "is_hd", "is_read", - "ring_duration", "talk_duration", "format_number", "quicksearch_key", "number_type", "number_type_name", - "begin_time", "end_time", "answer_state", "create_time", "number_location", "photo_id", "photo_uri", - "country_iso_code", "extra1", "extra2", "extra3", "extra4", "extra5", "extra6" - ]; - return resultColumns; - }, - getCallLogUpdate: - function () { - var updateValues = { - "phone_number": "987654321", - "display_name": "6666", - "voicemail_uri": "7777", - "sim_type": 4, - "is_hd": 4, - "is_read": 4, - "ring_duration": 400, - "talk_duration": 400, - "format_number": "987 654 321", - "quicksearch_key": "4", - "number_type": 4, - "number_type_name": "4tian", - "begin_time": 400, - "end_time": 400, - "answer_state": 4, - "create_time": 40000, - "number_location": "4dizhi", - "photo_id": 4, - "photo_uri": "4444", - "country_iso_code": 4, - "extra1": "test7", - "extra2": "test7", - "extra3": "test7", - "extra4": "test7", - "extra5": "test7", - "extra6": "test7", - }; - return updateValues; - }, - getCallLogUpdateMap: - function () { - var calllogInsert100Map = new Map([ - ["phone_number", "987654321"], ["display_name", "6666"], ["voicemail_uri", "7777"], - ["sim_type", "4"], ["is_hd", "4"], ["is_read", "4"], ["ring_duration", "400"], - ["talk_duration", "400"], ["format_number", "987 654 321"], ["quicksearch_key", "4"], - ["number_type", "4"], ["number_type_name", "4tian"], ["begin_time", "400"], ["end_time", "400"], - ["answer_state", "4"], ["create_time", "40000"], ["number_location", "4dizhi"], - ["photo_id", "4"], ["photo_uri", "4444"], ["country_iso_code", "4"], ["extra1", "test7"], - ["extra2", "test7"], ["extra3", "test7"], ["extra4", "test7"], ["extra5", "test7"], - ["extra6", "test7"] - ]); - return calllogInsert100Map; - }, - getCallLogBatchInsert: - function () { - var map = new Map([["phone_number", "1600"], ["ring_duration", "333"]]); - var map2 = new Map([["phone_number", "1600"], ["ring_duration", "600"]]); - var map3 = new Map([["phone_number", "1600"], ["ring_duration", "600"]]); - var map4 = new Map([["phone_number", "1600"], ["ring_duration", "600"]]); - var map5 = new Map([["phone_number", "1600"], ["ring_duration", "600"]]); - var array = [map, map2, map3, map4, map5]; - return array; - }, - getProfileRawContact: - function () { - var rawContact = { - "photo_id": 2, - "photo_file_id": 3, - "is_transfer_voicemail": 1, - "personal_ringtone": "test", - "is_deleted": 0, - "personal_notification_ringtone": "666", - "photo_first_name": "7777", - "account_id": 1, - "version": 1, - "sort": "6666", - "contacted_count": 2, - "lastest_contacted_time": 2, - "favorite": 1, - "favorite_order": "test", - "phonetic_name": "testname", - "phonetic_name_type": 1, - "display_name": "licheng", - "company": "TTTTT", - "position": "Developer", - "read_only": 2, - "sort_first_letter": "testsort", - "sync_id": 8, - "syn_1": "syn_1", - "syn_2": "syn_2", - "syn_3": "syn_3", - }; - return rawContact; - }, - getProfileRawContactMap: - function () { - var rawContactMap = new Map([ - ["photo_id", "2"], ["photo_file_id", "3"], ["is_transfer_voicemail", "1"], - ["personal_ringtone", "test"], ["is_deleted", "0"], - [ - "personal_notification_ringtone", - "666", - ], - [ - "photo_first_name", - "7777", - ], - ["account_id", "1"], ["version", "1"], ["sort", "6666"], ["contacted_count", "2"], - ["lastest_contacted_time", "2"], ["favorite", "1"], ["favorite_order", "test"], - ["phonetic_name", "testname"], ["phonetic_name_type", "1"], ["display_name", "licheng"], - ["company", "TTTTT"], ["position", "Developer"], ["read_only", "2"], - ["sort_first_letter", "testsort"], ["merge_mode", "0"], ["is_need_merge", "1"], - ["merge_status", "1"], ["is_merge_target", "0"], ["vibration_setting", "0"], ["sync_id", "8"], - ["syn_1", "syn_1"], ["syn_2", "syn_2"], ["syn_3", "syn_3"] - ]); - return rawContactMap; - }, - getProfileRawContactUpdate: - function () { - var rawContact = { - "photo_id": 21, - "photo_file_id": 31, - "is_transfer_voicemail": 11, - "personal_ringtone": "test1", - "is_deleted": 0, - "personal_notification_ringtone": "6661", - "photo_first_name": "77771", - "account_id": 1, - "sort": "66661", - "contacted_count": 21, - "lastest_contacted_time": 21, - "favorite": 11, - "favorite_order": "test1", - "phonetic_name": "testname1", - "phonetic_name_type": 11, - "display_name": "licheng1", - "company": "TTTTT1", - "position": "Developer1", - "read_only": 21, - "sort_first_letter": "testsort1", - "sync_id": 81, - "syn_1": "syn_11", - "syn_2": "syn_21", - "syn_3": "syn_31", - }; - return rawContact; - }, - getProfileRawContactUpdateMap: - function () { - var rawContactMap = new Map([ - ["photo_id", "21"], ["photo_file_id", "31"], ["is_transfer_voicemail", "11"], - ["personal_ringtone", "test1"], ["is_deleted", "0"], - [ - "personal_notification_ringtone", - "6661", - ], - [ - "photo_first_name", - "77771", - ], - ["account_id", "1"], ["version", "1"], ["sort", "66661"], ["contacted_count", "21"], - ["lastest_contacted_time", "21"], ["favorite", "11"], ["favorite_order", "test1"], - ["phonetic_name", "testname1"], ["phonetic_name_type", "11"], ["display_name", "licheng1"], - ["company", "TTTTT1"], ["position", "Developer1"], ["read_only", "21"], - ["sort_first_letter", "testsort1"], ["merge_mode", "0"], ["is_need_merge", "1"], - ["merge_status", "1"], ["is_merge_target", "0"], ["vibration_setting", "0"], ["sync_id", "81"], - ["syn_1", "syn_11"], ["syn_2", "syn_21"], ["syn_3", "syn_31"] - ]); - return rawContactMap; - }, - getProfileContactData: - function () { - var contactData = { - "content_type": "name", - "detail_info": "xiaocai", - "family_name": "family_name", - "middle_name_phonetic": "middle_name_phonetic", - "given_name": "given_name", - "given_name_phonetic": "given_name_phonetic", - "alias_detail_info": "alias_detail_info", - "phonetic_name": "phonetic_name", - "position": "Developer", - "extend1": "extend1", - "extend2": "extend2", - "extend3": "extend3", - "extend4": "extend4", - "city": "city", - "country": "country", - "neighborhood": "neighborhood", - "pobox": "pobox", - "postcode": "postcode", - "region": "region", - "street": "street", - "alpha_name": "alpha_name", - "other_lan_last_name": "other_lan_last_name", - "other_lan_first_name": "other_lan_first_name", - "extend5": "extend5", - "lan_style": "lan_style", - "custom_data": "custom_data", - "extend6": "extend6", - "extend7": "extend7", - "blob_data": "blob_data", - "syn_1": "syn_1", - "syn_2": "syn_2", - "syn_3": "syn_3", - }; - return contactData; - }, - getProfileContactDataMap: - function () { - var ContactDataMap = new Map([ - ["detail_info", "xiaocai"], ["family_name", "family_name"], - ["middle_name_phonetic", "middle_name_phonetic"], ["given_name", "given_name"], - ["given_name_phonetic", "given_name_phonetic"], ["alias_detail_info", "alias_detail_info"], - ["phonetic_name", "phonetic_name"], ["position", "position"], ["extend1", "extend1"], - ["extend2", "extend2"], ["pobox", "pobox"], ["postcode", "postcode"], ["city", "city"], - ["country", "country"], ["neighborhood", "neighborhood"], - [ - "position", - "Developer", - ], - ["region", "region"], ["street", "street"], ["alpha_name", "alpha_name"], - ["other_lan_last_name", "other_lan_last_name"], ["other_lan_first_name", "other_lan_first_name"], - ["extend5", "extend5"], ["lan_style", "lan_style"], ["custom_data", "custom_data"], - ["extend6", "extend6"], ["extend7", "extend7"], ["blob_data", "blob_data"], ["syn_1", "syn_1"], - [ - "syn_2", - "syn_2", - ], - [ - "syn_3", - "syn_3", - ], - ["read_only", "0"], ["version", "0"], ["is_preferred_number", "0"] - ]); - return ContactDataMap; - }, - getProfileContactDataUpdate: - function () { - var contactData = { - "detail_info": "xiaocai1", - "family_name": "family_name1", - "middle_name_phonetic": "middle_name_phonetic1", - "given_name": "given_name1", - "given_name_phonetic": "given_name_phonetic1", - "alias_detail_info": "alias_detail_info1", - "phonetic_name": "phonetic_name1", - "position": "Developer1", - "extend1": "extend11", - "extend2": "extend21", - "extend3": "extend31", - "extend4": "extend41", - "city": "city1", - "country": "country1", - "neighborhood": "neighborhood1", - "pobox": "pobox1", - "postcode": "postcode1", - "region": "region1", - "street": "street1", - "alpha_name": "alpha_name1", - "other_lan_last_name": "other_lan_last_name1", - "other_lan_first_name": "other_lan_first_name1", - "extend5": "extend51", - "lan_style": "lan_style1", - "custom_data": "custom_data1", - "extend6": "extend61", - "extend7": "extend71", - "blob_data": "blob_data1", - "syn_1": "syn_11", - "syn_2": "syn_21", - "syn_3": "syn_31", - }; - return contactData; - }, - getProfileContactDataUpdateMap: - function () { - var ContactDataMap = new Map([ - ["detail_info", "xiaocai1"], ["family_name", "family_name1"], - ["middle_name_phonetic", "middle_name_phonetic1"], ["given_name", "given_name1"], - ["given_name_phonetic", "given_name_phonetic1"], ["alias_detail_info", "alias_detail_info1"], - ["phonetic_name", "phonetic_name1"], ["position", "position1"], ["extend1", "extend11"], - ["extend2", "extend21"], ["pobox", "pobox1"], ["postcode", "postcode1"], ["city", "city1"], - ["country", "country1"], ["neighborhood", "neighborhood1"], - [ - "position", - "Developer1", - ], - ["region", "region1"], ["street", "street1"], ["alpha_name", "alpha_name1"], - ["other_lan_last_name", "other_lan_last_name1"], ["other_lan_first_name", "other_lan_first_name1"], - ["extend5", "extend51"], ["lan_style", "lan_style1"], ["custom_data", "custom_data1"], - ["extend6", "extend61"], ["extend7", "extend71"], ["blob_data", "blob_data1"], - ["syn_1", "syn_11"], - [ - "syn_2", - "syn_21", - ], - [ - "syn_3", - "syn_31", - ], - ["read_only", "0"], ["version", "1"], ["is_preferred_number", "0"] - ]); - return ContactDataMap; - }, - getProfileGroup: - function () { - var group = { - "account_id": 1, - "group_name": "DeveloperFirsthGroup", - "group_notes": "note", - "group_ringtone": "test" - }; - return group; - }, - getProfileGroupMap: - function () { - var groupMap = new Map([ - ["account_id", "1"], ["group_name", "DeveloperFirsthGroup"], ["group_notes", "note"], - ["is_deleted", "0"], ["group_ringtone", "test"], ["ringtone_modify_time", "0"], - ["lastest_modify_time", "0"] - ]); - return groupMap; - }, - getProfileBlockList: - function () { - var blockList = { - "phone_number": "123456789", "content": "heimingdan" - }; - return blockList; - }, - getProfileBlockListMap: - function () { - var blockListMap = new Map([ - ["types", "0"], ["phone_number", "123456789"], ["content", "heimingdan"], ["time_stamp", "0"] - ]); - return blockListMap; - }, - getProfileUpdateRawContact: - function () { - var rawContact = { - "photo_id": 8, - "photo_file_id": 8, - "is_transfer_voicemail": 8, - "personal_ringtone": "test8", - "is_deleted": 1, - "personal_notification_ringtone": "888", - "photo_first_name": "9999", - "account_id": 8, - "version": 2, - "sort": "8888", - "contacted_count": 8, - "lastest_contacted_time": 8, - "favorite": 0, - "favorite_order": "test8", - "phonetic_name": "testname8", - "phonetic_name_type": 8, - "display_name": "licheng8", - "company": "TTTTT8", - "position": "Developer8", - "read_only": 8, - "sort_first_letter": "testsort8", - "sync_id": 888, - "syn_1": "syn_8", - "syn_2": "syn_8", - "syn_3": "syn_8", - }; - return rawContact; - }, - getProfileUpdateRawContactMap: - function () { - var rawContactMap = new Map([ - ["photo_id", "8"], ["photo_file_id", "8"], ["is_transfer_voicemail", "8"], - ["personal_ringtone", "test8"], ["is_deleted", "1"], - [ - "personal_notification_ringtone", - "888", - ], - [ - "photo_first_name", - "9999", - ], - ["account_id", "8"], ["version", "2"], ["sort", "8888"], ["contacted_count", "8"], - ["lastest_contacted_time", "8"], ["favorite", "0"], ["favorite_order", "test8"], - ["phonetic_name", "testname8"], ["phonetic_name_type", "8"], ["display_name", "licheng8"], - ["company", "TTTTT8"], ["position", "Developer8"], ["read_only", "8"], - ["sort_first_letter", "testsort8"], ["merge_mode", "0"], ["is_need_merge", "1"], - ["merge_status", "1"], ["is_merge_target", "0"], ["vibration_setting", "0"], ["sync_id", "888"], - ["syn_1", "syn_8"], ["syn_2", "syn_8"], ["syn_3", "syn_8"] - ]); - return rawContactMap; - }, - getProfileUpdateContactData: - function () { - var contactData = { - "detail_info": "BossCai", - "family_name": "family_name8", - "middle_name_phonetic": "middle_name_phonetic8", - "given_name": "given_name8", - "given_name_phonetic": "given_name_phonetic8", - "alias_detail_info": "alias_detail_info8", - "phonetic_name": "phonetic_name8", - "position": "position8", - "extend1": "extend8", - "extend2": "extend8", - "extend3": "extend8", - "extend4": "extend8", - "country": "country8", - "neighborhood": "neighborhood8", - "pobox": "pobox8", - "city": "city8", - "postcode": "postcode8", - "region": "region8", - "street": "street8", - "alpha_name": "alpha_name8", - "other_lan_last_name": "other_lan_last_name8", - "other_lan_first_name": "other_lan_first_name8", - "extend5": "extend8", - "lan_style": "lan_style8", - "custom_data": "custom_data8", - "extend6": "extend8", - "extend7": "extend8", - "blob_data": "blob_data8", - "syn_1": "syn_8", - "syn_2": "syn_8", - "syn_3": "syn_8" - }; - return contactData; - }, - getProfileUpdateContactDataMap: - function () { - var ContactDataMap = new Map([ - ["detail_info", "BossCai"], ["family_name", "family_name8"], - ["middle_name_phonetic", "middle_name_phonetic8"], ["given_name", "given_name8"], - ["given_name_phonetic", "given_name_phonetic8"], ["alias_detail_info", "alias_detail_info8"], - ["phonetic_name", "phonetic_name8"], ["position", "position8"], ["extend1", "extend8"], - ["extend2", "extend8"], ["pobox", "pobox8"], ["postcode", "postcode8"], ["city", "city8"], - ["country", "country8"], ["neighborhood", "neighborhood8"], - [ - "position", - "position8", - ], - ["region", "region8"], ["street", "street8"], ["alpha_name", "alpha_name8"], - ["other_lan_last_name", "other_lan_last_name8"], ["other_lan_first_name", "other_lan_first_name8"], - ["extend5", "extend8"], ["lan_style", "lan_style8"], ["custom_data", "custom_data8"], - ["extend6", "extend8"], ["extend7", "extend8"], ["blob_data", "blob_data8"], ["syn_1", "syn_8"], - [ - "syn_2", - "syn_8", - ], - [ - "syn_3", - "syn_8", - ], - ["read_only", "0"], ["version", "1"], ["is_preferred_number", "0"] - ]); - return ContactDataMap; - }, - getProfileUpdateGroup: - function () { - var group = { - "account_id": 8, - "group_name": "TestFifthGroup", - "group_notes": "note8", - "group_ringtone": "test8" - }; - return group; - }, - getProfileUpdateGroupMap: - function () { - var groupMap = new Map([ - ["account_id", "8"], ["group_name", "TestFifthGroup"], ["group_notes", "note8"], - ["is_deleted", "0"], ["group_ringtone", "test8"], ["ringtone_modify_time", "0"], - ["lastest_modify_time", "0"] - ]); - return groupMap; - }, - getProfileUpdateBlockList: - function () { - var blockList = { - "phone_number": "987654321", - "content": "danminghei", - }; - return blockList; - }, - getProfileUpdateBlockListMap: - function () { - var blockListMap = new Map([ - ["types", "0"], ["phone_number", "987654321"], ["content", "danminghei"], ["time_stamp", "0"] - ]); - return blockListMap; - }, - getVoiceMail: - function () { - var voicemail = { - "phone_number": "66666", - "quicksearch_key": "777", - "display_name": "xiaoli", - "voicemail_uri": "XXXX", - "origin_type": "xxxxx", - "create_time": 0 - }; - return voicemail; - }, - getVoiceMailMap: - function () { - var map = new Map([ - ["phone_number", "66666"], ["quicksearch_key", "777"], ["display_name", "xiaoli"], - ["voicemail_uri", "XXXX"], ["origin_type", "xxxxx"], ["create_time", "0"], - ["voicemail_type", "0"], ["voice_file_size", "0"], ["voice_duration", "0"], - ["voice_status", "0"] - ]); - return map; - }, - getVoiceMailUpdate: - function () { - var voicemail = { - "phone_number": "9999999", - "quicksearch_key": "999", - "display_name": "xiaocai", - "voicemail_uri": "uuuu", - "origin_type": "iiiii", - "create_time": "999" - }; - return voicemail; - }, - getVoiceMailUpdateMap: - function () { - var map = new Map([ - ["phone_number", "9999999"], ["quicksearch_key", "999"], ["display_name", "xiaocai"], - ["voicemail_uri", "uuuu"], ["origin_type", "iiiii"], ["create_time", "999"], - ["voicemail_type", "0"], ["voice_file_size", "0"], ["voice_duration", "0"], - ["voice_status", "0"] - ]); - return map; - }, - getvoiceMailBatchInsert: - function () { - var map = new Map([["phone_number", "1600"], ["display_name", "xiaoming"], ["voice_status", "0"]]); - var map2 = new Map([["phone_number", "1600"], ["display_name", "xiaohei"], ["voice_status", "1"]]); - var map3 = new Map([["phone_number", "1600"], ["display_name", "xiaohong"], ["voice_status", "0"]]); - var map4 = new Map([["phone_number", "1600"], ["display_name", "xiaohei"], ["voice_status", "0"]]); - var map5 = new Map([["phone_number", "1600"], ["display_name", "xiaofen"], ["voice_status", "0"]]); - var array = [map, map2, map3, map4, map5]; - return array; - }, - getContactBatchCompany: - function () { - var rawContactValuesOne = { - "display_name": "fengyuanyuan", "company": "TT4900", "position": "Testers" - }; - var rawContactValuesTwo = { - "display_name": "caiboss", "company": "TT4900", "position": "developer" - }; - var rawContactValuesThree = { - "display_name": "zhangsan", "company": "TT4900", "position": "developer" - }; - var rawContactValuesFour = { - "display_name": "lisi", "company": "TT4900", "position": "developer" - }; - var rawContactValuesFive = { - "display_name": "wangwu", "company": "TT4900", "position": "developer" - }; - var listAddBluk = []; - listAddBluk[0] = rawContactValuesOne; - listAddBluk[1] = rawContactValuesTwo; - listAddBluk[2] = rawContactValuesThree; - listAddBluk[3] = rawContactValuesFour; - listAddBluk[4] = rawContactValuesFive; - return listAddBluk; - }, - getContactBatchCompanyTwo: - function () { - var contactDataValuesOne = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaozhi" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "Testers" - }; - var contactDataValuesThree = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "15844@163.com" - }; - var contactDataValuesFour = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaozhicheng" - }; - var contactDataValuesFive = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "111885566" - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - listAddBluk[2] = contactDataValuesThree; - listAddBluk[3] = contactDataValuesFour; - listAddBluk[4] = contactDataValuesFive; - return listAddBluk; - }, - getPhoneNumberBatch: - function () { - var contactBlacklistValuesOne = { - "phone_number": "85525040585400" - }; - var contactBlacklistValuesTwo = { - "phone_number": "85525040585400" - }; - var contactBlacklistValuesThree = { - "phone_number": "85525040585400" - }; - var contactBlacklistValuesFour = { - "phone_number": "85525040585400" - }; - var contactBlacklistValuesFive = { - "phone_number": "85525040585400" - }; - var listAddBluk = [] - listAddBluk[0] = contactBlacklistValuesOne; - listAddBluk[1] = contactBlacklistValuesTwo; - listAddBluk[2] = contactBlacklistValuesThree; - listAddBluk[3] = contactBlacklistValuesFour; - listAddBluk[4] = contactBlacklistValuesFive; - return listAddBluk; - }, - getSearchMap: - function () { - var map = new Map([ - ["account_id", "1"], ["search_name", "小黄||xiaohuang||xh"], ["display_name", "小黄"], - ["phonetic_name", ""], ["photo_id", ""], ["photo_file_id", ""] - ]); - return map; - } -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/recovery_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/recovery_test.js deleted file mode 100644 index 36c5d3b6607d504f29dabec2fd115dbc9f00bbfa..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/recovery_test.js +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const backup = "dataability:///com.ohos.contactsdataability/contacts/backup"; -const recover = "dataability:///com.ohos.contactsdataability/contacts/recover"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; - -export default function RecoveryTest() { - describe('RecoveryTest', function () { - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - async function contactsQuery(tag, uri, size) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - console.info(tag + ' contactsQuery resultSet.rowCount is = ' + resultSet.rowCount); - console.info(tag + ' contactsQuery size is = ' + size); - expect(resultSet.rowCount == size).assertEqual(true); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("id")); - console.info(tag + ':logMessage contactsQuery id = ' + id); - var name = resultSet.getString(resultSet.getColumnIndex("display_name")); - console.info(tag + ':logMessage contactsQuery name = ' + name); - } while (resultSet.goToNextRow()) - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - async function rawContactInsert(name) { - console.info("------logMessage rawContactInsert is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValue = { - "display_name": name, - } - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertValue); - console.info('logMessage rawContactInsert: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info('logMessage rawContactInsert: insert error = ' + error); - } - return rawContactId; - } - - async function deleteRawContact(tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - await DAHelper.delete(rawContactUri, condition); - sleep(5000); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - await DAHelper.delete(deletedUri, conditionAll); - } catch (error) { - console.info(tag + ': deleteRawContact error = ' + error); - } - } - - /** - * @tc.number recovery_test_100 - * @tc.name backup database - * @tc.desc Function test - */ - it("recovery_test_100", 0, async function (done) { - await deleteRawContact("recovery_test_100"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var updateValues = {}; - var condition = new ohosDataAbility.DataAbilityPredicates(); - try { - var updateCode = await DAHelper.update(backup, updateValues, condition); - sleep(2000); - console.info('logMessage recovery_test_100: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - sleep(2000); - await contactsQuery("recovery_test_100", rawContactUri, 0); - done(); - } catch (error) { - console.info('logMessage recovery_test_100: raw_contact update error = ' + error); - done(); - } - }); - - /** - * @tc.number recovery_test_200 - * @tc.n ame recovery database - * @tc.desc Function test - */ - it("recovery_test_200", 0, async function (done) { - await deleteRawContact("recovery_test_200"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var updateValues = {}; - var condition = new ohosDataAbility.DataAbilityPredicates(); - rawContactInsert("liming"); - rawContactInsert("xiaolilili"); - sleep(2000); - var updateCode = await DAHelper.update(backup, updateValues, condition); - sleep(2000); - console.info(' recovery_test_200: backup = ' + updateCode); - expect(updateCode == 0).assertTrue(); - sleep(1000); - try { - var updateCode = await DAHelper.update(recover, updateValues, condition); - sleep(3000); - console.info('logMessage recovery_test_200: recover = ' + updateCode); - expect(updateCode == 0).assertTrue(); - await contactsQuery("recovery_test_200", rawContactUri, 2); - await deleteRawContact("recovery_test_200"); - done(); - } catch (error) { - console.info('logMessage recovery_test_200: raw_contact update error = ' + error); - done(); - } - }); - }); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function_merge/BUILD.gn b/telephony/telephonyjstest/contact_function_merge/BUILD.gn deleted file mode 100644 index 9203b26a2d6201bf440011a333b0f908d73ca8d3..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# 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("ActsContactFunctionMergeEtsTest") { - 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 = "ActsContactFunctionMergeEtsTest" -} -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" -} diff --git a/telephony/telephonyjstest/contact_function_merge/Test.json b/telephony/telephonyjstest/contact_function_merge/Test.json deleted file mode 100644 index a7eacfaa16f1ff1f427b1e024f93329c62c16f4f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1800000", - "package": "com.ohos.contactfunctionmerge", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsContactFunctionMergeEtsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/config.json b/telephony/telephonyjstest/contact_function_merge/entry/src/main/config.json deleted file mode 100644 index 0e0390baa552d723272d3bebb82d09703ede3428..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/config.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.contactfunctionmerge", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.contactfunctionmerge", - "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 diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 33a58e6a8de77a60e1d785efeecc9d736c7f8634..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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. - */ - -//contact import -import ContactMergeTest from './contact/ContactMerge_test.js' - -export default function testsuite() { - //contact - ContactMergeTest(); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/contact/ContactMerge_test.js b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/contact/ContactMerge_test.js deleted file mode 100644 index d67f66e69af1832e4a456bbfc150b532f44d9e46..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/contact/ContactMerge_test.js +++ /dev/null @@ -1,1873 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; - -const autoMergeUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact/auto_merge"; -const splitUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact/split_contact"; -const manualMergeUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact/manual_merge"; -const uriQueryMergeList = "dataability:///com.ohos.contactsdataability/contacts/raw_contact/query_merge_list"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; - -export default function ContactMergeTest() { - describe('ContactMergeTest', function () { - console.info("ContactMergeTest start!"); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - async function contactDataInsert1(DAHelper, rawContactIdFirst) { - var contactDataValues = { - "raw_contact_id": rawContactIdFirst, "content_type": "name", "detail_info": "xiaoli" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_auto_merge_and_spilt_test_100: contactDataId1 = " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100: contact_data_1 insert error = ' + error); - } - } - - async function contactDataInsert2(DAHelper, rawContactIdSecond) { - var contactDataValues = { - "raw_contact_id": rawContactIdSecond, "content_type": "name", "detail_info": "xiaoli" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_auto_merge_and_spilt_test_100: contactDataId2 = " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100: contact_data_2 insert error = ' + error); - } - } - - async function autoMerge(DAHelper, rawContactIdFirst) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - sleep(4000); - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - console.info("logMessage contact_auto_merge_and_spilt_test_100: autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_auto_merge_and_spilt_test_100", 2); - sleep(2000); - await contactSplit(DAHelper, rawContactIdFirst); - await deleteAll(rawContactUri, "contact_auto_merge_and_spilt_test_100"); - await deleteAll(contactDataUri, "contact_auto_merge_and_spilt_test_100"); - } catch (error) { - console.info("logMessage contact_auto_merge_and_spilt_test_100: auto_merge error = " + error); - } - } - - async function contactSplit(DAHelper, rawContactIdFirst) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var array = [rawContactIdFirst.toString()]; - condition2.in("raw_contact_id", array); - var updateValues2 = {}; - try { - var splitCode = await DAHelper.update(splitUri, updateValues2, condition2); - sleep(4000); - console.info('logMessage contact_auto_merge_and_spilt_test_100 splitCode = ' + splitCode); - expect(splitCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_auto_merge_and_spilt_test_100", 1); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100 split error = ' + error); - } - } - - async function deleteAll(uri, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(uri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } - - async function contactMergeQuery(map, tag, size) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ' : contactMergeQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["contact_id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - console.info(tag + ' : map_id = ' + map.get("id")); - condition.equalTo("id", map.get("id")); - try { - var resultSetID = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - var conatctID; - if (resultSetID.goToFirstRow()) { - do { - conatctID = resultSetID.getString(resultSetID.getColumnIndex("contact_id")); - console.info(tag + ' : contact_id = ' + conatctID); - } while (resultSetID.goToNextRow()); - } - resultSetID.close(); - var pre = new ohosDataAbility.DataAbilityPredicates(); - pre.equalTo("contact_id", conatctID); - var newResultColumns = []; - var resultSet = await DAHelper.query(rawContactUri, newResultColumns, pre); - sleep(1000); - console.info(tag + ' : contactMergeQuery start ! rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + " : logMessage contactMergeQuery: error = " + error); - } - } - - async function updateContactData(updateDataValue, contactDataId, testName) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var updateValues = { - "detail_info": updateDataValue - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - var code = await DAHelper.update(contactDataUri, updateValues, condition); - console.info(testName + " updateContactData: code = " + code); - sleep(3000); - } - - async function insertContactData(DAHelper, rawContactId, detailInfo, types, tag) { - var size = detailInfo.length; - for (var i = 0; i < size; i++) { - var contactDataValues = { - "raw_contact_id": rawContactId.toString(), - "content_type": types[i], - "detail_info": detailInfo[i] - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(2000); - expect(contactDataId > 0).assertTrue(); - console.info(tag + ' logMessage : insert contactDataId = ' + contactDataId); - } catch (error) { - console.info('logMessage : contact_data_1 insert error = ' + error); - } - } - } - - async function insertContactDataSingle(DAHelper, rawContactId, detailInfo, type) { - var size = detailInfo.length; - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": type, "detail_info": detailInfo - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info('logMessage : contact_data_1 insert error = ' + error); - } - return contactDataId1; - } - - async function manualMergeList(DAHelper, rawContactList, testName) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.in("raw_contact_id", rawContactList); - var updateValues2 = {}; - try { - var ManualMergeCode = await DAHelper.update(manualMergeUri, updateValues2, condition2); - sleep(1000); - console.info("logMessage " + testName + " ManualMergeCode = " + ManualMergeCode); - expect(ManualMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactList[0].toString()); - await contactMergeQuery(map, testName, rawContactList.length); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info("logMessage " + testName + " manual_merge error = " + error); - } - } - - /** - * @tc.number contact_autoMerge_and_spilt_test_100 - * @tc.name Two contacts without mobile phone number with the same name are automatically merged and split - * @tc.desc Function test - */ - it("contact_autoMerge_and_spilt_test_100", 0, async function (done) { - console.info("------logMessage contact_auto_merge_and_spilt_test_100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaoli" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_auto_merge_and_spilt_test_100: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await contactDataInsert1(DAHelper, rawContactIdFirst); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaoli" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_auto_merge_and_spilt_test_100: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await contactDataInsert2(DAHelper, rawContactIdSecond); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100: raw_contact_2 insert error = ' + error); - done(); - } - - await autoMerge(DAHelper, rawContactIdFirst); - done(); - }); - - /** - * @tc.number contact_manualMerge_test_200 - * @tc.name Two contacts with the same name, one with a mobile phone number and the other without a mobile phone - * number, call the manual merge interface - * @tc.desc Function test - */ - it("contact_manualMerge_test_200", 0, async function (done) { - console.info("------logMessage contact_manualMerge_test_200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaoming" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_manualMerge_test_200: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await manualMergeDataInsert(DAHelper, rawContactIdFirst); - } catch (error) { - console.info('logMessage contact_manualMerge_test_200: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaoming" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_200: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await manualMergeDataInsertTwo(DAHelper, rawContactIdSecond); - } catch (error) { - console.info('logMessage contact_manualMerge_test_200: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_2000"); - done(); - }); - - async function manualMergeDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdFirst, - "content_type": "name", - "detail_info": "xiaoming" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "123456789", - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_manualMerge_test_200: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_200: batch insert error = " + error) - } - } - - async function manualMergeDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValues = { - "raw_contact_id": rawContactIdSecond, "content_type": "name", "detail_info": "xiaoming" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_manualMerge_test_200: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_200: contact_data_2 insert error = " + error) - } - } - - /** - * @tc.number contact_autoMerge_test_300 - * @tc.name Two contacts with the same name have a mobile phone number, and the mobile phone numbers are the - * same. Call the automatic merge interface - * @tc.desc Function test - */ - it("contact_autoMerge_test_300", 0, async function (done) { - console.info("------logMessage contact_autoMerge_test_300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaohong" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_autoMerge_test_300: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await autoMergeDataInsert(DAHelper, rawContactIdFirst); - } catch (error) { - console.info('logMessage contact_autoMerge_test_300: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaohong" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_autoMerge_test_300: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await autoMergeDataInsertTwo(DAHelper, rawContactIdSecond); - } catch (error) { - console.info('logMessage contact_autoMerge_test_300: raw_contact_2 insert error = ' + error); - done(); - } - - await autoMerger(DAHelper, rawContactIdFirst, "contact_autoMerge_test_300"); - done(); - }); - - async function autoMergeDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdFirst, - "content_type": "name", - "detail_info": "xiaohong" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "123465", - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_autoMerge_test_300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_autoMerge_test_300: batch insert1 error = " + error) - } - } - - async function autoMergeDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValuesThree = { - "raw_contact_id": rawContactIdSecond, - "content_type": "name", - "detail_info": "xiaohong" - }; - var contactDataValuesFour = { - "raw_contact_id": rawContactIdSecond, - "content_type": "phone", - "detail_info": "123465", - }; - var listAddBluk2 = []; - listAddBluk2[0] = contactDataValuesThree; - listAddBluk2[1] = contactDataValuesFour; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk2); - sleep(1000); - console.info("logMessage contact_autoMerge_test_300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_autoMerge_test_300: batch insert2 error = " + error) - } - } - - async function autoMerger(DAHelper, rawContactIdFirst, testName) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage " + testName + "autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, testName, 2); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info("logMessage " + testName + "auto_merge error =" + error); - } - } - - async function autoNotMerger(DAHelper, rawContactIdFirst, testName) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - sleep(2000); - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - console.info("logMessage " + testName + "autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, testName, 1); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info("logMessage " + testName + "auto_merge error =" + error); - } - } - - /** - * @tc.number contact_manualMerge_test_400 - * @tc.name Two contacts with the same name have a mobile phone number, and the mobile phone numbers are - * different. Call the manual merge interface - * @tc.desc Function test - */ - it("contact_manualMerge_test_400", 0, async function (done) { - console.info("------logMessage contact_manualMerge_test_400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaozhang" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await noequalPhoneDataInsert(DAHelper, rawContactIdFirst) - } catch (error) { - console.info('logMessage contact_manualMerge_test_400: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaozhang" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await noequalPhoneDataInsertTwo(DAHelper, rawContactIdSecond) - } catch (error) { - console.info('logMessage contact_manualMerge_test_400: raw_contact_2 insert error = ' + error); - done(); - } - - await noequalManualMerge(DAHelper, rawContactIdFirst, rawContactIdSecond); - done(); - }); - - async function noequalPhoneDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdFirst, - "content_type": "name", - "detail_info": "xiaozhang" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "147852", - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_400: batch insert1 error = " + error) - } - } - - async function noequalPhoneDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValuesThree = { - "raw_contact_id": rawContactIdSecond, - "content_type": "name", - "detail_info": "xiaozhang" - }; - var contactDataValuesFour = { - "raw_contact_id": rawContactIdSecond, - "content_type": "phone", - "detail_info": "996369", - }; - var listAddBluk2 = []; - listAddBluk2[0] = contactDataValuesThree; - listAddBluk2[1] = contactDataValuesFour; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_400: batch insert2 error = " + error) - } - } - - async function noequalManualMerge(DAHelper, rawContactIdFirst, rawContactIdSecond) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var id = [rawContactIdFirst.toString(), rawContactIdSecond.toString()]; - condition2.in("raw_contact_id", id); - var updateValues2 = {}; - try { - var ManualMergeCode = await DAHelper.update(manualMergeUri, updateValues2, condition2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400 ManualMergeCode = " + ManualMergeCode); - expect(ManualMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_manualMerge_test_400", 2); - await deleteAll(rawContactUri, "contact_manualMerge_test_400"); - await deleteAll(contactDataUri, "contact_manualMerge_test_400"); - } catch (error) { - console.info("logMessage contact_manualMerge_test_400 manual_merge error = " + error); - } - } - - /** - * @tc.number contact_manualMerge_test_500 - * @tc.name Two contacts with the same name, one with two mobile phone numbers and the other without mobile phone - * numbers, call the manual merge interface - * @tc.desc Function test - */ - it("contact_manualMerge_test_500", 0, async function (done) { - console.info("------logMessage contact_manualMerge_test_500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaozhou" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await manualDataInsert(DAHelper, rawContactIdFirst) - } catch (error) { - console.info('logMessage contact_manualMerge_test_500: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaozhou" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await manualDataInsertTwo(DAHelper, rawContactIdSecond) - } catch (error) { - console.info('logMessage contact_manualMerge_test_500: raw_contact_2 insert error = ' + error); - done(); - } - await hasOneNoPhoneManualMerge(DAHelper, rawContactIdFirst, rawContactIdSecond); - done(); - }); - - async function manualDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdFirst, - "content_type": "name", - "detail_info": "xiaozhou" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "123456789", - }; - var contactDataValuesThree = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "996632", - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - listAddBluk[2] = contactDataValuesThree; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_500: batch insert1 error = " + error) - } - } - - async function manualDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValuesFour = { - "raw_contact_id": rawContactIdSecond, - "content_type": "name", - "detail_info": "xiaozhou" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValuesFour); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_500: contact_data insert error = " + error) - } - } - - async function hasOneNoPhoneManualMerge(DAHelper, rawContactIdFirst, rawContactIdSecond) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var id = [rawContactIdFirst.toString(), rawContactIdSecond.toString()]; - condition2.in("raw_contact_id", id); - var updateValues2 = {}; - try { - var ManualMergeCode = await DAHelper.update(manualMergeUri, updateValues2, condition2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500 ManualMergeCode = " + ManualMergeCode); - expect(ManualMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_manualMerge_test_500", 2); - await deleteAll(rawContactUri, "contact_manualMerge_test_500"); - await deleteAll(contactDataUri, "contact_manualMerge_test_500"); - } catch (error) { - console.info("logMessage contact_manualMerge_test_500 manual_merge error = " + error); - } - } - - /** - * @tc.number contact_autoMerge_test_600 - * @tc.name Batch add contacts, then call auto merge interface. - * @tc.desc Function test - */ - it("contact_autoMerge_test_600", 0, async function (done) { - console.info("------logMessage contact_autoMerge_test_600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues1 = { - "display_name": "xiaoliu" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_autoMerge_test_600: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_autoMerge_test_600: raw_contact_1 insert error = ' + error); - done(); - } - - try { - var insertRawContactValues2 = { - "display_name": "xiaoliu" - }; - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_autoMerge_test_600: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_autoMerge_test_600: raw_contact_2 insert error = ' + error); - done(); - } - - try { - var insertRawContactValues3 = { - "display_name": "xiaoliu" - }; - var rawContactIdThird = await DAHelper.insert(rawContactUri, insertRawContactValues3); - sleep(1000); - console.info("logMessage contact_autoMerge_test_600: rawContactIdThird = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_autoMerge_test_600: raw_contact_3 insert error = ' + error); - done(); - } - - await contactDataBatchInsert(); - done(); - }); - - async function contactDataBatchInsert(DAHelper, rawContactIdFirst, rawContactIdSecond, rawContactIdThird) { - var contactDataValues1 = { - "raw_contact_id": rawContactIdFirst, "content_type": "name", "detail_info": "xiaoliu" - }; - var contactDataValues2 = { - "raw_contact_id": rawContactIdSecond, "content_type": "name", "detail_info": "xiaoliu" - }; - var contactDataValues3 = { - "raw_contact_id": rawContactIdThird, "content_type": "name", "detail_info": "xiaoliu" - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValues1; - listAddBluk[1] = contactDataValues2; - listAddBluk[2] = contactDataValues3; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(2000); - console.info("logMessage contact_autoMerge_test_600: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await threeAutoMerger(); - await deleteAll(rawContactUri, "contact_autoMerge_test_600"); - await deleteAll(contactDataUri, "contact_autoMerge_test_600"); - } catch (error) { - console.info('logMessage contact_autoMerge_test_600: raw_contact insert error = ' + error); - } - } - - async function threeAutoMerger(DAHelper, rawContactIdFirst) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_autoMerge_test_600 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_autoMerge_test_600", 3); - } catch (error) { - console.info("logMessage contact_autoMerge_test_600 auto_merge error = " + error); - } - } - - /** - * @tc.number contact_query_merge_list_test_700 - * @tc.name Query contacts to be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_700", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_700 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaowu" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_700: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await queryContactDataInsert(DAHelper, rawContactIdFirst); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_700: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaowu" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_700: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await queryContactDataInsertTwo(DAHelper, rawContactIdSecond); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_700: raw_contact_2 insert error = ' + error); - done(); - } - await queryMergeList(DAHelper, rawContactIdFirst, rawContactIdSecond, "contact_query_merge_list_test_700"); - done(); - }); - - async function queryContactDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValues = { - "raw_contact_id": rawContactIdFirst, "content_type": "name", "detail_info": "xiaowu" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_700: contactDataId1 = " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_700: contact_data_1 insert error = ' + error); - } - } - - async function queryContactDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdSecond, - "content_type": "name", - "detail_info": "xiaowu" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdSecond, - "content_type": "phone", - "detail_info": "002563" - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_700: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_700: contact_data_2 insert error = ' + error); - } - } - - async function queryMergeList(DAHelper, rawContactIdFirst, rawContactIdSecond, testName) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var columns = []; - var predicates = new ohosDataAbility.DataAbilityPredicates(); - try { - sleep(3000); - var resultSet = await DAHelper.query(uriQueryMergeList, columns, predicates); - var array = [rawContactIdFirst, rawContactIdSecond]; - var i = 0; - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var rawContactId = resultSet.getInt(resultSet.getColumnIndex("raw_contact_id")); - console.info(testName + (array[i] == rawContactId)); - expect(array[i] == rawContactId).assertTrue(); - console.info(testName + rawContactId); - i++; - } while (resultSet.goToNextRow()) - } - } - resultSet.close(); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info(testName + ": query error = " + error); - } - } - - /** - * @tc.number contact_query_merge_list_test_800 - * @tc.name Insert contacts with the same name and different mobile phone numbers, - * and check whether the database can query contacts that can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_800", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_800 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaowuu" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_800: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["xiaowuu", "1854154"]; - var types = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_800: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "xiaowuu" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_800: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["xiaowuu", "1854154414242"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_800: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_800"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_900 - * @tc.name Insert two contacts with different names to see if the database can - * query contacts that can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_900", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_900 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaowusu" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_900: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["xiaowusu"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_900"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_900: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "kxiaowusu" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_900: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["kxiaowusu"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_900"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_900: raw_contact_2 insert error = ' + error); - done(); - } - await manualNotMerge(DAHelper, rawContactIdFirst, rawContactIdSecond, "contact_query_merge_list_test_900"); - done(); - }); - - async function manualNotMerge(DAHelper, rawContactIdFirst, rawContactIdSecond, tag) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var id = [rawContactIdFirst.toString(), rawContactIdSecond.toString()]; - condition2.in("raw_contact_id", id); - var updateValues2 = {}; - try { - var ManualMergeCode = await DAHelper.update(manualMergeUri, updateValues2, condition2); - sleep(1000); - console.info(tag + "logMessage ManualMergeCode = " + ManualMergeCode); - expect(ManualMergeCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, tag, 1); - await deleteAll(rawContactUri, tag); - await deleteAll(contactDataUri, tag); - } catch (error) { - console.info(tag + "logMessage manual_merge error = " + error); - } - } - - /** - * @tc.number contact_query_merge_list_test_1000 - * @tc.name Insert contacts with the same name and phone number, and check whether - * the database can query contacts that can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1000", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1000 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaotiantian" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1000: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["xiaotiantian", "1854154414242441"]; - var types = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1000"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1000: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "xiaotiantian" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1000: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["xiaotiantian", "1854154414242441"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1000"); - sleep(2000); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1000: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - sleep(4000); - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - console.info("logMessage contact_query_merge_list_test_1000: autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_query_merge_list_test_1000", 2); - await deleteAll(rawContactUri, "contact_query_merge_list_test_1000"); - await deleteAll(contactDataUri, "contact_query_merge_list_test_1000"); - done(); - } catch (error) { - console.info("logMessage contact_auto_merge_and_spilt_test_100: auto_merge error = " + error); - } - }); - - /** - * @tc.number contact_query_merge_list_test_1100 - * @tc.name Insert contacts with different names and different mobile phone numbers, - and check whether the database can query contacts that can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1100", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1100 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "wsxiuklkk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1100: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["wsxiuklkk", "56465465"]; - var types = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1100"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1100: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "xiaolilili" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1100: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["xiaolilili", "8954598595"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1100"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1100: raw_contact_2 insert error = ' + error); - done(); - } - await manualNotMerge(DAHelper, rawContactIdFirst, rawContactIdSecond, "contact_query_merge_list_test_1100"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1200 - * @tc.name Insert two contacts with the same name. Contacts A and B have two - same mobile phone numbers, and check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1200 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "lwsxiuklkk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1200: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["lwsxiuklkk", "122504", "122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1200"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1200: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "lwsxiuklkk" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1200: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["lwsxiuklkk", "122504", "122505"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1200"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1200: raw_contact_2 insert error = ' + error); - done(); - } - await autoMerger(DAHelper, rawContactIdFirst, "contact_query_merge_list_test_1200"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1300 - * @tc.name Insert two contacts with the same name. Contacts A and B have two - * identical mobile phone numbers. Check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1300", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1300 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaowuuklkk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1300: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["xiaowuuklkk", "56465465", "122504"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1300"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1300: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "xiaowuuklkk" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1300: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["xiaowuuklkk", "8954598595", "1225054"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1300"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1300: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1300"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1400 - * @tc.name Insert two contacts with the same name. Contacts A and B have two mobile phone - * numbers, one of which is the same. Check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1400", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1400 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "limingm" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["limingm", "122504555", "1122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1400"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1400: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "limingm" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1400: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["limingm", "122504555", "1225056"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1400"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1400: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1400"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1500 - * @tc.name Insert two contacts with the same name, contact A has two mobile phone numbers, - * and contact B has one mobile phone number which is the same as one of the mobile phone - * numbers of A, and check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1500 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "kplimingm" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["kplimingm", "7122504555", "1122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1500"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1500: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "kplimingm" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1500: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["kplimingm", "7122504555"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1500"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1500: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1500"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1600 - * @tc.name Insert two contacts with the same name, contact A has two mobile phone numbers, - * and contact B has a mobile phone number different from that of A, check whether - * the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1600 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "pkplimingm" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1600: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["pkplimingm", "87122504555", "11122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1600"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1600: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "pkplimingm" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1600: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["pkplimingm", "7122554504555", "11122505"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1600"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1600: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1600"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1700 - * @tc.name Insert multiple manually merged contacts to check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1700", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1700 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "llllllk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1700: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["llllllk", "87122504555", "11122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1700"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1700: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "llllllk" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1700: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["llllllk", "7555", "02505"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1700"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1700: raw_contact_2 insert error = ' + error); - done(); - } - var insertRawContactValues3 = { - "display_name": "llllllk" - }; - try { - var rawContactIdThird = await DAHelper.insert(rawContactUri, insertRawContactValues3); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1700: rawContactIdSecond = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - var detailInfo1 = ["llllllk", "87555", "002505"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdThird, detailInfo1, types1, "contact_query_merge_list_test_1700"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1700: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + "", rawContactIdThird + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1700"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1800 - * @tc.name Import multiple automatically merged contacts to check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1800", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1800 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "jggbgbk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1800: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["jggbgbk", "85555", "996174"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1800: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "jggbgbk" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1800: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["jggbgbk", "85555", "996174"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1800: raw_contact_2 insert error = ' + error); - done(); - } - var insertRawContactValues3 = { - "display_name": "jggbgbk" - }; - try { - var rawContactIdThird = await DAHelper.insert(rawContactUri, insertRawContactValues3); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1800: rawContactIdSecond = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - var detailInfo1 = ["jggbgbk", "85555", "996174"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdThird, detailInfo1, types1, "contact_query_merge_list_test_1800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1800: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1800 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_query_merge_list_test_1800", 3); - await deleteAll(rawContactUri, "contact_query_merge_list_test_1800"); - await deleteAll(contactDataUri, "contact_query_merge_list_test_1800"); - } catch (error) { - console.info("contact_query_merge_list_test_1800 auto_merge error =" + error); - } - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1900 - * @tc.name Insert two contacts with the same name, contact A has two mobile phone numbers, - * and contact B has a mobile phone number different from that of A, check whether - * the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1900", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1900 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "owjiuh" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1900: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var dataId = insertContactDataSingle(DAHelper, rawContactIdFirst, "owjiuh", "name"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1900: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "owjiuh" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1900: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var dataId = insertContactDataSingle(DAHelper, rawContactIdFirst, "owjiuh", "name"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1900: raw_contact_2 insert error = ' + error); - done(); - } - await updateContactData("owjiuh111", dataId, "contact_query_merge_list_test_1900"); - await autoNotMerger(DAHelper, rawContactIdFirst, "contact_query_merge_list_test_1900"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_2000 - * @tc.name Insert two automatically merged contacts, modify the phone number of A, and then - * merge the contacts manually to check whether the database can be merged - * the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_2000", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_2000 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "ollwjiuh" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_2000: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await insertContactDataSingle(DAHelper, rawContactIdFirst, "ollwjiuh", "name"); - var dataIdTwo = await insertContactDataSingle(DAHelper, rawContactIdFirst, "8554544", "phone"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_2000: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "ollwjiuh" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_2000: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await insertContactDataSingle(DAHelper, rawContactIdSecond, "ollwjiuh", "name"); - await insertContactDataSingle(DAHelper, rawContactIdSecond, "8554544", "phone"); - sleep(2000); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_2000: raw_contact_2 insert error = ' + error); - done(); - } - await updateContactData("8554544444", dataIdTwo, "contact_query_merge_list_test_2000"); - sleep(3000); - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_2000"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2100 - * @tc.name Insert two contacts with different names for automatic and manual merging operations - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2100", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2100 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2100mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2100: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2100mergeTest"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2100"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2100: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2100mergeTestTwo" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2100: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2100mergeTestTwo"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2100"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2100: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - console.info("logMessage abnormal_merge_Update_test_2100 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == -1).assertTrue(); - await manualNotMerge(DAHelper, rawContactIdFirst, rawContactIdSecond, "abnormal_merge_Update_test_2100"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2200 - * @tc.name Insert two contacts with same names for automatic and manual merging operations - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2200 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2200mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2200: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2200mergeTest", "45544"]; - var types = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2200"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2200: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2200mergeTestTwo" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2200: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2200mergeTestTwo", "55134865"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2200"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2200: raw_contact_2 insert error = ' + error); - done(); - } - await queryMergeListError(DAHelper, rawContactIdFirst, rawContactIdSecond, "abnormal_merge_Update_test_2200"); - done(); - }); - - async function queryMergeListError(DAHelper, rawContactIdFirst, rawContactIdSecond, testName) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var columns = ["display_names"]; - var predicates = new ohosDataAbility.DataAbilityPredicates(); - try { - sleep(3000); - var resultSet = await DAHelper.query(uriQueryMergeList, columns, predicates); - console.info(testName + 'resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info(testName + ": query error = " + error); - } - } - - /** - * @tc.number abnormal_merge_Update_test_2300 - * @tc.name Insert two contacts with different names, and then automatically merge them to - * see if the database can be merged - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2300", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2300 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2300mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2300: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2300mergeTest"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2300"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2300: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2300mergeTestName" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2300: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2300mergeTestName"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2300"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2300: raw_contact_2 insert error = ' + error); - done(); - } - await autoNotMerger(DAHelper, rawContactIdFirst, "abnormal_merge_Update_test_2300"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2400 - * @tc.name Insert two contacts with different names, and then automatically merge them to - * see if the database can be merged - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2400", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2400 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2400mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2400mergeTest"]; - var types = ["namee"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2400"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2400: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2400mergeTest" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2400: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2400mergeTest"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2400"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2400: raw_contact_2 insert error = ' + error); - done(); - } - await autoNotMerger(DAHelper, rawContactIdFirst, "abnormal_merge_Update_test_2400"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2500 - * @tc.name Pass 0 after merging to split - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2500 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2500mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2500mergeTest"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2500"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2500: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2500mergeTest" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2500: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2500mergeTest"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2500"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2500: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2500 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactNotSplit(DAHelper, 0, "abnormal_merge_Update_test_2500"); - await contactMergeQuery(map, "abnormal_merge_Update_test_2500", 2); - await deleteAll(rawContactUri, "abnormal_merge_Update_test_2500"); - await deleteAll(contactDataUri, "abnormal_merge_Update_test_2500"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2600 - * @tc.name Pass -1 after merging to split - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2600 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2600mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2600: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2600mergeTest"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2600"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2600: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2600mergeTest" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2600: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2600mergeTest"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2600"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2600: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2600 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactNotSplit(DAHelper, -1, "abnormal_merge_Update_test_2600"); - await contactMergeQuery(map, "abnormal_merge_Update_test_2600", 2); - await deleteAll(rawContactUri, "abnormal_merge_Update_test_2600"); - await deleteAll(contactDataUri, "abnormal_merge_Update_test_2600"); - done(); - }); - - async function contactNotSplit(DAHelper, rawContactIdFirst, testName) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var array = [rawContactIdFirst.toString()]; - condition2.in("raw_contact_id", array); - var updateValues2 = {}; - try { - var splitCode = await DAHelper.update(splitUri, updateValues2, condition2); - sleep(4000); - console.info(testName + 'logMessage splitCode = ' + splitCode); - expect(splitCode == -1).assertTrue(); - } catch (error) { - console.info(testName + 'logMessage split error = ' + error); - } - } - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('merge afterAll delete_All: start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var deletedAll = await DAHelper.delete(deletedUri, condition); - sleep(4000); - console.info('merge afterAll delete_All : deletedAll ! DAHelper = ' + deletedAll); - }); - }); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_performance/BUILD.gn b/telephony/telephonyjstest/contact_performance/BUILD.gn deleted file mode 100644 index cf8ca1bec9d0bbac3223badffee69c1ee166d2c3..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# 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("ActsContactPerformanceEtsTest") { - 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 = "ActsContactPerformanceEtsTest" -} -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" -} diff --git a/telephony/telephonyjstest/contact_performance/Test.json b/telephony/telephonyjstest/contact_performance/Test.json deleted file mode 100644 index 1ac6ac21a7f0ae6c1cf5da562d43b809cf54cd2c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1800000", - "package": "com.ohos.contactperformance", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsContactPerformanceEtsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/config.json b/telephony/telephonyjstest/contact_performance/entry/src/main/config.json deleted file mode 100644 index 60e881d938b559ac8edc69e4a3dfba8be4a7d341..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/config.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.contactperformance", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.contactperformance", - "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 diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/app.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 261fadca29ff0ea310a8bc105ddd1af65e2dd2f6..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Badge.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Badge.ets deleted file mode 100644 index 66de6f8e3b9c0360931602dd25d1511878ac63ab..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Badge.ets +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Blank.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Blank.ets deleted file mode 100644 index a50fc719e09ab27c91f9705ac06008e936830f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Blank.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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%') - - - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Button.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Button.ets deleted file mode 100644 index ac2271ea3a13664bbbb6afe4f173abae9e66f867..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Button.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Column.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Column.ets deleted file mode 100644 index b9e5c84e21ccf25419be432d8f95418fac82070a..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Column.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 }) - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets deleted file mode 100644 index cb0597310a15be8ab4503a3ae89385e3708fac96..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Counter.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Counter.ets deleted file mode 100644 index ecdbfaf10393e7a348fd76098868e6455505b07f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Counter.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/DataPanel.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/DataPanel.ets deleted file mode 100644 index 3c624848482b22998b2a1d137796ddaedbcf198c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/DataPanel.ets +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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%') - - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Divider.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Divider.ets deleted file mode 100644 index 02bf60779418674d1fd58127907fdb3915bd8f8f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Divider.ets +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Flex.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Flex.ets deleted file mode 100644 index a0e21251e80008c5be9f29aa52074acc5eb24a78..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Flex.ets +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/GridContainer.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/GridContainer.ets deleted file mode 100644 index 57358110413406263e70a2a5f650cbfeb22a4387..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/GridContainer.ets +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Image.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Image.ets deleted file mode 100644 index 5cc583e931f51aa8e4f2bd55decfeeb14a40afb4..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Image.ets +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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) - } - } -} - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Navigator.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Navigator.ets deleted file mode 100644 index 6c50769cf2ab045cbe48b52e294b4105a21e1c3d..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Navigator.ets +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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) - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Panel.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Panel.ets deleted file mode 100644 index 32ddabbd1ccbae3805dd462e6f04b28364d6a1e7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Panel.ets +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Progress.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Progress.ets deleted file mode 100644 index c8608089fe51e1988fd305fc49db028b6c2efe76..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Progress.ets +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Qrcode.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Qrcode.ets deleted file mode 100644 index 5c0dd84eff5a6653ee5fd940662d141025a1bb4e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Qrcode.ets +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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') - } - } -} - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Rating.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Rating.ets deleted file mode 100644 index b29e26a392fca6f15a5b7f0eb4156dd3bc767c3f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Rating.ets +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/RowSplit.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/RowSplit.ets deleted file mode 100644 index 0f4f397b13b83e98ac643633309b02858f337eb0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/RowSplit.ets +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Scroll.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Scroll.ets deleted file mode 100644 index 363089d22580febed16b983d8a4b2877cde52bec..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Scroll.ets +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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 = [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') - - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Slider.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Slider.ets deleted file mode 100644 index 625cd02874f16e9debb7638322624f890e08fa62..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Slider.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Span.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Span.ets deleted file mode 100644 index df5a71043f1ae000b822646f6b56df7ae103fa1f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Span.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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) - } - } -} - - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Stack.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Stack.ets deleted file mode 100644 index 2a694889f0e768afbd3e3af6a17c3af9d8738cfb..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Stack.ets +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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%') - - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Text.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Text.ets deleted file mode 100644 index fbd1415dc815b0f1966476c430f7d69e28e587ee..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Text.ets +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 10359134da915c9b44b0836ba4881bca71f43f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,65 +0,0 @@ -// @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%') - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 19c443805757f1926834fd2f8244eccf1c1bf585..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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. - */ - -//contact import -import PerformanceTest from './contact/Performance_test.js' - -export default function testsuite() { - //contact - PerformanceTest(); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/Utils.ets deleted file mode 100644 index 65f70088ddb62bcf80f4e0ec07dc841a8ab033f0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/Utils.ets +++ /dev/null @@ -1,119 +0,0 @@ -// @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) - } -} - - - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/contact/Performance_test.js b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/contact/Performance_test.js deleted file mode 100644 index 7301973fb73211f4b236c4b0ea4d1e59e79ec8f5..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/contact/Performance_test.js +++ /dev/null @@ -1,627 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CALLLOG = "dataability:///com.ohos.calllogability"; -const calllogUri = "dataability:///com.ohos.calllogability/calls/calllog"; -const URI_VOICEMAIL = "dataability:///com.ohos.voicemailability"; -const voicemailUri = "dataability:///com.ohos.voicemailability/calls/voicemail"; -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; - -export default function PerformanceTest() { - describe('PerformanceTest', function () { - console.log(' PerformanceTest is start'); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - /** - * @tc.number raw_contact_insert_performance_test_900 - * @tc.name The raw_contact table adds 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("raw_contact_insert_performance_test_900", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "display_name": "xiaoli" + i, "company": "testCompany" + i, "position": "testPosition" + i - }; - listAddBluk[i] = add; - } - try { - let old = new Date(); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - let now = new Date(); - let usedTime = now - old; - console.info('raw_contact_insert_performance_test_900 usedTime = ' + usedTime); - expect(usedTime < 70000).assertTrue(); - sleep(5000); - console.info("logMessage raw_contact_insert_performance_test_900: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage raw_contact_insert_performance_test_900: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number raw_contact_update_performance_test_1000 - * @tc.name The raw_contact table updates data whose ID is not equal to 0, and the time consumption is calculated - * according to the running time of the use case - * @tc.desc Function test - */ - it("raw_contact_update_performance_test_1000", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "favorite": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - let old = new Date(); - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - let now = new Date(); - let usedTime = now - old; - console.info('raw_contact_update_performance_test_1000 usedTime = ' + usedTime); - expect(usedTime < 3000).assertTrue(); - sleep(5000); - console.info("logMessage raw_contact_update_performance_test_1000: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage raw_contact_update_performance_test_1000: update error = " + error); - done(); - } - }); - - /** - * @tc.number raw_contact_query_performance_test_1100 - * @tc.name The raw_ contact table queries 10000 pieces of data and calculates the time consumption according to - * the running time of the use case - * @tc.desc Function test - */ - it("raw_contact_query_performance_test_1100", 0, async function (done) { - var tag = "raw_contact_query_performance_test_1100"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - let old = new Date(); - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - let now = new Date(); - let usedTime = now - old; - console.info('raw_contact_query_performance_test_1100 usedTime = ' + usedTime); - expect(usedTime < 2000).assertTrue(); - sleep(5000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info(tag + " :logMessage : error = " + error); - done(); - } - }); - - /** - * @tc.number raw_contact_delete_performance_test_1200 - * @tc.name The raw_contact table deletes 10000 pieces of data, and the time consumption is calculated according - * to the running time of the use case - * @tc.desc Function test - */ - it("raw_contact_delete_performance_test_1200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('raw_contact_delete_performance_test_1200 : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - let old = new Date(); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - let now = new Date(); - let usedTime = now - old; - console.info('raw_contact_delete_performance_test_1200 usedTime = ' + usedTime); - expect(usedTime < 10000).assertTrue(); - sleep(5000); - console.info("logMessage raw_contact_delete_performance_test_1200: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage raw_contact_delete_performance_test_1200: delete error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_data_insert_performance_test_1300 - * @tc.name The contact_data table adds 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("contact_data_insert_performance_test_1300", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoli", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_data_insert_performance_test_1300: rawContactId = " + rawContactId); - } catch (error) { - console.info("logMessage contact_data_insert_performance_test_1300: raw_contact insert error = " + error); - } - - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - sleep(1000); - console.info("logMessage contact_data_insert_performance_test_1300: deleteCode = " + deleteCode); - - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "raw_contact_id": rawContactId, "detail_info": "xxx" + i, "content_type": "name" - }; - listAddBluk[i] = add; - } - try { - let old = new Date(); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - let now = new Date(); - let usedTime = now - old; - console.info('contact_data_insert_performance_test_1300 usedTime = ' + usedTime); - expect(usedTime < 70000).assertTrue(); - sleep(5000); - console.info("logMessage contact_data_insert_performance_test_1300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_data_insert_performance_test_1300: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_data_update_performance_test_1400 - * @tc.name The contact_data table updates data whose ID is not equal to 0, and the time consumption is - * calculated according to the running time of the use case - * @tc.desc Function test - */ - it("contact_data_update_performance_test_1400", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage contact_data_update_performance_test_1400 DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "syn_1": "test" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - let now = new Date(); - let usedTime = now - old; - console.info('contact_data_update_performance_test_1400 usedTime = ' + usedTime); - expect(usedTime < 50000).assertTrue(); - sleep(8000); - console.info("logMessage contact_data_update_performance_test_1400: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage contact_data_update_performance_test_1400: update error = " + error); - done(); - } - }); - - /** - * @tc.number contact_data_query_performance_test_1500 - * @tc.name The contact_datat table queries 10000 pieces of data and calculates the time consumption according to - * the running time of the use case - * @tc.desc Function test - */ - it("contact_data_query_performance_test_1500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('contact_data_query_performance_test_1500 start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - let now = new Date(); - let usedTime = now - old; - console.info('contact_data_query_performance_test_1500 usedTime = ' + usedTime); - expect(usedTime < 4000).assertTrue(); - sleep(5000); - console.info('logMessage contact_data_query_performance_test_1500: goToFirstRow' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertEqual(true); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage contact_data_query_performance_test_1500: error = " + error); - done(); - } - }); - - /** - * @tc.number contact_data_delete_performance_test_1600 - * @tc.name The contact_data table deletes 10000 pieces of data, and the time consumption is calculated according - * to the running time of the use case - * @tc.desc Function test - */ - it("contact_data_delete_performance_test_1600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('contact_data_delete_performance_test_1600 : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var deleteCode = await DAHelper.delete(contactDataUri, condition); - let now = new Date(); - let usedTime = now - old; - console.info('contact_data_delete_performance_test_1600 usedTime = ' + usedTime); - expect(usedTime < 40000).assertTrue(); - sleep(5000); - console.info("logMessage contact_data_delete_performance_test_1600: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_data_delete_performance_test_1600: delete error = ' + error); - done(); - } - }); - - /** - * @tc.number calllog_insert_performance_test_100 - * @tc.name The callog table adds 10000 pieces of data, and the time consumption is calculated according to the - * running time of the use case - * @tc.desc Function test - */ - it("calllog_insert_performance_test_100", 0, async function (done) { - console.info("---------logMessage calllog_insert_performance_test_100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "phone_number": "1511002" + i - }; - listAddBluk[i] = add; - } - try { - let old = new Date(); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - let now = new Date(); - let usedTime = now - old; - console.info('calllog_insert_performance_test_100 usedTime = ' + usedTime); - expect(usedTime < 100000).assertTrue(); - sleep(5000); - console.info("logMessage calllog_insert_performance_test_100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage calllog_insert_performance_test_100: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_update_performance_test_200 - * @tc.name The callog table updates data whose ID is not equal to 0, and the time consumption is calculated - * according to the running time of the use case - * @tc.desc Function test - */ - it("calllog_update_performance_test_200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "answer_state": "1" - }; - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - let old = new Date(); - var updateCode = await DAHelper.update(calllogUri, updateValues, condition); - let now = new Date(); - let usedTime = now - old; - console.info('calllog_update_performance_test_200 usedTime = ' + usedTime); - expect(usedTime < 1000).assertTrue(); - sleep(5000); - console.info("logMessage calllog_update_performance_test_200: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage calllog_update_performance_test_200: update error = " + error); - done(); - } - ; - }); - - /** - * @tc.number calllog_query_performance_test_300 - * @tc.name The callog table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("calllog_query_performance_test_300", 0, async function (done) { - var tag = "calllog_query_performance_test_300"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - - try { - let old = new Date(); - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - let now = new Date(); - let usedTime = now - old; - console.info('calllog_query_performance_test_300 usedTime = ' + usedTime); - expect(usedTime < 1000).assertTrue(); - sleep(5000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage calllog_query_performance_test_300: error = " + error); - done() - } - }); - - /** - * @tc.number calllog_delete_performance_test_400 - * @tc.name The callog table deletes 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("calllog_delete_performance_test_400", 0, async function (done) { - var tag = "calllog_delete_performance_test_400"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - let old = new Date(); - var deleteCode = await DAHelper.delete(calllogUri, condition); - let now = new Date(); - let usedTime = now - old; - console.info('calllog_delete_performance_test_400 usedTime = ' + usedTime); - expect(usedTime < 10000).assertTrue(); - sleep(5000); - console.info(tag + " : logMessage : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - }); - - /** - * @tc.number voicemail_insert_performance_test_500 - * @tc.name The voicemail table adds 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("voicemail_insert_performance_test_500", 0, async function (done) { - console.info("---------logMessage voicemail_insert_performance_test_500 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "phone_number": "12345" + i - }; - listAddBluk[i] = add; - } - try { - let old = new Date(); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - let now = new Date(); - let usedTime = now - old; - console.info('voicemail_insert_performance_test_500 usedTime = ' + usedTime); - expect(usedTime < 100000).assertTrue(); - sleep(5000); - console.info("logMessage voicemail_insert_performance_test_500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_performance_test_500: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_update_performance_test_600 - * @tc.name The voicemail table updates data whose ID is not equal to 0, and the time consumption is calculated - * according to the running time of the use case - * @tc.desc Function test - */ - it("voicemail_update_performance_test_600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "origin_type": "test" - }; - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - let old = new Date(); - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - let now = new Date(); - let usedTime = now - old; - console.info('voicemail_update_performance_test_600 usedTime = ' + usedTime); - expect(usedTime < 10000).assertTrue(); - sleep(5000); - console.info("logMessage voicemail_update_performance_test_600: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_update_performance_test_600: update error = " + error); - done(); - } - ; - }); - - /** - * @tc.number voicemail_query_performance_test_700 - * @tc.name The voicemail table queries 10000 items, and the time consumption is calculated according to the - * running time of the use case - * @tc.desc Function test - */ - it("voicemail_query_performance_test_700", 0, async function (done) { - var tag = "voicemail_query_performance_test_700"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - let now = new Date(); - let usedTime = now - old; - console.info('voicemail_query_performance_test_700 usedTime = ' + usedTime); - expect(usedTime < 500).assertTrue(); - sleep(5000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage voicemail_query_performance_test_700: error = " + error); - done() - } - }); - - /** - * @tc.number voicemail_delete_performance_test_800 - * @tc.name The voicemail table deletes 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("voicemail_delete_performance_test_800", 0, async function (done) { - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - var tag = "voicemail_delete_performance_test_800"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var deleteCode = await DAHelper.delete(voicemailUri, condition); - let now = new Date(); - let usedTime = now - old; - console.info('voicemail_delete_performance_test_800 usedTime = ' + usedTime); - expect(usedTime < 500).assertTrue(); - sleep(5000); - console.info(tag + " : logMessage : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_delete_performance_test_800: error = " + error); - done(); - } - }); - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('DeleteContact : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", "0"); - try { - var resultColumns = ["id"]; - var conditionDelete = new ohosDataAbility.DataAbilityPredicates(); - conditionDelete.greaterThan("id", "0"); - var count = 0; - var deleteCount = 9999; - while (count < deleteCount) { - var result = await DAHelper.query(deletedUri, resultColumns, conditionDelete); - console.info("performance : result.rowCount = " + result.rowCount); - count = result.rowCount; - result.close(); - sleep(5000); - } - var deleteCode = await DAHelper.delete(deletedUri, condition); - console.info("afterAll logMessage DeleteContact: deleteCode = " + deleteCode); - } catch (error) { - console.info('afterAll logMessage DeleteContact: delete error = ' + error); - } - }); - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/lib/Const.js deleted file mode 100644 index f9263cd46dee1a0ffdfaa1e5ef5c29755c7e13f7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/lib/Const.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 03b8532c53ca563f8ed6b1e21d20ad3f67a68906..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/hand.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/hand.png deleted file mode 100644 index 9f1fa16ee073093b40920e273502513fa66fa980..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/hand.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/icon.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/images.jpg b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/images.jpg deleted file mode 100644 index c75ddfc5ead15e8d49ca7cae9f97c03585565be1..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/images.jpg and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/person.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/person.png deleted file mode 100644 index f0f540d078e6c0441a763ca2cc375a551d6cf736..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/person.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-1.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-1.png deleted file mode 100644 index 990c5e5ad20698c7701faf641bc80eb004a127b7..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-1.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-2.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-2.png deleted file mode 100644 index 450c3dd3ca68bf601bd08e5f41797d376e20d00d..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-2.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-3.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-3.png deleted file mode 100644 index 1044869832b423a5dfc2559a395529377bd34f0c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-3.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/video/show.mp4 b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/video/show.mp4 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/telephony/telephonyjstest/contact_performance/signature/openharmony_sx.p7b b/telephony/telephonyjstest/contact_performance/signature/openharmony_sx.p7b deleted file mode 100644 index 66b4457a8a81fb8d3356cf46d67226c850944858..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/signature/openharmony_sx.p7b and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/BUILD.gn b/telephony/telephonyjstest/contact_stability/BUILD.gn deleted file mode 100644 index 0bd78c4a9e52f801324579297cd904a706c29f1e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# 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("ActsContactStabilityEtsTest") { - 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 = "ActsContactStabilityEtsTest" -} -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" -} diff --git a/telephony/telephonyjstest/contact_stability/Test.json b/telephony/telephonyjstest/contact_stability/Test.json deleted file mode 100644 index 197a0b94631dfda2c74fd236e8f2bd1b336ce0fd..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1800000", - "package": "com.ohos.contactstability", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsContactStabilityEtsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/config.json b/telephony/telephonyjstest/contact_stability/entry/src/main/config.json deleted file mode 100644 index 724a92c1ec7ae5b33addf15600b5d04a5351d8f7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/config.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.contactstability", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.contactstability", - "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 diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/app.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 261fadca29ff0ea310a8bc105ddd1af65e2dd2f6..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Badge.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Badge.ets deleted file mode 100644 index 66de6f8e3b9c0360931602dd25d1511878ac63ab..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Badge.ets +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Blank.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Blank.ets deleted file mode 100644 index a50fc719e09ab27c91f9705ac06008e936830f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Blank.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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%') - - - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Button.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Button.ets deleted file mode 100644 index ac2271ea3a13664bbbb6afe4f173abae9e66f867..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Button.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Column.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Column.ets deleted file mode 100644 index b9e5c84e21ccf25419be432d8f95418fac82070a..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Column.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 }) - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets deleted file mode 100644 index cb0597310a15be8ab4503a3ae89385e3708fac96..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Counter.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Counter.ets deleted file mode 100644 index ecdbfaf10393e7a348fd76098868e6455505b07f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Counter.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/DataPanel.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/DataPanel.ets deleted file mode 100644 index 3c624848482b22998b2a1d137796ddaedbcf198c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/DataPanel.ets +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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%') - - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Divider.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Divider.ets deleted file mode 100644 index 02bf60779418674d1fd58127907fdb3915bd8f8f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Divider.ets +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Flex.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Flex.ets deleted file mode 100644 index a0e21251e80008c5be9f29aa52074acc5eb24a78..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Flex.ets +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/GridContainer.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/GridContainer.ets deleted file mode 100644 index 57358110413406263e70a2a5f650cbfeb22a4387..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/GridContainer.ets +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Image.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Image.ets deleted file mode 100644 index 5cc583e931f51aa8e4f2bd55decfeeb14a40afb4..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Image.ets +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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) - } - } -} - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Navigator.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Navigator.ets deleted file mode 100644 index 6c50769cf2ab045cbe48b52e294b4105a21e1c3d..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Navigator.ets +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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) - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Panel.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Panel.ets deleted file mode 100644 index 32ddabbd1ccbae3805dd462e6f04b28364d6a1e7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Panel.ets +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Progress.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Progress.ets deleted file mode 100644 index c8608089fe51e1988fd305fc49db028b6c2efe76..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Progress.ets +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Qrcode.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Qrcode.ets deleted file mode 100644 index 5c0dd84eff5a6653ee5fd940662d141025a1bb4e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Qrcode.ets +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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') - } - } -} - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Rating.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Rating.ets deleted file mode 100644 index b29e26a392fca6f15a5b7f0eb4156dd3bc767c3f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Rating.ets +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/RowSplit.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/RowSplit.ets deleted file mode 100644 index 0f4f397b13b83e98ac643633309b02858f337eb0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/RowSplit.ets +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Scroll.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Scroll.ets deleted file mode 100644 index 363089d22580febed16b983d8a4b2877cde52bec..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Scroll.ets +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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 = [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') - - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Slider.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Slider.ets deleted file mode 100644 index 625cd02874f16e9debb7638322624f890e08fa62..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Slider.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Span.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Span.ets deleted file mode 100644 index df5a71043f1ae000b822646f6b56df7ae103fa1f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Span.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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) - } - } -} - - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Stack.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Stack.ets deleted file mode 100644 index 2a694889f0e768afbd3e3af6a17c3af9d8738cfb..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Stack.ets +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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%') - - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Text.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Text.ets deleted file mode 100644 index fbd1415dc815b0f1966476c430f7d69e28e587ee..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Text.ets +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 10359134da915c9b44b0836ba4881bca71f43f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,65 +0,0 @@ -// @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%') - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/Utils.ets deleted file mode 100644 index 65f70088ddb62bcf80f4e0ec07dc841a8ab033f0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/Utils.ets +++ /dev/null @@ -1,119 +0,0 @@ -// @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) - } -} - - - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/contact/Stability_test.js b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/contact/Stability_test.js deleted file mode 100644 index e4639c4ac74592869af17d3f0259a57ea412b7b8..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/contact/Stability_test.js +++ /dev/null @@ -1,538 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CALLLOG = "dataability:///com.ohos.calllogability"; -const calllogUri = "dataability:///com.ohos.calllogability/calls/calllog"; - -const URI_VOICEMAIL = "dataability:///com.ohos.voicemailability"; -const voicemailUri = "dataability:///com.ohos.voicemailability/calls/voicemail"; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; - -export default function StabilityTest() { - describe('StabilityTest', function () { - console.log(' StabilityTest is start'); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - /** - * @tc.number raw_contact_insert_stability_test_900 - * @tc.name Add 10000 pieces of data to the raw_contact table to see if they can be successfully inserted - * @tc.desc Function test - */ - it("raw_contact_insert_stability_test_900", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "display_name": "xiaoli" + i, "company": "testCompany" + i, "position": "testPosition" + i - }; - listAddBluk[i] = add; - } - try { - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - sleep(1000); - console.info("logMessage raw_contact_insert_stability_test_900: contactDataId1 = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage raw_contact_insert_stability_test_900: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number raw_contact_update_stability_test_1000 - * @tc.name The raw_contact table updates the data whose ID is not equal to 0 to see whether they can be updated - * successfully - * @tc.desc Function test - */ - it("raw_contact_update_stability_test_1000", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "favorite": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage raw_contact_update_stability_test_1000: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage raw_contact_update_stability_test_1000: update error = " + error); - done(); - } - }); - - /** - * @tc.number raw_contact_query_stability_test_1100 - * @tc.name The raw_contact table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("raw_contact_query_stability_test_1100", 0, async function (done) { - var tag = "raw_contact_query_stability_test_1100"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = ["id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info(tag + " :logMessage : error = " + error); - done(); - } - }); - - /** - * @tc.number raw_contact_delete_stability_test_1200 - * @tc.name Delete 10000 pieces of data in raw_contact table to see if they can be deleted successfully - * @tc.desc Function test - */ - it("raw_contact_delete_stability_test_1200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('raw_contact_delete_stability_test_1200 : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition); - sleep(1000); - console.info("logMessage raw_contact_delete_stability_test_1200: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage raw_contact_delete_stability_test_1200: delete error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_data_insert_stability_test_1300 - * @tc.name Add 10000 pieces of data to the contact_data table to see if they can be successfully inserted - * @tc.desc Function test - */ - it("contact_data_insert_stability_test_1300", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoli", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_data_insert_stability_test_1300: rawContactId = " + rawContactId); - } catch (error) { - console.info("logMessage contact_data_insert_stability_test_1300: raw_contact insert error = " + error); - } - - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - sleep(1000); - console.info("logMessage contact_data_insert_stability_test_1300: deleteCode = " + deleteCode); - - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "raw_contact_id": rawContactId, "detail_info": "xxx" + i, "content_type": "name" - }; - listAddBluk[i] = add; - } - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(2000); - console.info("logMessage contact_data_insert_stability_test_1300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_data_insert_stability_test_1300: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_data_update_stability_test_1400 - * @tc.name The contact_data table updates the data whose ID is not equal to 0 to see whether they can be updated - * successfully - * @tc.desc Function test - */ - it("contact_data_update_stability_test_1400", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage contact_data_update_stability_test_1400 DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "syn_1": "test" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(2000); - console.info("logMessage contact_data_update_stability_test_1400: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage contact_data_update_stability_test_1400: update error = " + error); - done(); - } - }); - - /** - * @tc.number contact_data_query_stability_test_1500 - * @tc.name The contact_data table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("contact_data_query_stability_test_1500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('contact_data_query_stability_test_1500 start ! DAHelper = ' + DAHelper); - var resultColumns = ["id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(2000); - console.info(' contact_data_query_stability_test_1500 : resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertEqual(true); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage contact_data_query_stability_test_1500: error = " + error); - done(); - } - }); - - /** - * @tc.number contact_data_delete_stability_test_1600 - * @tc.name Delete 10000 pieces of data in contact_data table to see if they can be deleted successfully - * @tc.desc Function test - */ - it("contact_data_delete_stability_test_1600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('contact_data_delete_stability_test_1600 : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var deleteCode = await DAHelper.delete(contactDataUri, condition); - sleep(2000); - console.info("logMessage contact_data_delete_stability_test_1600: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_data_delete_stability_test_1600: delete error = ' + error); - done(); - } - }); - - /** - * @tc.number calllog_insert_stability_test_100 - * @tc.name Add 10000 pieces of data to the callog table to see if they can be successfully inserted - * @tc.desc Function test - */ - it("calllog_insert_stability_test_100", 0, async function (done) { - console.info("---------logMessage calllog_insert_stability_test_100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "phone_number": "1511002" + i - }; - listAddBluk[i] = add; - } - try { - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - sleep(1000); - console.info("logMessage calllog_insert_stability_test_100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage calllog_insert_stability_test_100: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_update_stability_test_200 - * @tc.name The callog table updates the data whose ID is not equal to 0 to see whether they can be updated - * successfully - * @tc.desc Function test - */ - it("calllog_update_stability_test_200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "answer_state": "1" - }; - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var updateCode = await DAHelper.update(calllogUri, updateValues, condition); - sleep(1000); - console.info("logMessage calllog_update_stability_test_200: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage calllog_update_stability_test_200: update error = " + error); - done(); - } - ; - }); - - /** - * @tc.number calllog_query_stability_test_300 - * @tc.name The callog table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("calllog_query_stability_test_300", 0, async function (done) { - var tag = "calllog_query_stability_test_300"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = ["id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - sleep(5000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage calllog_query_stability_test_300: error = " + error); - done() - } - }); - - /** - * @tc.number calllog_delete_stability_test_400 - * @tc.name Delete 10000 pieces of data in callog table to see if they can be deleted successfully - * @tc.desc Function test - */ - it("calllog_delete_stability_test_400", 0, async function (done) { - var tag = "calllog_delete_stability_test_400"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(calllogUri, condition); - sleep(5000); - console.info(tag + " : logMessage : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - }); - - /** - * @tc.number voicemail_insert_stability_test_500 - * @tc.name Add 10000 pieces of data to the voicemail table to see if they can be successfully inserted - * @tc.desc Function test - */ - it("voicemail_insert_stability_test_500", 0, async function (done) { - console.info("---------logMessage voicemail_insert_stability_test_500 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "phone_number": "12345" + i - }; - listAddBluk[i] = add; - } - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - sleep(1000); - console.info("logMessage voicemail_insert_stability_test_500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_stability_test_500: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_update_stability_test_600 - * @tc.name The voicemail table updates the data whose ID is not equal to 0 to see whether they can be updated - * successfully - * @tc.desc Function test - */ - it("voicemail_update_stability_test_600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "origin_type": "test" - }; - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - sleep(1000); - console.info("logMessage voicemail_update_stability_test_600: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_update_stability_test_600: update error = " + error); - done(); - } - ; - }); - - /** - * @tc.number voicemail_query_stability_test_700 - * @tc.name The voicemail table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("voicemail_query_stability_test_700", 0, async function (done) { - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var tag = "voicemail_query_stability_test_700"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = ["id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - sleep(1000); - console.info(tag + ' : resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertEqual(true); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage voicemail_query_stability_test_700: error = " + error); - done() - } - }); - - /** - * @tc.number voicemail_delete_stability_test_800 - * @tc.name Delete 10000 pieces of data in voicemail table to see if they can be deleted successfully - * @tc.desc Function test - */ - it("voicemail_delete_stability_test_800", 0, async function (done) { - var tag = "voicemail_delete_stability_test_800"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var deleteCode = await DAHelper.delete(voicemailUri, condition); - sleep(2000); - console.info(tag + " : logMessage : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_delete_stability_test_800: error = " + error); - done(); - } - }); - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('Stability : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", "0"); - try { - var resultColumns = ["id"]; - var conditionDelete = new ohosDataAbility.DataAbilityPredicates(); - conditionDelete.greaterThan("id", "0"); - var count = 0; - var deleteCount = 9999; - while (count < deleteCount) { - var result = await DAHelper.query(deletedUri, resultColumns, conditionDelete); - console.info("Stability : result.rowCount = " + result.rowCount); - count = result.rowCount; - result.close(); - sleep(5000); - } - var deleteCode = await DAHelper.delete(deletedUri, condition); - console.info("Stability afterAll logMessage DeleteContact: deleteCode = " + deleteCode); - } catch (error) { - console.info('Stability afterAll logMessage DeleteContact: delete error = ' + error); - } - }); - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/lib/Const.js deleted file mode 100644 index f9263cd46dee1a0ffdfaa1e5ef5c29755c7e13f7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/lib/Const.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 03b8532c53ca563f8ed6b1e21d20ad3f67a68906..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/hand.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/hand.png deleted file mode 100644 index 9f1fa16ee073093b40920e273502513fa66fa980..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/hand.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/icon.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/images.jpg b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/images.jpg deleted file mode 100644 index c75ddfc5ead15e8d49ca7cae9f97c03585565be1..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/images.jpg and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/person.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/person.png deleted file mode 100644 index f0f540d078e6c0441a763ca2cc375a551d6cf736..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/person.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-1.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-1.png deleted file mode 100644 index 990c5e5ad20698c7701faf641bc80eb004a127b7..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-1.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-2.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-2.png deleted file mode 100644 index 450c3dd3ca68bf601bd08e5f41797d376e20d00d..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-2.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-3.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-3.png deleted file mode 100644 index 1044869832b423a5dfc2559a395529377bd34f0c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-3.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/video/show.mp4 b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/video/show.mp4 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/telephony/telephonyjstest/contact_stability/signature/openharmony_sx.p7b b/telephony/telephonyjstest/contact_stability/signature/openharmony_sx.p7b deleted file mode 100644 index 66b4457a8a81fb8d3356cf46d67226c850944858..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/signature/openharmony_sx.p7b and /dev/null differ diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestJsunit.test.ets index 3dcab425b76e949b068fdd295cfd2c0438a354cb..9206a966e37720ada0a50ca7a614451365d48e2e 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestJsunit.test.ets @@ -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-----------------------"); diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestOptionsJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestOptionsJsunit.test.ets index 7d711790c160bfb286d3599966346be766881731..66c3449c0f8598fce7c7475831c23ec440c4f1f4 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestOptionsJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestOptionsJsunit.test.ets @@ -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-----------------------"); diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpResponseJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpResponseJsunit.test.ets index 215913b1f3b8f1797c37aa3a985b38d5f80b09df..2b00a5d0104311da3800d3c2c4d8676e9b12baca 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpResponseJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpResponseJsunit.test.ets @@ -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-----------------------"); diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/RequestMethodJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/RequestMethodJsunit.test.ets index eb3cc28a97c5e9942f5618bf2f84bb5888be0344..62afeb9ce4824c1270d9552044422d4f03473eea 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/RequestMethodJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/RequestMethodJsunit.test.ets @@ -417,11 +417,6 @@ export default function requestMethodJsunit() { } }); - - - - - }) }; diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/ResponseCodeJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/ResponseCodeJsunit.test.ets index 473614c51651ab05d7cc25fbe78570253e828361..7b642b0e7f760e18063843215dafaf5eb7cdfbe7 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/ResponseCodeJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/ResponseCodeJsunit.test.ets @@ -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 diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionJsunit.test.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionJsunit.test.ets index 9c050ddb9282a91e1f0b5a41381e87dd542f7a00..8d372ec9136a49178c8d27ad2a3a898e7d89896a 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionJsunit.test.ets @@ -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 diff --git a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js index a4a24a43e44a4a6661ec7ae01e76175d69c2a2fc..acb46b815cdac3d875c7261c1994f19e45532261 100644 --- a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js +++ b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js @@ -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,391 +337,7 @@ 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 * @tc.name Test The function isRadioOn diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/app.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 261fadca29ff0ea310a8bc105ddd1af65e2dd2f6..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Badge.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Badge.ets deleted file mode 100644 index 66de6f8e3b9c0360931602dd25d1511878ac63ab..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Badge.ets +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Blank.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Blank.ets deleted file mode 100644 index a50fc719e09ab27c91f9705ac06008e936830f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Blank.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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%') - - - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Button.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Button.ets deleted file mode 100644 index ac2271ea3a13664bbbb6afe4f173abae9e66f867..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Button.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Column.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Column.ets deleted file mode 100644 index b9e5c84e21ccf25419be432d8f95418fac82070a..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Column.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 }) - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets deleted file mode 100644 index cb0597310a15be8ab4503a3ae89385e3708fac96..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Counter.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Counter.ets deleted file mode 100644 index ecdbfaf10393e7a348fd76098868e6455505b07f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Counter.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/DataPanel.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/DataPanel.ets deleted file mode 100644 index 3c624848482b22998b2a1d137796ddaedbcf198c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/DataPanel.ets +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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%') - - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Divider.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Divider.ets deleted file mode 100644 index 02bf60779418674d1fd58127907fdb3915bd8f8f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Divider.ets +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Flex.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Flex.ets deleted file mode 100644 index a0e21251e80008c5be9f29aa52074acc5eb24a78..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Flex.ets +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/GridContainer.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/GridContainer.ets deleted file mode 100644 index 57358110413406263e70a2a5f650cbfeb22a4387..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/GridContainer.ets +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Image.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Image.ets deleted file mode 100644 index 5cc583e931f51aa8e4f2bd55decfeeb14a40afb4..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Image.ets +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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) - } - } -} - - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Navigator.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Navigator.ets deleted file mode 100644 index 6c50769cf2ab045cbe48b52e294b4105a21e1c3d..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Navigator.ets +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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) - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Panel.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Panel.ets deleted file mode 100644 index 32ddabbd1ccbae3805dd462e6f04b28364d6a1e7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Panel.ets +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Progress.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Progress.ets deleted file mode 100644 index c8608089fe51e1988fd305fc49db028b6c2efe76..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Progress.ets +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Qrcode.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Qrcode.ets deleted file mode 100644 index 5c0dd84eff5a6653ee5fd940662d141025a1bb4e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Qrcode.ets +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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') - } - } -} - - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Rating.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Rating.ets deleted file mode 100644 index b29e26a392fca6f15a5b7f0eb4156dd3bc767c3f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Rating.ets +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/RowSplit.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/RowSplit.ets deleted file mode 100644 index 0f4f397b13b83e98ac643633309b02858f337eb0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/RowSplit.ets +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Scroll.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Scroll.ets deleted file mode 100644 index 363089d22580febed16b983d8a4b2877cde52bec..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Scroll.ets +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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 = [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') - - } -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Slider.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Slider.ets deleted file mode 100644 index 625cd02874f16e9debb7638322624f890e08fa62..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Slider.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Span.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Span.ets deleted file mode 100644 index df5a71043f1ae000b822646f6b56df7ae103fa1f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Span.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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) - } - } -} - - - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Stack.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Stack.ets deleted file mode 100644 index 2a694889f0e768afbd3e3af6a17c3af9d8738cfb..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Stack.ets +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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%') - - } -} - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Text.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Text.ets deleted file mode 100644 index fbd1415dc815b0f1966476c430f7d69e28e587ee..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/Text.ets +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 10359134da915c9b44b0836ba4881bca71f43f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,65 +0,0 @@ -// @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%') - } -} - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/SimJsunit.test.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/SimJsunit.test.ets deleted file mode 100644 index 722f5dfb3e207739ca35d3aeecb5350adc1d696e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/SimJsunit.test.ets +++ /dev/null @@ -1,168 +0,0 @@ -// @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) 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*************"); - }) -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/SmsMmsJsunit.test.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/SmsMmsJsunit.test.ets deleted file mode 100644 index 8e5fba7f4cb5cdd93dead2ceb494205c20041251..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/SmsMmsJsunit.test.ets +++ /dev/null @@ -1,928 +0,0 @@ -// @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: '', - 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: '', - 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 === '').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 === '').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(); - }); - }) -} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/Utils.ets deleted file mode 100644 index 65f70088ddb62bcf80f4e0ec07dc841a8ab033f0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/Utils.ets +++ /dev/null @@ -1,119 +0,0 @@ -// @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) - } -} - - - - diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/lib/Const.js deleted file mode 100644 index f9263cd46dee1a0ffdfaa1e5ef5c29755c7e13f7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/lib/Const.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/new_add/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 03b8532c53ca563f8ed6b1e21d20ad3f67a68906..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/new_add/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/new_add/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/new_add/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/hand.png b/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/hand.png deleted file mode 100644 index 9f1fa16ee073093b40920e273502513fa66fa980..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/hand.png and /dev/null differ diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/icon.png b/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/images.jpg b/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/images.jpg deleted file mode 100644 index c75ddfc5ead15e8d49ca7cae9f97c03585565be1..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/images.jpg and /dev/null differ diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/person.png b/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/person.png deleted file mode 100644 index f0f540d078e6c0441a763ca2cc375a551d6cf736..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/person.png and /dev/null differ diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/star-1-1.png b/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/star-1-1.png deleted file mode 100644 index 990c5e5ad20698c7701faf641bc80eb004a127b7..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/star-1-1.png and /dev/null differ diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/star-1-2.png b/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/star-1-2.png deleted file mode 100644 index 450c3dd3ca68bf601bd08e5f41797d376e20d00d..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/star-1-2.png and /dev/null differ diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/star-1-3.png b/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/star-1-3.png deleted file mode 100644 index 1044869832b423a5dfc2559a395529377bd34f0c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/star-1-3.png and /dev/null differ diff --git a/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/video/show.mp4 b/telephony/telephonyjstest/new_add/entry/src/main/resources/rawfile/video/show.mp4 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/telephony/telephonyjstest/new_add/signature/openharmony_sx.p7b b/telephony/telephonyjstest/new_add/signature/openharmony_sx.p7b deleted file mode 100644 index 66b4457a8a81fb8d3356cf46d67226c850944858..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/new_add/signature/openharmony_sx.p7b and /dev/null differ diff --git a/telephony/telephonyjstest/new_add/BUILD.gn b/telephony/telephonyjstest/observer/BUILD.gn similarity index 93% rename from telephony/telephonyjstest/new_add/BUILD.gn rename to telephony/telephonyjstest/observer/BUILD.gn index 9feab10c4ebb26934a9146053976007e397577e1..0e91eb86eba5e202a6c28dcf52065c9ad6678767 100644 --- a/telephony/telephonyjstest/new_add/BUILD.gn +++ b/telephony/telephonyjstest/observer/BUILD.gn @@ -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" diff --git a/telephony/telephonyjstest/contact_function/Test.json b/telephony/telephonyjstest/observer/Test.json similarity index 69% rename from telephony/telephonyjstest/contact_function/Test.json rename to telephony/telephonyjstest/observer/Test.json index ebe415586abc266ca2513a634c63c3631ab843e1..1e5f519576f040a40ecc4bc8aa0f7e4f48957361 100644 --- a/telephony/telephonyjstest/contact_function/Test.json +++ b/telephony/telephonyjstest/observer/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for hjunit demo Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", - "package": "com.ohos.contactfunction", + "test-timeout": "1500000", + "package": "com.ohos.observer", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsContactFunctionEtsTest.hap" + "ActsObserverEtsTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/telephony/telephonyjstest/new_add/entry/src/main/config.json b/telephony/telephonyjstest/observer/entry/src/main/config.json similarity index 97% rename from telephony/telephonyjstest/new_add/entry/src/main/config.json rename to telephony/telephonyjstest/observer/entry/src/main/config.json index 9cfe1594902efb0ec8d859759196d940e146da04..349a4cc8e1f3ddee1c8ddee6b5d3c0e838c631f9 100644 --- a/telephony/telephonyjstest/new_add/entry/src/main/config.json +++ b/telephony/telephonyjstest/observer/entry/src/main/config.json @@ -1,6 +1,6 @@ { "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", diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/app.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/app.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/app.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Badge.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Badge.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Badge.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Badge.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Blank.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Blank.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Blank.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Blank.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Button.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Button.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Button.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Button.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Column.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Column.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Column.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Column.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Counter.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Counter.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Counter.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Counter.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/DataPanel.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/DataPanel.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/DataPanel.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/DataPanel.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Divider.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Divider.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Divider.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Divider.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Flex.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Flex.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Flex.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Flex.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/GridContainer.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/GridContainer.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/GridContainer.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/GridContainer.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Image.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Image.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Image.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Image.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Navigator.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Navigator.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Navigator.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Navigator.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Panel.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Panel.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Panel.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Panel.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Progress.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Progress.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Progress.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Progress.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Qrcode.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Qrcode.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Qrcode.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Qrcode.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Rating.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Rating.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Rating.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Rating.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/RowSplit.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/RowSplit.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/RowSplit.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/RowSplit.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Scroll.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Scroll.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Scroll.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Scroll.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Slider.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Slider.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Slider.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Slider.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Span.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Span.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Span.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Span.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Stack.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Stack.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Stack.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Stack.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Text.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Text.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Text.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/Text.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/index.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 86% rename from telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/List.test.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/List.test.ets index a51a5eab339f7e06b653f7c64ef0586165fa2d0b..a9cdf9b1dcc44db45434e415d954fd1410a0269e 100644 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/List.test.ets +++ b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/List.test.ets @@ -13,10 +13,12 @@ * limitations under the License. */ -//contact import -import StabilityTest from './contact/Stability_test.js' +//other import + +import observer from './ObserverJsunit.test.ets' export default function testsuite() { - //contact - StabilityTest(); + + observer(); + } \ No newline at end of file diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/ObserverJsunit.test.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/ObserverJsunit.test.ets similarity index 93% rename from telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/ObserverJsunit.test.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/ObserverJsunit.test.ets index c380826a013cc0e76c89ca9255a5f0f0b29a0965..6261c3259e002b99d1f6a7cf97bd8c39660d1f2d 100644 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/ObserverJsunit.test.ets +++ b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/ObserverJsunit.test.ets @@ -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 diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/Utils.ets similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/Utils.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/Utils.ets diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/lib/Const.js similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/lib/Const.js rename to telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/lib/Const.js diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/observer/entry/src/main/resources/base/element/string.json similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/base/element/string.json rename to telephony/telephonyjstest/observer/entry/src/main/resources/base/element/string.json diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/observer/entry/src/main/resources/base/media/icon.png similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/base/media/icon.png rename to telephony/telephonyjstest/observer/entry/src/main/resources/base/media/icon.png diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/hand.png b/telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/hand.png similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/hand.png rename to telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/hand.png diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/icon.png b/telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/icon.png similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/icon.png rename to telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/icon.png diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/images.jpg b/telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/images.jpg similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/images.jpg rename to telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/images.jpg diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/person.png b/telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/person.png similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/person.png rename to telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/person.png diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-1.png b/telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/star-1-1.png similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-1.png rename to telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/star-1-1.png diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-2.png b/telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/star-1-2.png similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-2.png rename to telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/star-1-2.png diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-3.png b/telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/star-1-3.png similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-3.png rename to telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/star-1-3.png diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/video/show.mp4 b/telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/video/show.mp4 similarity index 100% rename from telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/video/show.mp4 rename to telephony/telephonyjstest/observer/entry/src/main/resources/rawfile/video/show.mp4 diff --git a/telephony/telephonyjstest/contact_function/signature/openharmony_sx.p7b b/telephony/telephonyjstest/observer/signature/openharmony_sx.p7b similarity index 100% rename from telephony/telephonyjstest/contact_function/signature/openharmony_sx.p7b rename to telephony/telephonyjstest/observer/signature/openharmony_sx.p7b diff --git a/telephony/telephonyjstest/contact_function/BUILD.gn b/telephony/telephonyjstest/radiostatistic/BUILD.gn similarity index 92% rename from telephony/telephonyjstest/contact_function/BUILD.gn rename to telephony/telephonyjstest/radiostatistic/BUILD.gn index b02f559e300048dd7ea6a8e4335c7684f0e21d6a..a5f14455b09221e821a48f199d3f6f49a57037fe 100644 --- a/telephony/telephonyjstest/contact_function/BUILD.gn +++ b/telephony/telephonyjstest/radiostatistic/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ActsContactFunctionEtsTest") { +ohos_js_hap_suite("ActsRadiostatisticEtsTest") { hap_profile = "./entry/src/main/config.json" deps = [ ":ace_demo_ets_assets", @@ -21,7 +21,7 @@ ohos_js_hap_suite("ActsContactFunctionEtsTest") { ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsContactFunctionEtsTest" + hap_name = "ActsRadiostatisticEtsTest" } ohos_js_assets("ace_demo_ets_assets") { source_dir = "./entry/src/main/ets/MainAbility" diff --git a/telephony/telephonyjstest/new_add/Test.json b/telephony/telephonyjstest/radiostatistic/Test.json similarity index 78% rename from telephony/telephonyjstest/new_add/Test.json rename to telephony/telephonyjstest/radiostatistic/Test.json index a83417445a6b1e50d9e6e4424f0f6815f29aed0f..cf76cebbce9cbd831bb69179c9e722aa5575f283 100644 --- a/telephony/telephonyjstest/new_add/Test.json +++ b/telephony/telephonyjstest/radiostatistic/Test.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 diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/config.json b/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json similarity index 97% rename from telephony/telephonyjstest/contact_function/entry/src/main/config.json rename to telephony/telephonyjstest/radiostatistic/entry/src/main/config.json index fd7b989537afb9259ed8b7e1fea5a903807d7da6..fda9d63dd9bd97c3c48b0b5b28cbb8cf0cdd0e83 100644 --- a/telephony/telephonyjstest/contact_function/entry/src/main/config.json +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.ohos.contactfunction", + "bundleName": "com.ohos.radiostatistic", "vendor": "open", "version": { "code": 1000000, @@ -14,7 +14,7 @@ }, "deviceConfig": {}, "module": { - "package": "com.ohos.contactfunction", + "package": "com.ohos.radiostatistic", "name": ".MyApplication", "mainAbility": ".MainAbility", "srcPath": "MainAbility", diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/app.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/app.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/app.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Badge.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Badge.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Badge.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Badge.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Blank.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Blank.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Blank.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Blank.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Button.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Button.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Button.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Button.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Column.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Column.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Column.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Column.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Counter.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Counter.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Counter.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Counter.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/DataPanel.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/DataPanel.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/DataPanel.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/DataPanel.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Divider.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Divider.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Divider.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Divider.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Flex.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Flex.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Flex.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Flex.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/GridContainer.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/GridContainer.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/GridContainer.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/GridContainer.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Image.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Image.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Image.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Image.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Navigator.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Navigator.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Navigator.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Navigator.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Panel.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Panel.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Panel.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Panel.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Progress.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Progress.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Progress.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Progress.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Qrcode.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Qrcode.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Qrcode.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Qrcode.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Rating.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Rating.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Rating.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Rating.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/RowSplit.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/RowSplit.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/RowSplit.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/RowSplit.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Scroll.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Scroll.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Scroll.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Scroll.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Slider.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Slider.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Slider.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Slider.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Span.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Span.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Span.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Span.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Stack.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Stack.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Stack.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Stack.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Text.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Text.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Text.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/Text.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/index.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/CallJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/CallJsunit.test.ets similarity index 61% rename from telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/CallJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/CallJsunit.test.ets index 744b261c0f27b7de980d7feda1e1f19d3f0ed25c..0cd2dcefec69a88f98c4afbffed06f668efefc04 100644 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/CallJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/CallJsunit.test.ets @@ -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,243 +123,7 @@ 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 * @tc.name Enum AudioDevice @@ -470,30 +142,7 @@ 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 * @tc.name Enum CallTransferType @@ -850,4 +499,5 @@ export default function callJsunit(){ }); -} \ No newline at end of file +} + diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/ConvertOptionsJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/ConvertOptionsJsunit.test.ets similarity index 100% rename from telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/ConvertOptionsJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/ConvertOptionsJsunit.test.ets diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/DataJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/DataJsunit.test.ets similarity index 100% rename from telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/DataJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/DataJsunit.test.ets diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 89% rename from telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/List.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/List.test.ets index 5ebbc36cbeebfd745bd354e169e3664b4de948b0..65091fa54744a8ea754df0e1294dcc7cd809e201 100644 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/List.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/List.test.ets @@ -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 diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets similarity index 76% rename from telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets index a6222c0256ae4c37fd270abb3186d252443a3480..bcff586cef6c1fd00ae902a052be651364d70fab 100644 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets @@ -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,49 +49,7 @@ 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 * @tc.name Test The function setPrimarySlotId(0) diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/RadioSecondJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioSecondJsunit.test.ets similarity index 68% rename from telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/RadioSecondJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioSecondJsunit.test.ets index c4a9207ba62ee1ebc996590591d209abeebc4c26..3ae50bb8dc46b6ee1f6309cb6055612420a6eb3e 100644 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/RadioSecondJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioSecondJsunit.test.ets @@ -65,63 +65,9 @@ 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 * @tc.name Test getNrOptionMode() to check the callback result @@ -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(); diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/SmsMmsJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/SmsMmsJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..52217aac4fef419488eb4d2d2f4e8b35300d6cef --- /dev/null +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/SmsMmsJsunit.test.ets @@ -0,0 +1,160 @@ +// @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(); + }); + }) +} diff --git a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/StatisticsJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/StatisticsJsunit.test.ets similarity index 97% rename from telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/StatisticsJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/StatisticsJsunit.test.ets index 8535e83e68597b014713c0240a543ac012b707b1..66c5424aba8d035b718b85123bae0fa9f0969ff6 100644 --- a/telephony/telephonyjstest/new_add/entry/src/main/ets/MainAbility/test/StatisticsJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/StatisticsJsunit.test.ets @@ -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 diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/Utils.ets similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/Utils.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/Utils.ets diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/lib/Const.js similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/lib/Const.js rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/lib/Const.js diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/element/string.json similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/element/string.json rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/element/string.json diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/media/icon.png similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/media/icon.png rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/media/icon.png diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/hand.png b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/hand.png similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/hand.png rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/hand.png diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/icon.png b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/icon.png similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/icon.png rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/icon.png diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/images.jpg b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/images.jpg similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/images.jpg rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/images.jpg diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/person.png b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/person.png similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/person.png rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/person.png diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-1.png b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/star-1-1.png similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-1.png rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/star-1-1.png diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-2.png b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/star-1-2.png similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-2.png rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/star-1-2.png diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-3.png b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/star-1-3.png similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-3.png rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/star-1-3.png diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/video/show.mp4 b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/video/show.mp4 similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/video/show.mp4 rename to telephony/telephonyjstest/radiostatistic/entry/src/main/resources/rawfile/video/show.mp4 diff --git a/telephony/telephonyjstest/contact_function_merge/signature/openharmony_sx.p7b b/telephony/telephonyjstest/radiostatistic/signature/openharmony_sx.p7b similarity index 100% rename from telephony/telephonyjstest/contact_function_merge/signature/openharmony_sx.p7b rename to telephony/telephonyjstest/radiostatistic/signature/openharmony_sx.p7b diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js index 573151c81832b6dd1b6f05bff5127df94551a753..6b8d6a20256d10f01a9d2f1c7f3b3c0afa9dd3eb 100644 --- a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js +++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js @@ -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>), 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> - * 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) 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 - * 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) 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 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) 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.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) => { + * @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; } - 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.desc Function test - */ - it('Telephony_Sim_getSimTelephoneNumber_Promise_0600', 0, async function (done) { - const CASE_NAME = 'Telephony_Sim_getSimTelephoneNumber_Promise_0600'; - let data; + * @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 { - 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.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) => { + * @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) { - 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.desc Function test - */ - it('Telephony_Sim_getVoiceMailNumber_Promise_0600', 0, async function (done) { - const CASE_NAME = 'Telephony_Sim_getVoiceMailNumber_Promise_0600'; - let data; + * @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 { - 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 +}) diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/SmsMmsError.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/SmsMmsError.test.js index 3b5ceded15004413fc10c80d7c993594b909d57d..ea7bd68f2519038b2bf7f7fbba5ab23313c30c1b 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/SmsMmsError.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/SmsMmsError.test.js @@ -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) { - expect(result[0].shortMessage != null).assertTrue(); - expect(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,36 +69,7 @@ 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 * @tc.name Call interface CreateMessage, @@ -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