From 792596583c95c863b6be70463aa2ab57b424dd8a Mon Sep 17 00:00:00 2001 From: quannini Date: Sat, 29 Oct 2022 17:55:33 +0800 Subject: [PATCH] up up codec case Signed-off-by: quannini --- .../hdi_adapter/codec_hdi_adapter_test.cpp | 104 ++++++++++++++++++ hdf/codec/hdi_v1.0/codec_proxy_test.cpp | 14 +++ 2 files changed, 118 insertions(+) diff --git a/hdf/codec/hdi_adapter/codec_hdi_adapter_test.cpp b/hdf/codec/hdi_adapter/codec_hdi_adapter_test.cpp index 6c324cd9..f3ea6996 100644 --- a/hdf/codec/hdi_adapter/codec_hdi_adapter_test.cpp +++ b/hdf/codec/hdi_adapter/codec_hdi_adapter_test.cpp @@ -593,6 +593,110 @@ HWTEST_F(CodecHdiAdapterTest, SUB_DriverSystem_CodecHdi_adapter_0240, Function | ASSERT_EQ(ret, HDF_SUCCESS); } /** +* @tc.name HdfCodecHdiGetStateSuccessTest_002 +* @tc.number SUB_DriverSystem_CodecHdi_adapter_0241 +* @tc.desc When state is set to OMX_StateInvalid, the GetState interface is invoked to obtain the component status +*/ +HWTEST_F(CodecHdiAdapterTest, SUB_DriverSystem_CodecHdi_adapter_0241, Function | MediumTest | Level3) +{ + ASSERT_TRUE(g_component != nullptr); + OMX_STATETYPE state; + int32_t ret = g_component->GetState(g_component, &state); + ASSERT_NE(state, OMX_StateInvalid); + ASSERT_EQ(ret, HDF_SUCCESS); +} +/** +* @tc.name HdfCodecHdiGetStateSuccessTest_003 +* @tc.number SUB_DriverSystem_CodecHdi_adapter_0242 +* @tc.desc When state is set to OMX_StateExecuting, the GetState interface is invoked to obtain the component status +*/ +HWTEST_F(CodecHdiAdapterTest, SUB_DriverSystem_CodecHdi_adapter_0242, Function | MediumTest | Level3) +{ + ASSERT_TRUE(g_component != nullptr); + OMX_STATETYPE state; + int32_t ret = g_component->GetState(g_component, &state); + ASSERT_NE(state, OMX_StateExecuting); + ASSERT_EQ(ret, HDF_SUCCESS); +} +/** +* @tc.name HdfCodecHdiGetStateSuccessTest_004 +* @tc.number SUB_DriverSystem_CodecHdi_adapter_0243 +* @tc.desc When state is set to OMX_StateIdle, the GetState interface is invoked to obtain the component status +*/ +HWTEST_F(CodecHdiAdapterTest, SUB_DriverSystem_CodecHdi_adapter_0243, Function | MediumTest | Level3) +{ + ASSERT_TRUE(g_component != nullptr); + OMX_STATETYPE state; + int32_t ret = g_component->GetState(g_component, &state); + ASSERT_NE(state, OMX_StateIdle); + ASSERT_EQ(ret, HDF_SUCCESS); +} +/** +* @tc.name HdfCodecHdiGetStateSuccessTest_005 +* @tc.number SUB_DriverSystem_CodecHdi_adapter_0244 +* @tc.desc When state is set to OMX_StatePause, the GetState interface is invoked to obtain the component status +*/ +HWTEST_F(CodecHdiAdapterTest, SUB_DriverSystem_CodecHdi_adapter_0244, Function | MediumTest | Level3) +{ + ASSERT_TRUE(g_component != nullptr); + OMX_STATETYPE state; + int32_t ret = g_component->GetState(g_component, &state); + ASSERT_NE(state, OMX_StatePause); + ASSERT_EQ(ret, HDF_SUCCESS); +} +/** +* @tc.name HdfCodecHdiGetStateSuccessTest_006 +* @tc.number SUB_DriverSystem_CodecHdi_adapter_0245 +* @tc.desc When state is set to OMX_StateWaitForResources, the GetState interface is invoked to obtain the component status +*/ +HWTEST_F(CodecHdiAdapterTest, SUB_DriverSystem_CodecHdi_adapter_0245, Function | MediumTest | Level3) +{ + ASSERT_TRUE(g_component != nullptr); + OMX_STATETYPE state; + int32_t ret = g_component->GetState(g_component, &state); + ASSERT_NE(state, OMX_StateWaitForResources); + ASSERT_EQ(ret, HDF_SUCCESS); +} +/** +* @tc.name HdfCodecHdiGetStateSuccessTest_007 +* @tc.number SUB_DriverSystem_CodecHdi_adapter_0246 +* @tc.desc When state is set to OMX_StateKhronosExtensions, the GetState interface is invoked to obtain the component status +*/ +HWTEST_F(CodecHdiAdapterTest, SUB_DriverSystem_CodecHdi_adapter_0246, Function | MediumTest | Level3) +{ + ASSERT_TRUE(g_component != nullptr); + OMX_STATETYPE state; + int32_t ret = g_component->GetState(g_component, &state); + ASSERT_NE(state, OMX_StateKhronosExtensions); + ASSERT_EQ(ret, HDF_SUCCESS); +} +/** +* @tc.name HdfCodecHdiGetStateSuccessTest_008 +* @tc.number SUB_DriverSystem_CodecHdi_adapter_0247 +* @tc.desc When state is set to OMX_StateVendorStartUnused, the GetState interface is invoked to obtain the component status +*/ +HWTEST_F(CodecHdiAdapterTest, SUB_DriverSystem_CodecHdi_adapter_0247, Function | MediumTest | Level3) +{ + ASSERT_TRUE(g_component != nullptr); + OMX_STATETYPE state; + int32_t ret = g_component->GetState(g_component, &state); + ASSERT_NE(state, OMX_StateVendorStartUnused); + ASSERT_EQ(ret, HDF_SUCCESS); +} +/** +* @tc.name HdfCodecHdiGetStateSuccessTest_009 +* @tc.number SUB_DriverSystem_CodecHdi_adapter_0248 +* @tc.desc When state is set to OMX_StateMax, the GetState interface is invoked to obtain the component status +*/ +HWTEST_F(CodecHdiAdapterTest, SUB_DriverSystem_CodecHdi_adapter_0248, Function | MediumTest | Level3) +{ + ASSERT_TRUE(g_component != nullptr); + OMX_STATETYPE state; + int32_t ret = g_component->GetState(g_component, &state); + ASSERT_NE(state, OMX_StateMax); + ASSERT_EQ(ret, HDF_SUCCESS); +} +/** * @tc.name HdfCodecHdiGetStateStateNullptrTest_002 * @tc.number SUB_DriverSystem_CodecHdi_adapter_0250 * @tc.desc When state is set to nullptr, the GetState interface is invoked to obtain the component status diff --git a/hdf/codec/hdi_v1.0/codec_proxy_test.cpp b/hdf/codec/hdi_v1.0/codec_proxy_test.cpp index 0b2e8011..bd733dbc 100644 --- a/hdf/codec/hdi_v1.0/codec_proxy_test.cpp +++ b/hdf/codec/hdi_v1.0/codec_proxy_test.cpp @@ -197,6 +197,20 @@ HWTEST_F(CodecProxyTest, HdfCodecHdiV1CreateCodecByTypeTest_003, TestSize.Level1 ASSERT_EQ(errorCode, HDF_ERR_NOT_SUPPORT); } +HWTEST_F(CodecProxyTest, HdfCodecHdiV1CreateCodecByTypeTest_004 TestSize.Level1) +{ + AvCodecMime mime = MEDIA_MIMETYPE_VIDEO_AVC; + int32_t errorCode = g_codecObj->CodecCreateByType(g_codecObj, AUDIO_ENCODER, mime, &g_handle); + ASSERT_EQ(errorCode, HDF_ERR_NOT_SUPPORT); +} + +HWTEST_F(CodecProxyTest, HdfCodecHdiV1CreateCodecByTypeTest_005, TestSize.Level1) +{ + AvCodecMime mime = MEDIA_MIMETYPE_VIDEO_AVC; + int32_t errorCode = g_codecObj->CodecCreateByType(g_codecObj, INVALID_TYPE, mime, &g_handle); + ASSERT_EQ(errorCode, HDF_ERR_NOT_SUPPORT); +} + HWTEST_F(CodecProxyTest, HdfCodecHdiV1SetPortModeTest_001, TestSize.Level1) { DirectionType direct = OUTPUT_TYPE;