From 7894efaa18e0e8defde7d4eb60e22b2a9f9f47b9 Mon Sep 17 00:00:00 2001 From: jianghuanhuan Date: Fri, 14 Jul 2023 16:25:18 +0800 Subject: [PATCH] =?UTF-8?q?telephony-=E6=8E=A5=E5=8F=A3=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jianghuanhuan --- .../src/main/ets/test/DataJsunit.test.ets | 15 ++ .../src/main/ets/test/SmsMmsJsunit.test.ets | 47 ++++++ .../src/main/js/test/SimManager.test.js | 140 ++++++++++++++++++ 3 files changed, 202 insertions(+) diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets index 33c3ebb67..72f6381d8 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets @@ -158,6 +158,21 @@ export default function dataJsunit() { console.log(`==========> ${caseName} Test end ==========>`); done(); }); + + /** + * @tc.number Telephony_Data_DefaultCellularDataSimId_DATA_GET_SimId + * @tc.name Enum DataConnectState + * @tc.desc Enum value test + */ + it("Telephony_Data_DefaultCellularDataSimId_DATA_GET_SimId", 0, async function (done) { + let caseName = 'Telephony_Data_DefaultCellularDataSimId_DATA_GET_SimId'; + console.log(`==========> ${caseName} Test start ==========>`); + console.log("Result: "+ data.getDefaultCellularDataSimId()); + expect(true).assertTrue(); + console.log(`==========> ${caseName} Test end ==========>`); + done(); + }); + }); } diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets index d873be974..122835ce1 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets @@ -14,6 +14,7 @@ */ import { describe, expect, it } from '@ohos/hypium'; import sms from '@ohos.telephony.sms'; +import radio from '@ohos.telephony.radio'; export default function smsUiJsunit() { describe('smsUiJsunit', function () { @@ -120,5 +121,51 @@ export default function smsUiJsunit() { expect(sms.ShortMessageClass.FORWARD_MESSAGE == 4).assertTrue(); done(); }); + + /** + * @tc.number Telephony_Sms_getDefaultSmsSimId_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sms_getDefaultSmsSimId_CallBack_0100', 0, async function (done) { + sms.getDefaultSmsSimId((err, data) => { + if(err){ + console.info("Telephony_Sms_getDefaultSmsSimId_CallBack_0100 err = " + JSON.stringify(data)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sms_getDefaultSmsSimId_CallBack_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + return; + } + console.log(`Telephony_Sms_getDefaultSmsSimId_CallBack_0100 callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + expect(true).assertTrue(); + done(); + }); + }); + /** + * @tc.number Telephony_Sms_getDefaultSmsSimId_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sms_getDefaultSmsSimId_Promise_0100', 0, async function (done) { + let promise = sms.getDefaultSmsSimId(); + promise.then(data => { + console.info("Telephony_Sms_getDefaultSmsSimId_Promise_0100 data = " + JSON.stringify(data)); + expect(true).assertTrue(); + done(); + }).catch(err => { + console.info("Telephony_Sms_getDefaultSmsSimId_Promise_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sms_getDefaultSmsSimId_Promise_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + }); + }); }) } diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js b/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js index b9391aec2..a4afa9ed9 100644 --- a/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js +++ b/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js @@ -14,6 +14,7 @@ */ import sim from '@ohos.telephony.sim'; +import radio from '@ohos.telephony.radio'; import * as env from './lib/Const'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' export default function SimManagerTest() { @@ -496,5 +497,144 @@ describe('SimManagerTest', function () { done(); }); }); + /** + * @tc.number Telephony_Sim_getSimAccountInfo_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getSimAccountInfo_CallBack_0100', 0, async function (done) { + sim.getSimAccountInfo(0, (err, data) => { + if(err){ + console.info("Telephony_Sim_getSimAccountInfo_CallBack_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getSimAccountInfo_CallBack_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + return; + } + console.log(`Telephony_Sim_getSimAccountInfo_CallBack_0100 callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + expect(true).assertTrue(); + done(); + }); + }); + /** + * @tc.number Telephony_Sim_getSimAccountInfo_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getSimAccountInfo_Promise_0100', 0, async function (done) { + let promise = sim.getSimAccountInfo(0); + promise.then(data => { + console.info("Telephony_Sim_getSimAccountInfo_Promise_0100 data = " + JSON.stringify(data)); + expect(true).assertTrue(); + done(); + }).catch(err => { + console.info("Telephony_Sim_getSimAccountInfo_Promise_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getSimAccountInfo_Promise_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + }); + }); + /** + * @tc.number Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100', 0, async function (done) { + sim.getActiveSimAccountInfoList((err, data) => { + if(err){ + console.info("Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + return; + } + console.log(`Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100 callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + expect(true).assertTrue(); + done(); + }); + }); + /** + * @tc.number Telephony_Sim_getActiveSimAccountInfoList_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getActiveSimAccountInfoList_Promise_0100', 0, async function (done) { + let promise = sim.getActiveSimAccountInfoList(); + promise.then(data => { + console.info("Telephony_Sim_getActiveSimAccountInfoList_Promise_0100 data = " + JSON.stringify(data)); + expect(true).assertTrue(); + done(); + }).catch(err => { + console.info("Telephony_Sim_getActiveSimAccountInfoList_Promise_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getActiveSimAccountInfoList_Promise_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + }); + }); + + /** + * @tc.number Telephony_Sim_getDefaultVoiceSimId_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getDefaultVoiceSimId_CallBack_0100', 0, async function (done) { + sim.getDefaultVoiceSimId((err, data) => { + if(err){ + console.info("Telephony_Sim_getDefaultVoiceSimId_CallBack_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getDefaultVoiceSimId_CallBack_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + return; + } + console.log(`Telephony_Sim_getDefaultVoiceSimId_CallBack_0100 callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + expect(true).assertTrue(); + done(); + }); + }); + /** + * @tc.number Telephony_Sim_getDefaultVoiceSimId_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getDefaultVoiceSimId_Promise_0100', 0, async function (done) { + let promise = sim.getDefaultVoiceSimId(); + promise.then(data => { + console.info("Telephony_Sim_getDefaultVoiceSimId_Promise_0100 data = " + JSON.stringify(data)); + expect(true).assertTrue(); + done(); + }).catch(err => { + console.info("Telephony_Sim_getDefaultVoiceSimId_Promise_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getDefaultVoiceSimId_Promise_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + }); + }); + + + }) } -- GitLab