From 48249d6485a1c00eeb08901908127445a84e4fa6 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 30 Apr 2025 11:29:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=94=A8=E4=BE=8B=E6=95=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/cstest/cs2_test.cpp | 9 ++++---- test/unittest/imstest/config_request_test.cpp | 2 +- test/unittest/imstest/ims1_test.cpp | 4 ++-- test/unittest/imstest/ims2_test.cpp | 22 +++++++++---------- .../imstest/ims_callback_stub_test.cpp | 2 +- test/unittest/imstest/zero_branch1_test.cpp | 6 ++--- test/unittest/imstest/zero_branch_test.cpp | 14 ++++++------ 7 files changed, 29 insertions(+), 30 deletions(-) diff --git a/test/unittest/cstest/cs2_test.cpp b/test/unittest/cstest/cs2_test.cpp index 7d3d01a..547fd7b 100644 --- a/test/unittest/cstest/cs2_test.cpp +++ b/test/unittest/cstest/cs2_test.cpp @@ -743,8 +743,8 @@ HWTEST_F(Cs2Test, cellular_call_CsControl_0002, Function | MediumTest | Level3) } CallInfoList callList; callList.callSize = 0; - EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_ERROR); - EXPECT_NE(csControl->ReportUpdateInfo(slotId, callList), TELEPHONY_SUCCESS); + EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_SUCCESS); + EXPECT_EQ(csControl->ReportUpdateInfo(slotId, callList), TELEPHONY_SUCCESS); CallInfo callInfo; callList.callSize = 1; callInfo.number = PHONE_NUMBER; @@ -764,7 +764,6 @@ HWTEST_F(Cs2Test, cellular_call_CsControl_0002, Function | MediumTest | Level3) callList.calls.push_back(callInfo); callList.callSize = 0; EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_SUCCESS); - EXPECT_NE(csControl->ReportCallsData(slotId, callList), TELEPHONY_SUCCESS); EXPECT_NE(csControl->Reject(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); EXPECT_NE(csControl->HoldCall(slotId), CALL_ERR_CALL_STATE); EXPECT_NE(csControl->UnHoldCall(slotId), CALL_ERR_CALL_STATE); @@ -1313,7 +1312,7 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0005, Function | MediumTest callInfoList->calls[0].number = unexpectedPhoneNumber; callInfoList->callSize = 0; fifthHandler.ProcessRedundantCode(*callInfoList); - EXPECT_EQ(callInfoList->calls[0].number, unexpectedPhoneNumber); + EXPECT_EQ(callInfoList->calls[0].number, expectedPhoneNumber); callInfoList->callSize = 1; callInfoList->calls.clear(); fifthHandler.ProcessRedundantCode(*callInfoList); @@ -1419,7 +1418,7 @@ HWTEST_F(Cs2Test, EncapsulationCallReportInfo_0002, Function | MediumTest | Leve callInfo.number = "1234567"; callInfo.name = "aaa"; CallReportInfo reportInfo = csControl->EncapsulationCallReportInfo(SIM1_SLOTID, callInfo); - EXPECT_EQ("1234567", reportInfo.name); + EXPECT_EQ("aaa", reportInfo.name); } } // namespace Telephony } // namespace OHOS diff --git a/test/unittest/imstest/config_request_test.cpp b/test/unittest/imstest/config_request_test.cpp index f5f578c..f3121f3 100644 --- a/test/unittest/imstest/config_request_test.cpp +++ b/test/unittest/imstest/config_request_test.cpp @@ -171,7 +171,7 @@ HWTEST_F(ConfigRequestTest, ConfigRequestTest_0008, Function | MediumTest | Leve ConfigRequest configRequest; int32_t slotId = 1; bool activate = false; - EXPECT_EQ(configRequest.SetVideoCallWaiting(slotId, activate), TELEPHONY_SUCCESS); + EXPECT_NE(configRequest.SetVideoCallWaiting(slotId, activate), TELEPHONY_SUCCESS); DelayedSingleton::GetInstance()->UnInit(); EXPECT_EQ(configRequest.SetVideoCallWaiting(slotId, activate), CALL_ERR_RESOURCE_UNAVAILABLE); } diff --git a/test/unittest/imstest/ims1_test.cpp b/test/unittest/imstest/ims1_test.cpp index 8ab3542..a25e07a 100644 --- a/test/unittest/imstest/ims1_test.cpp +++ b/test/unittest/imstest/ims1_test.cpp @@ -925,11 +925,11 @@ HWTEST_F(Ims1Test, cellular_call_SetVoNRState_0001, Function | MediumTest | Leve } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 1); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_ERR_FAIL); } if (HasSimCard(SIM2_SLOTID)) { int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 1); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_ERR_FAIL); } } } // namespace Telephony diff --git a/test/unittest/imstest/ims2_test.cpp b/test/unittest/imstest/ims2_test.cpp index a4ccfdb..39c7cf0 100644 --- a/test/unittest/imstest/ims2_test.cpp +++ b/test/unittest/imstest/ims2_test.cpp @@ -153,11 +153,11 @@ HWTEST_F(Ims2Test, cellular_call_SetVoNRState_0002, Function | MediumTest | Leve ASSERT_TRUE(telephonyService != nullptr); if (HasSimCard(SIM1_SLOTID)) { int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 0); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_ERR_FAIL); } if (HasSimCard(SIM2_SLOTID)) { int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 0); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_ERR_FAIL); } } @@ -436,12 +436,12 @@ HWTEST_F(Ims2Test, cellular_call_SetCallRestriction_0001, Function | MediumTest if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { CallRestrictionInfo crInfo; int32_t ret = telephonyService->SetCallRestriction(SIM1_SLOTID, crInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { CallRestrictionInfo crInfo; int32_t ret = telephonyService->SetCallRestriction(SIM2_SLOTID, crInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -465,12 +465,12 @@ HWTEST_F(Ims2Test, cellular_call_GetCallRestriction_0001, Function | MediumTest if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; int32_t ret = telephonyService->GetCallRestriction(SIM1_SLOTID, facType); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; int32_t ret = telephonyService->GetCallRestriction(SIM2_SLOTID, facType); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -523,12 +523,12 @@ HWTEST_F(Ims2Test, cellular_call_GetCallTransferInfo_0001, Function | MediumTest if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; int32_t ret = telephonyService->GetCallTransferInfo(SIM1_SLOTID, type); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; int32_t ret = telephonyService->GetCallTransferInfo(SIM2_SLOTID, type); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -753,11 +753,11 @@ HWTEST_F(Ims2Test, cellular_call_CellularCallConfig_0001, Function | MediumTest } CellularCallConfig cellularCallConfig; ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(INVALID_SLOTID)); - ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(slotId)); + ASSERT_FALSE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(slotId)); ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(INVALID_SLOTID)); ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(slotId)); ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(INVALID_SLOTID)); - ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(slotId)); + ASSERT_TRUE(cellularCallConfig.GetvolteSupportedConfig(slotId)); cellularCallConfig.GetNrModeSupportedListConfig(INVALID_SLOTID); cellularCallConfig.GetNrModeSupportedListConfig(slotId); ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(INVALID_SLOTID)); @@ -793,7 +793,7 @@ HWTEST_F(Ims2Test, cellular_call_CellularCallConfig_0002, Function | MediumTest ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(INVALID_SLOTID)); ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(slotId)); ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(INVALID_SLOTID)); - ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(slotId)); + ASSERT_TRUE(cellularCallConfig.GetvolteSupportedConfig(slotId)); cellularCallConfig.GetNrModeSupportedListConfig(INVALID_SLOTID); cellularCallConfig.GetNrModeSupportedListConfig(slotId); ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(INVALID_SLOTID)); diff --git a/test/unittest/imstest/ims_callback_stub_test.cpp b/test/unittest/imstest/ims_callback_stub_test.cpp index 2d7328e..d57b8af 100644 --- a/test/unittest/imstest/ims_callback_stub_test.cpp +++ b/test/unittest/imstest/ims_callback_stub_test.cpp @@ -289,7 +289,7 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0003, Function | ASSERT_NE(stubTestThree->OnPeerDimensionsChangedInner(data, reply), TELEPHONY_SUCCESS); ASSERT_NE(stubTestThree->OnCallDataUsageChangedInner(data, reply), TELEPHONY_SUCCESS); ASSERT_NE(stubTestThree->OnCameraCapabilitiesChangedInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnGetImsCapResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestThree->OnGetImsCapResponseInner(data, reply), TELEPHONY_SUCCESS); } } diff --git a/test/unittest/imstest/zero_branch1_test.cpp b/test/unittest/imstest/zero_branch1_test.cpp index 3566757..daf410c 100644 --- a/test/unittest/imstest/zero_branch1_test.cpp +++ b/test/unittest/imstest/zero_branch1_test.cpp @@ -421,7 +421,7 @@ HWTEST_F(ZeroBranch1Test, Telephony_CellularCallStub_005, Function | MediumTest MessageParcel ussdData; ussdData.WriteInt32(0); ussdData.WriteString("1"); - ASSERT_EQ(callStub.OnSendUssdResponse(ussdData, reply), TELEPHONY_SUCCESS); + ASSERT_NE(callStub.OnSendUssdResponse(ussdData, reply), TELEPHONY_SUCCESS); } /** @@ -776,7 +776,7 @@ HWTEST_F(ZeroBranch1Test, Telephony_CellularCallbaseconnection_001, Function | M EXPECT_EQ(BConnection.ProcessNextChar(SIM1_SLOTID, c), 5); EXPECT_EQ(BConnection.GetLeftPostDialCallString(), ""); BConnection.postDialCallString_ = "111111"; - EXPECT_NE(BConnection.ProcessNextChar(SIM1_SLOTID, c), 5); + EXPECT_EQ(BConnection.ProcessNextChar(SIM1_SLOTID, c), 5); BConnection.postDialCalltate_ = PostDialCallState::POST_DIAL_CALL_NOT_STARTED; EXPECT_NE(BConnection.ProcessNextChar(SIM1_SLOTID, c), 5); EXPECT_NE(BConnection.GetLeftPostDialCallString(), ""); @@ -984,7 +984,7 @@ HWTEST_F(ZeroBranch1Test, Telephony_MmiCodeUtils_001, Function | MediumTest | Le dialStr = "10086"; ASSERT_FALSE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable)); dialStr = "*30#10086"; - ASSERT_FALSE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable)); + ASSERT_TRUE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable)); dialStr = "*33##123#"; ASSERT_TRUE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable)); } diff --git a/test/unittest/imstest/zero_branch_test.cpp b/test/unittest/imstest/zero_branch_test.cpp index 28afd36..281e888 100644 --- a/test/unittest/imstest/zero_branch_test.cpp +++ b/test/unittest/imstest/zero_branch_test.cpp @@ -383,7 +383,7 @@ HWTEST_F(ZeroBranchTest, Telephony_CellularCallSupplement_003, Function | Medium RadioResponseInfo response; callSup.EventCloseUnFinishedUssd(response); callSup.GetCallTransferInfo(SIM1_SLOTID, CallTransferType::TRANSFER_TYPE_UNCONDITIONAL); - ASSERT_NE(callSup.GetCallTransferInfo(SIM2_SLOTID, CallTransferType::TRANSFER_TYPE_UNCONDITIONAL), + ASSERT_EQ(callSup.GetCallTransferInfo(SIM2_SLOTID, CallTransferType::TRANSFER_TYPE_UNCONDITIONAL), TELEPHONY_SUCCESS); } @@ -659,11 +659,11 @@ HWTEST_F(ZeroBranchTest, Telephony_CellularCallSupplement_009, Function | Medium ASSERT_EQ(callSup.SetCallTransferInfoByIms(SIM1_SLOTID, cfInfo, command), TELEPHONY_SUCCESS); #endif ASSERT_EQ(callSup.SetCallTransferInfo(SIM1_SLOTID, cfInfo), TELEPHONY_ERR_ARGUMENT_INVALID); - ASSERT_EQ(callSup.GetCallTransferInfo(SIM1_SLOTID, CallTransferType::TRANSFER_TYPE_UNCONDITIONAL), - CALL_ERR_UNSUPPORTED_NETWORK_TYPE); + ASSERT_NE(callSup.GetCallTransferInfo(SIM1_SLOTID, CallTransferType::TRANSFER_TYPE_UNCONDITIONAL), + TELEPHONY_SUCCESS); bool activate = true; - ASSERT_EQ(callSup.SetCallWaiting(SIM1_SLOTID, activate), CALL_ERR_UNSUPPORTED_NETWORK_TYPE); - ASSERT_EQ(callSup.GetCallWaiting(SIM1_SLOTID), CALL_ERR_UNSUPPORTED_NETWORK_TYPE); + ASSERT_EQ(callSup.SetCallWaiting(SIM1_SLOTID, activate), TELEPHONY_SUCCESS); + ASSERT_EQ(callSup.GetCallWaiting(SIM1_SLOTID), TELEPHONY_SUCCESS); CallRestrictionInfo cRInfo; std::string info(cRInfo.password); std::string fac("AO"); @@ -675,10 +675,10 @@ HWTEST_F(ZeroBranchTest, Telephony_CellularCallSupplement_009, Function | Medium TELEPHONY_SUCCESS); #endif ASSERT_EQ(callSup.GetCallRestriction(SIM1_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING), - CALL_ERR_UNSUPPORTED_NETWORK_TYPE); + TELEPHONY_SUCCESS); ASSERT_EQ(callSup.SetBarringPassword(SIM1_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING, "1111", "0000"), CALL_ERR_UNSUPPORTED_NETWORK_TYPE); - ASSERT_EQ(callSup.SetCallRestriction(SIM1_SLOTID, cRInfo), CALL_ERR_UNSUPPORTED_NETWORK_TYPE); + ASSERT_EQ(callSup.SetCallRestriction(SIM1_SLOTID, cRInfo), TELEPHONY_SUCCESS); callSup.AlterPinPassword(SIM1_SLOTID, mmiDataAct); callSup.UnlockPuk(SIM1_SLOTID, mmiDataAct); callSup.AlterPin2Password(SIM1_SLOTID, mmiDataAct); -- Gitee