From 80420b38fc40952e5a7d73d2178262ba8ad65da9 Mon Sep 17 00:00:00 2001 From: xjh2290 Date: Tue, 17 Jun 2025 20:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=94=A8=E4=BE=8B=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xjh2290 --- .../unittest/satellitetest/satellite_test.cpp | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/test/unittest/satellitetest/satellite_test.cpp b/test/unittest/satellitetest/satellite_test.cpp index 61d8d796..c145e4af 100644 --- a/test/unittest/satellitetest/satellite_test.cpp +++ b/test/unittest/satellitetest/satellite_test.cpp @@ -51,6 +51,14 @@ public: return hasSimCard; } + bool CanUseImsService(int32_t slotId, ImsServiceType type) + { + ImsRegInfo info; + CoreServiceClient::GetInstance().GetImsRegStatus(slotId, type, info); + bool imsReg = info.imsRegState == ImsRegState::IMS_REGISTERED; + return imsReg; + } + int32_t InitCellularCallInfo(int32_t accountId, std::string phonenumber, CellularCallInfo &callInfo) { callInfo.accountId = accountId; @@ -287,7 +295,7 @@ HWTEST_F(SatelliteTest, Satellite_call_StartDtmf_0001, Function | MediumTest | L ASSERT_TRUE(startDtmfRemote != nullptr); auto telephonyService = iface_cast(startDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -295,7 +303,7 @@ HWTEST_F(SatelliteTest, Satellite_call_StartDtmf_0001, Function | MediumTest | L ret = telephonyService->StartDtmf(code, callInfo); EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } - if (HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -320,14 +328,14 @@ HWTEST_F(SatelliteTest, Satellite_call_StartDtmf_0002, Function | MediumTest | L auto telephonyService = iface_cast(startDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); CellularCallInfo callInfo; - if (HasSimCard(SIM1_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); char code = '1'; ret = telephonyService->StartDtmf(code, callInfo); EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); } - if (HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); char code = '1'; @@ -350,14 +358,14 @@ HWTEST_F(SatelliteTest, Satellite_call_StopDtmf_0001, Function | MediumTest | Le ASSERT_TRUE(stopDtmfRemote != nullptr); auto telephonyService = iface_cast(stopDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); ret = telephonyService->StopDtmf(callInfo); EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } - if (HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -380,14 +388,14 @@ HWTEST_F(SatelliteTest, Satellite_call_StopDtmf_0002, Function | MediumTest | Le ASSERT_TRUE(stopDtmfRemote != nullptr); auto telephonyService = iface_cast(stopDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo stopDtmfCallInfo; int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); ret = telephonyService->StopDtmf(stopDtmfCallInfo); EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); } - if (HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo stopDtmfCallInfo; int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -410,7 +418,7 @@ HWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0001, Function | MediumTest | Le ASSERT_TRUE(sendDtmfRemote != nullptr); auto telephonyService = iface_cast(sendDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo sendDtmfCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -418,7 +426,7 @@ HWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0001, Function | MediumTest | Le ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } - if (HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo sendDtmfCallInfo; int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -442,7 +450,7 @@ HWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0002, Function | MediumTest | Le ASSERT_TRUE(sendDtmfRemote != nullptr); auto telephonyService = iface_cast(sendDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo sendDtmfCallInfo; int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -450,7 +458,7 @@ HWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0002, Function | MediumTest | Le ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); } - if (HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { CellularCallInfo sendDtmfCallInfo; int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); EXPECT_EQ(ret, TELEPHONY_SUCCESS); -- Gitee