14d949f91Sopenharmony_ci/* 24d949f91Sopenharmony_ci * Copyright (C) 2024 Huawei Device Co., Ltd. 34d949f91Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 44d949f91Sopenharmony_ci * you may not use this file except in compliance with the License. 54d949f91Sopenharmony_ci * You may obtain a copy of the License at 64d949f91Sopenharmony_ci * 74d949f91Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 84d949f91Sopenharmony_ci * 94d949f91Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 104d949f91Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 114d949f91Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 124d949f91Sopenharmony_ci * See the License for the specific language governing permissions and 134d949f91Sopenharmony_ci * limitations under the License. 144d949f91Sopenharmony_ci */ 154d949f91Sopenharmony_ci 164d949f91Sopenharmony_ci#include "image_effect_capi_unittest.h" 174d949f91Sopenharmony_ci#include "image_effect.h" 184d949f91Sopenharmony_ci#include "image_effect_filter.h" 194d949f91Sopenharmony_ci#include "pixelmap_native_impl.h" 204d949f91Sopenharmony_ci#include "efilter_factory.h" 214d949f91Sopenharmony_ci#include "brightness_efilter.h" 224d949f91Sopenharmony_ci#include "contrast_efilter.h" 234d949f91Sopenharmony_ci#include "test_common.h" 244d949f91Sopenharmony_ci#include "native_window.h" 254d949f91Sopenharmony_ci#include "external_loader.h" 264d949f91Sopenharmony_ci#include "crop_efilter.h" 274d949f91Sopenharmony_ci#include "test_pixel_map_utils.h" 284d949f91Sopenharmony_ci 294d949f91Sopenharmony_ci#define MAX_TEST_ADD_EFILTE_NUMS 120 304d949f91Sopenharmony_ci 314d949f91Sopenharmony_ciusing namespace testing::ext; 324d949f91Sopenharmony_ciusing ::testing::A; 334d949f91Sopenharmony_ciusing ::testing::InSequence; 344d949f91Sopenharmony_ciusing ::testing::Mock; 354d949f91Sopenharmony_ciusing namespace OHOS::Media::Effect::Test; 364d949f91Sopenharmony_ci 374d949f91Sopenharmony_cistatic std::string g_jpgHdrPath; 384d949f91Sopenharmony_ci 394d949f91Sopenharmony_cinamespace { 404d949f91Sopenharmony_ci constexpr uint32_t CROP_FACTOR = 2; 414d949f91Sopenharmony_ci} 424d949f91Sopenharmony_ci 434d949f91Sopenharmony_cinamespace OHOS { 444d949f91Sopenharmony_cinamespace Media { 454d949f91Sopenharmony_cinamespace Effect { 464d949f91Sopenharmony_civoid ImageEffectCApiUnittest::SetUpTestCase() 474d949f91Sopenharmony_ci{ 484d949f91Sopenharmony_ci g_jpgHdrPath = std::string("/data/test/resource/image_effect_hdr_test1.jpg"); 494d949f91Sopenharmony_ci consumerSurface_ = Surface::CreateSurfaceAsConsumer("UnitTest"); 504d949f91Sopenharmony_ci sptr<IBufferProducer> producer = consumerSurface_->GetProducer(); 514d949f91Sopenharmony_ci ohSurface_ = Surface::CreateSurfaceAsProducer(producer); 524d949f91Sopenharmony_ci nativeWindow_ = CreateNativeWindowFromSurface(&ohSurface_); 534d949f91Sopenharmony_ci} 544d949f91Sopenharmony_ci 554d949f91Sopenharmony_civoid ImageEffectCApiUnittest::TearDownTestCase() 564d949f91Sopenharmony_ci{ 574d949f91Sopenharmony_ci if (nativeWindow_ != nullptr) { 584d949f91Sopenharmony_ci DestoryNativeWindow(nativeWindow_); 594d949f91Sopenharmony_ci nativeWindow_ = nullptr; 604d949f91Sopenharmony_ci } 614d949f91Sopenharmony_ci consumerSurface_ = nullptr; 624d949f91Sopenharmony_ci ohSurface_ = nullptr; 634d949f91Sopenharmony_ci} 644d949f91Sopenharmony_ci 654d949f91Sopenharmony_civoid ImageEffectCApiUnittest::SetUp() 664d949f91Sopenharmony_ci{ 674d949f91Sopenharmony_ci mockPixelMap_ = std::make_shared<MockPixelMap>(); 684d949f91Sopenharmony_ci pixelmapNative_ = new OH_PixelmapNative(mockPixelMap_); 694d949f91Sopenharmony_ci ExternLoader::Instance()->InitExt(); 704d949f91Sopenharmony_ci EFilterFactory::Instance()->functions_.clear(); 714d949f91Sopenharmony_ci EFilterFactory::Instance()->RegisterEFilter<BrightnessEFilter>(BRIGHTNESS_EFILTER); 724d949f91Sopenharmony_ci EFilterFactory::Instance()->RegisterEFilter<ContrastEFilter>(CONTRAST_EFILTER); 734d949f91Sopenharmony_ci EFilterFactory::Instance()->RegisterEFilter<CropEFilter>(CROP_EFILTER); 744d949f91Sopenharmony_ci EFilterFactory::Instance()->delegates_.clear(); 754d949f91Sopenharmony_ci filterInfo_ = OH_EffectFilterInfo_Create(); 764d949f91Sopenharmony_ci OH_EffectFilterInfo_SetFilterName(filterInfo_, BRIGHTNESS_EFILTER); 774d949f91Sopenharmony_ci ImageEffect_BufferType bufferTypes[] = { ImageEffect_BufferType::EFFECT_BUFFER_TYPE_PIXEL }; 784d949f91Sopenharmony_ci OH_EffectFilterInfo_SetSupportedBufferTypes(filterInfo_, sizeof(bufferTypes) / sizeof(ImageEffect_BufferType), 794d949f91Sopenharmony_ci bufferTypes); 804d949f91Sopenharmony_ci ImageEffect_Format formats[] = { ImageEffect_Format::EFFECT_PIXEL_FORMAT_RGBA8888, 814d949f91Sopenharmony_ci ImageEffect_Format::EFFECT_PIXEL_FORMAT_NV12, ImageEffect_Format::EFFECT_PIXEL_FORMAT_NV21}; 824d949f91Sopenharmony_ci OH_EffectFilterInfo_SetSupportedFormats(filterInfo_, sizeof(formats) / sizeof(ImageEffect_Format), formats); 834d949f91Sopenharmony_ci} 844d949f91Sopenharmony_ci 854d949f91Sopenharmony_civoid ImageEffectCApiUnittest::TearDown() 864d949f91Sopenharmony_ci{ 874d949f91Sopenharmony_ci delete pixelmapNative_; 884d949f91Sopenharmony_ci pixelmapNative_ = nullptr; 894d949f91Sopenharmony_ci mockPixelMap_ = nullptr; 904d949f91Sopenharmony_ci if (filterInfo_ != nullptr) { 914d949f91Sopenharmony_ci OH_EffectFilterInfo_Release(filterInfo_); 924d949f91Sopenharmony_ci filterInfo_ = nullptr; 934d949f91Sopenharmony_ci } 944d949f91Sopenharmony_ci} 954d949f91Sopenharmony_ci 964d949f91Sopenharmony_ci/** 974d949f91Sopenharmony_ci * Feature: ImageEffect 984d949f91Sopenharmony_ci * Function: Test image_effect capi unittest example 994d949f91Sopenharmony_ci * SubFunction: NA 1004d949f91Sopenharmony_ci * FunctionPoints: NA 1014d949f91Sopenharmony_ci * EnvConditions: NA 1024d949f91Sopenharmony_ci * CaseDescription: Test image_effect capi unittest example 1034d949f91Sopenharmony_ci */ 1044d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, Image_effect_capi_unittest_001, TestSize.Level1) 1054d949f91Sopenharmony_ci{ 1064d949f91Sopenharmony_ci InSequence s; 1074d949f91Sopenharmony_ci 1084d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 1094d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr); 1104d949f91Sopenharmony_ci 1114d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 1124d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr); 1134d949f91Sopenharmony_ci 1144d949f91Sopenharmony_ci ImageEffect_Any value; 1154d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 1164d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 1174d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 1184d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 1194d949f91Sopenharmony_ci 1204d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 1214d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 1224d949f91Sopenharmony_ci 1234d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(imageEffect); 1244d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 1254d949f91Sopenharmony_ci 1264d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 1274d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 1284d949f91Sopenharmony_ci} 1294d949f91Sopenharmony_ci 1304d949f91Sopenharmony_ci/** 1314d949f91Sopenharmony_ci * Feature: ImageEffect 1324d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Create with normal parameter 1334d949f91Sopenharmony_ci * SubFunction: NA 1344d949f91Sopenharmony_ci * FunctionPoints: NA 1354d949f91Sopenharmony_ci * EnvConditions: NA 1364d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Create with normal parameter 1374d949f91Sopenharmony_ci */ 1384d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectCreate001, TestSize.Level1) 1394d949f91Sopenharmony_ci{ 1404d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectCreate001 start"; 1414d949f91Sopenharmony_ci 1424d949f91Sopenharmony_ci OH_ImageEffect *nativeImageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 1434d949f91Sopenharmony_ci ASSERT_NE(nativeImageEffect, nullptr) << "OH_ImageEffect_Create failed"; 1444d949f91Sopenharmony_ci 1454d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectCreate001 success! result: " << nativeImageEffect; 1464d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectCreate001 END"; 1474d949f91Sopenharmony_ci} 1484d949f91Sopenharmony_ci 1494d949f91Sopenharmony_ci/** 1504d949f91Sopenharmony_ci * Feature: ImageEffect 1514d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Create with empty parameter 1524d949f91Sopenharmony_ci * SubFunction: NA 1534d949f91Sopenharmony_ci * FunctionPoints: NA 1544d949f91Sopenharmony_ci * EnvConditions: NA 1554d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Create with empty parameter 1564d949f91Sopenharmony_ci */ 1574d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectCreate002, TestSize.Level1) 1584d949f91Sopenharmony_ci{ 1594d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectCreate002 start"; 1604d949f91Sopenharmony_ci 1614d949f91Sopenharmony_ci OH_ImageEffect *nativeImageEffect = OH_ImageEffect_Create(nullptr); 1624d949f91Sopenharmony_ci ASSERT_NE(nativeImageEffect, nullptr) << "OH_ImageEffect_Create failed"; 1634d949f91Sopenharmony_ci 1644d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectCreate002 success! result: " << nativeImageEffect; 1654d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectCreate002 END"; 1664d949f91Sopenharmony_ci} 1674d949f91Sopenharmony_ci 1684d949f91Sopenharmony_ci/** 1694d949f91Sopenharmony_ci * Feature: ImageEffect 1704d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Configure with normal parameter 1714d949f91Sopenharmony_ci * SubFunction: NA 1724d949f91Sopenharmony_ci * FunctionPoints: NA 1734d949f91Sopenharmony_ci * EnvConditions: NA 1744d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Configure with normal parameter 1754d949f91Sopenharmony_ci */ 1764d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectConfigure001, TestSize.Level1) 1774d949f91Sopenharmony_ci{ 1784d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectConfigure001 start"; 1794d949f91Sopenharmony_ci 1804d949f91Sopenharmony_ci OH_ImageEffect *nativeImageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 1814d949f91Sopenharmony_ci const char *key = "runningType"; 1824d949f91Sopenharmony_ci ImageEffect_Any value; 1834d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_INT32; 1844d949f91Sopenharmony_ci value.dataValue.int32Value = 2; 1854d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Configure(nativeImageEffect, key, &value); 1864d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Configure failed"; 1874d949f91Sopenharmony_ci 1884d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectConfigure001 success! result: " << errorCode; 1894d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectConfigure001 END"; 1904d949f91Sopenharmony_ci} 1914d949f91Sopenharmony_ci 1924d949f91Sopenharmony_ci/** 1934d949f91Sopenharmony_ci * Feature: ImageEffect 1944d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Configure with all empty parameter 1954d949f91Sopenharmony_ci * SubFunction: NA 1964d949f91Sopenharmony_ci * FunctionPoints: NA 1974d949f91Sopenharmony_ci * EnvConditions: NA 1984d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Configure with all empty parameter 1994d949f91Sopenharmony_ci */ 2004d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectConfigure002, TestSize.Level1) 2014d949f91Sopenharmony_ci{ 2024d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectConfigure002 start"; 2034d949f91Sopenharmony_ci 2044d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Configure(nullptr, nullptr, nullptr); 2054d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Configure failed"; 2064d949f91Sopenharmony_ci 2074d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectConfigure002 success! result: " << errorCode; 2084d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectConfigure002 END"; 2094d949f91Sopenharmony_ci} 2104d949f91Sopenharmony_ci 2114d949f91Sopenharmony_ci/** 2124d949f91Sopenharmony_ci * Feature: ImageEffect 2134d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Configure with empty OH_ImageEffect 2144d949f91Sopenharmony_ci * SubFunction: NA 2154d949f91Sopenharmony_ci * FunctionPoints: NA 2164d949f91Sopenharmony_ci * EnvConditions: NA 2174d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Configure with empty OH_ImageEffect 2184d949f91Sopenharmony_ci */ 2194d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectConfigure003, TestSize.Level1) 2204d949f91Sopenharmony_ci{ 2214d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectConfigure003 start"; 2224d949f91Sopenharmony_ci 2234d949f91Sopenharmony_ci const char *key = KEY_FILTER_INTENSITY; 2244d949f91Sopenharmony_ci ImageEffect_Any value; 2254d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_INT32; 2264d949f91Sopenharmony_ci value.dataValue.int32Value = 1; 2274d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Configure(nullptr, key, &value); 2284d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Configure failed"; 2294d949f91Sopenharmony_ci 2304d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectConfigure003 success! result: " << errorCode; 2314d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectConfigure003 END"; 2324d949f91Sopenharmony_ci} 2334d949f91Sopenharmony_ci 2344d949f91Sopenharmony_ci/** 2354d949f91Sopenharmony_ci * Feature: ImageEffect 2364d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Create with normal parameter 2374d949f91Sopenharmony_ci * SubFunction: NA 2384d949f91Sopenharmony_ci * FunctionPoints: NA 2394d949f91Sopenharmony_ci * EnvConditions: NA 2404d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Create with normal parameter 2414d949f91Sopenharmony_ci */ 2424d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterCreate001, TestSize.Level1) 2434d949f91Sopenharmony_ci{ 2444d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterCreate001 start"; 2454d949f91Sopenharmony_ci 2464d949f91Sopenharmony_ci OH_EffectFilter *nativeEFilter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 2474d949f91Sopenharmony_ci ASSERT_NE(nativeEFilter, nullptr) << "OH_EffectFilter_Create failed"; 2484d949f91Sopenharmony_ci 2494d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterCreate001 success! result: " << nativeEFilter; 2504d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterCreate001 END"; 2514d949f91Sopenharmony_ci} 2524d949f91Sopenharmony_ci 2534d949f91Sopenharmony_ci/** 2544d949f91Sopenharmony_ci * Feature: ImageEffect 2554d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Create with not exist parameter 2564d949f91Sopenharmony_ci * SubFunction: NA 2574d949f91Sopenharmony_ci * FunctionPoints: NA 2584d949f91Sopenharmony_ci * EnvConditions: NA 2594d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Create with not exist parameter 2604d949f91Sopenharmony_ci */ 2614d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterCreate002, TestSize.Level1) 2624d949f91Sopenharmony_ci{ 2634d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterCreate002 start"; 2644d949f91Sopenharmony_ci 2654d949f91Sopenharmony_ci OH_EffectFilter *nativeEFilter = OH_EffectFilter_Create("TestEFilter"); 2664d949f91Sopenharmony_ci ASSERT_EQ(nativeEFilter, nullptr) << "OH_EffectFilter_Create failed"; 2674d949f91Sopenharmony_ci 2684d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterCreate002 success! result: " << nativeEFilter; 2694d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterCreate002 END"; 2704d949f91Sopenharmony_ci} 2714d949f91Sopenharmony_ci 2724d949f91Sopenharmony_ci/** 2734d949f91Sopenharmony_ci * Feature: ImageEffect 2744d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Create with empty parameter 2754d949f91Sopenharmony_ci * SubFunction: NA 2764d949f91Sopenharmony_ci * FunctionPoints: NA 2774d949f91Sopenharmony_ci * EnvConditions: NA 2784d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Create with empty parameter 2794d949f91Sopenharmony_ci */ 2804d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterCreate003, TestSize.Level1) 2814d949f91Sopenharmony_ci{ 2824d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterCreate003 start"; 2834d949f91Sopenharmony_ci 2844d949f91Sopenharmony_ci OH_EffectFilter *nativeEFilter = OH_EffectFilter_Create(nullptr); 2854d949f91Sopenharmony_ci ASSERT_EQ(nativeEFilter, nullptr) << "OH_EffectFilter_Create failed"; 2864d949f91Sopenharmony_ci 2874d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterCreate003 success! result: " << nativeEFilter; 2884d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterCreate003 END"; 2894d949f91Sopenharmony_ci} 2904d949f91Sopenharmony_ci 2914d949f91Sopenharmony_ci/** 2924d949f91Sopenharmony_ci * Feature: ImageEffect 2934d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_AddFilter with normal parameter 2944d949f91Sopenharmony_ci * SubFunction: NA 2954d949f91Sopenharmony_ci * FunctionPoints: NA 2964d949f91Sopenharmony_ci * EnvConditions: NA 2974d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_AddFilter with normal parameter 2984d949f91Sopenharmony_ci */ 2994d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectAddFilter001, TestSize.Level1) 3004d949f91Sopenharmony_ci{ 3014d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter001 start"; 3024d949f91Sopenharmony_ci 3034d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 3044d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 3054d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "OH_ImageEffect_AddFilter failed"; 3064d949f91Sopenharmony_ci 3074d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectAddFilter001 success! result: " << filter; 3084d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter001 END"; 3094d949f91Sopenharmony_ci} 3104d949f91Sopenharmony_ci 3114d949f91Sopenharmony_ci/** 3124d949f91Sopenharmony_ci * Feature: ImageEffect 3134d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_AddFilter with all empty parameter 3144d949f91Sopenharmony_ci * SubFunction: NA 3154d949f91Sopenharmony_ci * FunctionPoints: NA 3164d949f91Sopenharmony_ci * EnvConditions: NA 3174d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_AddFilter with all empty parameter 3184d949f91Sopenharmony_ci */ 3194d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectAddFilter002, TestSize.Level1) 3204d949f91Sopenharmony_ci{ 3214d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter002 start"; 3224d949f91Sopenharmony_ci 3234d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(nullptr, nullptr); 3244d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "OH_ImageEffect_AddFilter failed"; 3254d949f91Sopenharmony_ci 3264d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectAddFilter002 success! result: " << filter; 3274d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter002 END"; 3284d949f91Sopenharmony_ci} 3294d949f91Sopenharmony_ci 3304d949f91Sopenharmony_ci/** 3314d949f91Sopenharmony_ci * Feature: ImageEffect 3324d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_AddFilter with empty OH_ImageEffect parameter 3334d949f91Sopenharmony_ci * SubFunction: NA 3344d949f91Sopenharmony_ci * FunctionPoints: NA 3354d949f91Sopenharmony_ci * EnvConditions: NA 3364d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_AddFilter with empty OH_ImageEffect parameter 3374d949f91Sopenharmony_ci */ 3384d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectAddFilter003, TestSize.Level1) 3394d949f91Sopenharmony_ci{ 3404d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter003 start"; 3414d949f91Sopenharmony_ci 3424d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(nullptr, BRIGHTNESS_EFILTER); 3434d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "OH_ImageEffect_AddFilter failed"; 3444d949f91Sopenharmony_ci 3454d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectAddFilter003 success! result: " << filter; 3464d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter003 END"; 3474d949f91Sopenharmony_ci} 3484d949f91Sopenharmony_ci 3494d949f91Sopenharmony_ci/** 3504d949f91Sopenharmony_ci * Feature: ImageEffect 3514d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_AddFilter with empty OH_EffectFilter parameter 3524d949f91Sopenharmony_ci * SubFunction: NA 3534d949f91Sopenharmony_ci * FunctionPoints: NA 3544d949f91Sopenharmony_ci * EnvConditions: NA 3554d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_AddFilter with empty OH_EffectFilter parameter 3564d949f91Sopenharmony_ci */ 3574d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectAddFilter004, TestSize.Level1) 3584d949f91Sopenharmony_ci{ 3594d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter004 start"; 3604d949f91Sopenharmony_ci 3614d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 3624d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, nullptr); 3634d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "OH_ImageEffect_AddFilter failed"; 3644d949f91Sopenharmony_ci 3654d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectAddFilter004 success! result: " << filter; 3664d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter004 END"; 3674d949f91Sopenharmony_ci} 3684d949f91Sopenharmony_ci 3694d949f91Sopenharmony_ci/** 3704d949f91Sopenharmony_ci * Feature: ImageEffect 3714d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_AddFilter with not exist OH_EffectFilter parameter 3724d949f91Sopenharmony_ci * SubFunction: NA 3734d949f91Sopenharmony_ci * FunctionPoints: NA 3744d949f91Sopenharmony_ci * EnvConditions: NA 3754d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_AddFilter with not exist OH_EffectFilter parameter 3764d949f91Sopenharmony_ci */ 3774d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectAddFilter005, TestSize.Level1) 3784d949f91Sopenharmony_ci{ 3794d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter005 start"; 3804d949f91Sopenharmony_ci 3814d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 3824d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, "TestEFilter"); 3834d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "OH_ImageEffect_AddFilter failed"; 3844d949f91Sopenharmony_ci 3854d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectAddFilter005 success! result: " << filter; 3864d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter005 END"; 3874d949f91Sopenharmony_ci} 3884d949f91Sopenharmony_ci 3894d949f91Sopenharmony_ci/** 3904d949f91Sopenharmony_ci * Feature: ImageEffect 3914d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_AddFilter out of max nums 3924d949f91Sopenharmony_ci * SubFunction: NA 3934d949f91Sopenharmony_ci * FunctionPoints: NA 3944d949f91Sopenharmony_ci * EnvConditions: NA 3954d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_AddFilter out of max nums 3964d949f91Sopenharmony_ci */ 3974d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectAddFilter006, TestSize.Level1) 3984d949f91Sopenharmony_ci{ 3994d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter006 start"; 4004d949f91Sopenharmony_ci 4014d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 4024d949f91Sopenharmony_ci OH_EffectFilter *filter = nullptr; 4034d949f91Sopenharmony_ci for (int i = 0; i < MAX_TEST_ADD_EFILTE_NUMS; i++) { 4044d949f91Sopenharmony_ci filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 4054d949f91Sopenharmony_ci } 4064d949f91Sopenharmony_ci filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 4074d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "OH_ImageEffect_AddFilter failed"; 4084d949f91Sopenharmony_ci 4094d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectAddFilter006 success! result: " << filter; 4104d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectAddFilter006 END"; 4114d949f91Sopenharmony_ci} 4124d949f91Sopenharmony_ci 4134d949f91Sopenharmony_ci/** 4144d949f91Sopenharmony_ci * Feature: ImageEffect 4154d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_RemoveFilter with normal parameter 4164d949f91Sopenharmony_ci * SubFunction: NA 4174d949f91Sopenharmony_ci * FunctionPoints: NA 4184d949f91Sopenharmony_ci * EnvConditions: NA 4194d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_RemoveFilter with normal parameter 4204d949f91Sopenharmony_ci */ 4214d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRemoveFilter001, TestSize.Level1) 4224d949f91Sopenharmony_ci{ 4234d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter001 start"; 4244d949f91Sopenharmony_ci 4254d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 4264d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 4274d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRemoveFilter001 OH_ImageEffect_AddFilter success! filter: " << filter; 4284d949f91Sopenharmony_ci int32_t result = OH_ImageEffect_RemoveFilter(imageEffect, BRIGHTNESS_EFILTER); 4294d949f91Sopenharmony_ci ASSERT_EQ(result, 1) << "OH_ImageEffect_RemoveFilter failed"; 4304d949f91Sopenharmony_ci 4314d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRemoveFilter001 success! result: " << result; 4324d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter001 END"; 4334d949f91Sopenharmony_ci} 4344d949f91Sopenharmony_ci 4354d949f91Sopenharmony_ci/** 4364d949f91Sopenharmony_ci * Feature: ImageEffect 4374d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_RemoveFilter with all empty parameter 4384d949f91Sopenharmony_ci * SubFunction: NA 4394d949f91Sopenharmony_ci * FunctionPoints: NA 4404d949f91Sopenharmony_ci * EnvConditions: NA 4414d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_RemoveFilter with all empty parameter 4424d949f91Sopenharmony_ci */ 4434d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRemoveFilter002, TestSize.Level1) 4444d949f91Sopenharmony_ci{ 4454d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter002 start"; 4464d949f91Sopenharmony_ci 4474d949f91Sopenharmony_ci int32_t result = OH_ImageEffect_RemoveFilter(nullptr, nullptr); 4484d949f91Sopenharmony_ci ASSERT_EQ(result, 0) << "OH_ImageEffect_RemoveFilter failed"; 4494d949f91Sopenharmony_ci 4504d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRemoveFilter002 success! result: " << result; 4514d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter002 END"; 4524d949f91Sopenharmony_ci} 4534d949f91Sopenharmony_ci 4544d949f91Sopenharmony_ci/** 4554d949f91Sopenharmony_ci * Feature: ImageEffect 4564d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_RemoveFilter with empty OH_ImageEffect parameter 4574d949f91Sopenharmony_ci * SubFunction: NA 4584d949f91Sopenharmony_ci * FunctionPoints: NA 4594d949f91Sopenharmony_ci * EnvConditions: NA 4604d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_RemoveFilter with empty OH_ImageEffect parameter 4614d949f91Sopenharmony_ci */ 4624d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRemoveFilter003, TestSize.Level1) 4634d949f91Sopenharmony_ci{ 4644d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter003 start"; 4654d949f91Sopenharmony_ci 4664d949f91Sopenharmony_ci int32_t result = OH_ImageEffect_RemoveFilter(nullptr, BRIGHTNESS_EFILTER); 4674d949f91Sopenharmony_ci ASSERT_EQ(result, 0) << "OH_ImageEffect_RemoveFilter failed"; 4684d949f91Sopenharmony_ci 4694d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRemoveFilter003 success! result: " << result; 4704d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter003 END"; 4714d949f91Sopenharmony_ci} 4724d949f91Sopenharmony_ci 4734d949f91Sopenharmony_ci/** 4744d949f91Sopenharmony_ci * Feature: ImageEffect 4754d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_RemoveFilter with empty OH_EffectFilter parameter 4764d949f91Sopenharmony_ci * SubFunction: NA 4774d949f91Sopenharmony_ci * FunctionPoints: NA 4784d949f91Sopenharmony_ci * EnvConditions: NA 4794d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_RemoveFilter with empty OH_EffectFilter parameter 4804d949f91Sopenharmony_ci */ 4814d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRemoveFilter004, TestSize.Level1) 4824d949f91Sopenharmony_ci{ 4834d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter004 start"; 4844d949f91Sopenharmony_ci 4854d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 4864d949f91Sopenharmony_ci int32_t result = OH_ImageEffect_RemoveFilter(imageEffect, nullptr); 4874d949f91Sopenharmony_ci ASSERT_EQ(result, 0) << "OH_ImageEffect_RemoveFilter failed"; 4884d949f91Sopenharmony_ci 4894d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRemoveFilter004 success! result: " << result; 4904d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter004 END"; 4914d949f91Sopenharmony_ci} 4924d949f91Sopenharmony_ci 4934d949f91Sopenharmony_ci/** 4944d949f91Sopenharmony_ci * Feature: ImageEffect 4954d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_RemoveFilter with not exist OH_EffectFilter parameter 4964d949f91Sopenharmony_ci * SubFunction: NA 4974d949f91Sopenharmony_ci * FunctionPoints: NA 4984d949f91Sopenharmony_ci * EnvConditions: NA 4994d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_RemoveFilter with not exist OH_EffectFilter parameter 5004d949f91Sopenharmony_ci */ 5014d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRemoveFilter005, TestSize.Level1) 5024d949f91Sopenharmony_ci{ 5034d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter005 start"; 5044d949f91Sopenharmony_ci 5054d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 5064d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 5074d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRemoveFilter005 OH_ImageEffect_AddFilter success! filter: " << filter; 5084d949f91Sopenharmony_ci int32_t result = OH_ImageEffect_RemoveFilter(imageEffect, "TestEFilter"); 5094d949f91Sopenharmony_ci ASSERT_EQ(result, 0) << "OH_ImageEffect_RemoveFilter failed"; 5104d949f91Sopenharmony_ci 5114d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRemoveFilter005 success! result: " << result; 5124d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRemoveFilter005 END"; 5134d949f91Sopenharmony_ci} 5144d949f91Sopenharmony_ci 5154d949f91Sopenharmony_ci/** 5164d949f91Sopenharmony_ci * Feature: ImageEffect 5174d949f91Sopenharmony_ci * Function: Test Add Remove Replace Filter 5184d949f91Sopenharmony_ci * SubFunction: NA 5194d949f91Sopenharmony_ci * FunctionPoints: NA 5204d949f91Sopenharmony_ci * EnvConditions: NA 5214d949f91Sopenharmony_ci * CaseDescription: Test Add Remove Replace Filter 5224d949f91Sopenharmony_ci */ 5234d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectCRUDFilter001, TestSize.Level1) 5244d949f91Sopenharmony_ci{ 5254d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 5264d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr); 5274d949f91Sopenharmony_ci 5284d949f91Sopenharmony_ci OH_EffectFilter *contrastFilter = OH_EffectFilter_Create(CONTRAST_EFILTER); 5294d949f91Sopenharmony_ci ASSERT_NE(contrastFilter, nullptr); 5304d949f91Sopenharmony_ci OH_EffectFilter *brightnessFilter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 5314d949f91Sopenharmony_ci ASSERT_NE(brightnessFilter, nullptr); 5324d949f91Sopenharmony_ci 5334d949f91Sopenharmony_ci // 0: contrastFilter, 1: brightnessFilter, 2: cropFilter 5344d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_AddFilterByFilter(imageEffect, contrastFilter); 5354d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 5364d949f91Sopenharmony_ci OH_EffectFilter *cropFilter = OH_ImageEffect_InsertFilter(imageEffect, 1, CROP_EFILTER); 5374d949f91Sopenharmony_ci ASSERT_NE(cropFilter, nullptr); 5384d949f91Sopenharmony_ci errorCode = OH_ImageEffect_InsertFilterByFilter(imageEffect, 1, brightnessFilter); 5394d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 5404d949f91Sopenharmony_ci int32_t filterCnt = OH_ImageEffect_GetFilterCount(imageEffect); 5414d949f91Sopenharmony_ci ASSERT_EQ(filterCnt, 3); 5424d949f91Sopenharmony_ci 5434d949f91Sopenharmony_ci // 0: brightnessFilter1, 1: brightnessFilter, 2: cropFilter 5444d949f91Sopenharmony_ci OH_EffectFilter *brightnessFilter1 = OH_ImageEffect_ReplaceFilter(imageEffect, 0, BRIGHTNESS_EFILTER); 5454d949f91Sopenharmony_ci ASSERT_NE(brightnessFilter1, nullptr); 5464d949f91Sopenharmony_ci filterCnt = OH_ImageEffect_GetFilterCount(imageEffect); 5474d949f91Sopenharmony_ci ASSERT_EQ(filterCnt, 3); 5484d949f91Sopenharmony_ci 5494d949f91Sopenharmony_ci // 0: brightnessFilter, 1: contrastFilter, 2: cropFilter 5504d949f91Sopenharmony_ci errorCode = OH_ImageEffect_ReplaceFilterByFilter(imageEffect, 1, contrastFilter); 5514d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 5524d949f91Sopenharmony_ci errorCode = OH_ImageEffect_ReplaceFilterByFilter(imageEffect, 0, brightnessFilter); 5534d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 5544d949f91Sopenharmony_ci filterCnt = OH_ImageEffect_GetFilterCount(imageEffect); 5554d949f91Sopenharmony_ci ASSERT_EQ(filterCnt, 3); 5564d949f91Sopenharmony_ci 5574d949f91Sopenharmony_ci // 0: contrastFilter 5584d949f91Sopenharmony_ci int32_t removeNum = OH_ImageEffect_RemoveFilter(imageEffect, BRIGHTNESS_EFILTER); 5594d949f91Sopenharmony_ci ASSERT_EQ(removeNum, 1); 5604d949f91Sopenharmony_ci errorCode = OH_ImageEffect_RemoveFilterByIndex(imageEffect, 2); 5614d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 5624d949f91Sopenharmony_ci errorCode = OH_ImageEffect_RemoveFilterByIndex(imageEffect, 1); 5634d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 5644d949f91Sopenharmony_ci filterCnt = OH_ImageEffect_GetFilterCount(imageEffect); 5654d949f91Sopenharmony_ci ASSERT_EQ(filterCnt, 1); 5664d949f91Sopenharmony_ci 5674d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 5684d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 5694d949f91Sopenharmony_ci 5704d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Release(contrastFilter); 5714d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 5724d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Release(brightnessFilter); 5734d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 5744d949f91Sopenharmony_ci} 5754d949f91Sopenharmony_ci 5764d949f91Sopenharmony_ci/** 5774d949f91Sopenharmony_ci * Feature: ImageEffect 5784d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_SetValue with normal parameter 5794d949f91Sopenharmony_ci * SubFunction: NA 5804d949f91Sopenharmony_ci * FunctionPoints: NA 5814d949f91Sopenharmony_ci * EnvConditions: NA 5824d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_SetValue with normal parameter 5834d949f91Sopenharmony_ci */ 5844d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterSetValue001, TestSize.Level1) 5854d949f91Sopenharmony_ci{ 5864d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue001 start"; 5874d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 5884d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 5894d949f91Sopenharmony_ci const char *key = KEY_FILTER_INTENSITY; 5904d949f91Sopenharmony_ci ImageEffect_Any value; 5914d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 5924d949f91Sopenharmony_ci value.dataValue.floatValue = static_cast<float>(12); 5934d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, key, &value); 5944d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_SetValue failed"; 5954d949f91Sopenharmony_ci 5964d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterSetValue001 success! result: " << errorCode; 5974d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue001 END"; 5984d949f91Sopenharmony_ci} 5994d949f91Sopenharmony_ci 6004d949f91Sopenharmony_ci/** 6014d949f91Sopenharmony_ci * Feature: ImageEffect 6024d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_SetValue with all empty parameter 6034d949f91Sopenharmony_ci * SubFunction: NA 6044d949f91Sopenharmony_ci * FunctionPoints: NA 6054d949f91Sopenharmony_ci * EnvConditions: NA 6064d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_SetValue with all empty parameter 6074d949f91Sopenharmony_ci */ 6084d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterSetValue002, TestSize.Level1) 6094d949f91Sopenharmony_ci{ 6104d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue002 start"; 6114d949f91Sopenharmony_ci 6124d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(nullptr, nullptr, nullptr); 6134d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_SetValue failed"; 6144d949f91Sopenharmony_ci 6154d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterSetValue002 success! result: " << errorCode; 6164d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue002 END"; 6174d949f91Sopenharmony_ci} 6184d949f91Sopenharmony_ci 6194d949f91Sopenharmony_ci/** 6204d949f91Sopenharmony_ci * Feature: ImageEffect 6214d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_SetValue with unexpected ImageEffect_Any.dataType parameter 6224d949f91Sopenharmony_ci * SubFunction: NA 6234d949f91Sopenharmony_ci * FunctionPoints: NA 6244d949f91Sopenharmony_ci * EnvConditions: NA 6254d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_SetValue with unexpected ImageEffect_Any.dataType parameter 6264d949f91Sopenharmony_ci */ 6274d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterSetValue003, TestSize.Level1) 6284d949f91Sopenharmony_ci{ 6294d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue003 start"; 6304d949f91Sopenharmony_ci 6314d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 6324d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 6334d949f91Sopenharmony_ci const char *key = KEY_FILTER_INTENSITY; 6344d949f91Sopenharmony_ci ImageEffect_Any value; 6354d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_UNKNOWN; 6364d949f91Sopenharmony_ci value.dataValue.charValue = 'A'; 6374d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, key, &value); 6384d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_SetValue failed"; 6394d949f91Sopenharmony_ci 6404d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterSetValue003 success! result: " << errorCode; 6414d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue003 END"; 6424d949f91Sopenharmony_ci} 6434d949f91Sopenharmony_ci 6444d949f91Sopenharmony_ci/** 6454d949f91Sopenharmony_ci * Feature: ImageEffect 6464d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_SetValue with not exist key parameter 6474d949f91Sopenharmony_ci * SubFunction: NA 6484d949f91Sopenharmony_ci * FunctionPoints: NA 6494d949f91Sopenharmony_ci * EnvConditions: NA 6504d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_SetValue with not exist key parameter 6514d949f91Sopenharmony_ci */ 6524d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterSetValue004, TestSize.Level1) 6534d949f91Sopenharmony_ci{ 6544d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue004 start"; 6554d949f91Sopenharmony_ci 6564d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 6574d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 6584d949f91Sopenharmony_ci const char *key = "test"; 6594d949f91Sopenharmony_ci ImageEffect_Any value; 6604d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 6614d949f91Sopenharmony_ci value.dataValue.floatValue = static_cast<float>(12); 6624d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, key, &value); 6634d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_SetValue failed"; 6644d949f91Sopenharmony_ci 6654d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterSetValue004 success! result: " << errorCode; 6664d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue004 END"; 6674d949f91Sopenharmony_ci} 6684d949f91Sopenharmony_ci 6694d949f91Sopenharmony_ci/** 6704d949f91Sopenharmony_ci * Feature: ImageEffect 6714d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_SetValue with empty key parameter 6724d949f91Sopenharmony_ci * SubFunction: NA 6734d949f91Sopenharmony_ci * FunctionPoints: NA 6744d949f91Sopenharmony_ci * EnvConditions: NA 6754d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_SetValue with empty key parameter 6764d949f91Sopenharmony_ci */ 6774d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterSetValue005, TestSize.Level1) 6784d949f91Sopenharmony_ci{ 6794d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue005 start"; 6804d949f91Sopenharmony_ci 6814d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 6824d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 6834d949f91Sopenharmony_ci ImageEffect_Any value; 6844d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 6854d949f91Sopenharmony_ci value.dataValue.floatValue = static_cast<float>(12); 6864d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, nullptr, &value); 6874d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_SetValue failed"; 6884d949f91Sopenharmony_ci 6894d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterSetValue005 success! result: " << errorCode; 6904d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue005 END"; 6914d949f91Sopenharmony_ci} 6924d949f91Sopenharmony_ci 6934d949f91Sopenharmony_ci/** 6944d949f91Sopenharmony_ci * Feature: ImageEffect 6954d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_SetValue with empty ImageEffect_Any parameter 6964d949f91Sopenharmony_ci * SubFunction: NA 6974d949f91Sopenharmony_ci * FunctionPoints: NA 6984d949f91Sopenharmony_ci * EnvConditions: NA 6994d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_SetValue with empty ImageEffect_Any parameter 7004d949f91Sopenharmony_ci */ 7014d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterSetValue006, TestSize.Level1) 7024d949f91Sopenharmony_ci{ 7034d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue006 start"; 7044d949f91Sopenharmony_ci 7054d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 7064d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 7074d949f91Sopenharmony_ci const char *key = KEY_FILTER_INTENSITY; 7084d949f91Sopenharmony_ci ImageEffect_Any value; 7094d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, key, &value); 7104d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_SetValue failed"; 7114d949f91Sopenharmony_ci 7124d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterSetValue006 success! result: " << errorCode; 7134d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterSetValue006 END"; 7144d949f91Sopenharmony_ci} 7154d949f91Sopenharmony_ci 7164d949f91Sopenharmony_ci/** 7174d949f91Sopenharmony_ci * Feature: ImageEffect 7184d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_GetValue with normal parameter 7194d949f91Sopenharmony_ci * SubFunction: NA 7204d949f91Sopenharmony_ci * FunctionPoints: NA 7214d949f91Sopenharmony_ci * EnvConditions: NA 7224d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_GetValue with normal parameter 7234d949f91Sopenharmony_ci */ 7244d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterGetValue001, TestSize.Level1) 7254d949f91Sopenharmony_ci{ 7264d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue001 start"; 7274d949f91Sopenharmony_ci 7284d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 7294d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 7304d949f91Sopenharmony_ci const char *key = KEY_FILTER_INTENSITY; 7314d949f91Sopenharmony_ci ImageEffect_Any value; 7324d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 7334d949f91Sopenharmony_ci value.dataValue.floatValue = static_cast<float>(12); 7344d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, key, &value); 7354d949f91Sopenharmony_ci ImageEffect_Any result; 7364d949f91Sopenharmony_ci errorCode = OH_EffectFilter_GetValue(filter, key, &result); 7374d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_GetValue failed"; 7384d949f91Sopenharmony_ci ASSERT_EQ(result.dataValue.floatValue, static_cast<float>(12)) << "OH_EffectFilter_GetValue failed"; 7394d949f91Sopenharmony_ci 7404d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterGetValue001 success! result: " << errorCode; 7414d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue001 END"; 7424d949f91Sopenharmony_ci} 7434d949f91Sopenharmony_ci 7444d949f91Sopenharmony_ci/** 7454d949f91Sopenharmony_ci * Feature: ImageEffect 7464d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_GetValue with all empty parameter 7474d949f91Sopenharmony_ci * SubFunction: NA 7484d949f91Sopenharmony_ci * FunctionPoints: NA 7494d949f91Sopenharmony_ci * EnvConditions: NA 7504d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_GetValue with all empty parameter 7514d949f91Sopenharmony_ci */ 7524d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterGetValue002, TestSize.Level1) 7534d949f91Sopenharmony_ci{ 7544d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue002 start"; 7554d949f91Sopenharmony_ci 7564d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_GetValue(nullptr, nullptr, nullptr); 7574d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_GetValue failed"; 7584d949f91Sopenharmony_ci 7594d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterGetValue002 success! result: " << errorCode; 7604d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue002 END"; 7614d949f91Sopenharmony_ci} 7624d949f91Sopenharmony_ci 7634d949f91Sopenharmony_ci/** 7644d949f91Sopenharmony_ci * Feature: ImageEffect 7654d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_GetValue with not exist key parameter 7664d949f91Sopenharmony_ci * SubFunction: NA 7674d949f91Sopenharmony_ci * FunctionPoints: NA 7684d949f91Sopenharmony_ci * EnvConditions: NA 7694d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_GetValue with not exist key parameter 7704d949f91Sopenharmony_ci */ 7714d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterGetValue003, TestSize.Level1) 7724d949f91Sopenharmony_ci{ 7734d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue003 start"; 7744d949f91Sopenharmony_ci 7754d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 7764d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 7774d949f91Sopenharmony_ci const char *key = KEY_FILTER_INTENSITY; 7784d949f91Sopenharmony_ci ImageEffect_Any value; 7794d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 7804d949f91Sopenharmony_ci value.dataValue.floatValue = static_cast<float>(12); 7814d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, key, &value); 7824d949f91Sopenharmony_ci ImageEffect_Any result; 7834d949f91Sopenharmony_ci errorCode = OH_EffectFilter_GetValue(filter, "test", &result); 7844d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_GetValue failed"; 7854d949f91Sopenharmony_ci ASSERT_NE(result.dataValue.floatValue, static_cast<float>(12)) << "OH_EffectFilter_GetValue failed"; 7864d949f91Sopenharmony_ci 7874d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterGetValue003 success! result: " << errorCode; 7884d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue003 END"; 7894d949f91Sopenharmony_ci} 7904d949f91Sopenharmony_ci 7914d949f91Sopenharmony_ci/** 7924d949f91Sopenharmony_ci * Feature: ImageEffect 7934d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_GetValue with empty OH_EffectFilter parameter 7944d949f91Sopenharmony_ci * SubFunction: NA 7954d949f91Sopenharmony_ci * FunctionPoints: NA 7964d949f91Sopenharmony_ci * EnvConditions: NA 7974d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_GetValue with empty OH_EffectFilter parameter 7984d949f91Sopenharmony_ci */ 7994d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterGetValue004, TestSize.Level1) 8004d949f91Sopenharmony_ci{ 8014d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue004 start"; 8024d949f91Sopenharmony_ci 8034d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 8044d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 8054d949f91Sopenharmony_ci const char *key = KEY_FILTER_INTENSITY; 8064d949f91Sopenharmony_ci ImageEffect_Any value; 8074d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 8084d949f91Sopenharmony_ci value.dataValue.floatValue = static_cast<float>(12); 8094d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, key, &value); 8104d949f91Sopenharmony_ci ImageEffect_Any result; 8114d949f91Sopenharmony_ci errorCode = OH_EffectFilter_GetValue(nullptr, KEY_FILTER_INTENSITY, &result); 8124d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_GetValue failed"; 8134d949f91Sopenharmony_ci ASSERT_NE(result.dataValue.floatValue, static_cast<float>(12)) << "OH_EffectFilter_GetValue failed"; 8144d949f91Sopenharmony_ci 8154d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterGetValue004 success! result: " << errorCode; 8164d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue004 END"; 8174d949f91Sopenharmony_ci} 8184d949f91Sopenharmony_ci 8194d949f91Sopenharmony_ci/** 8204d949f91Sopenharmony_ci * Feature: ImageEffect 8214d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_GetValue with unobstructed OH_EffectFilter_SetValue func 8224d949f91Sopenharmony_ci * SubFunction: NA 8234d949f91Sopenharmony_ci * FunctionPoints: NA 8244d949f91Sopenharmony_ci * EnvConditions: NA 8254d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_GetValue with unobstructed OH_EffectFilter_SetValue func 8264d949f91Sopenharmony_ci */ 8274d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterGetValue005, TestSize.Level1) 8284d949f91Sopenharmony_ci{ 8294d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue005 start"; 8304d949f91Sopenharmony_ci 8314d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 8324d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 8334d949f91Sopenharmony_ci const char *key = KEY_FILTER_INTENSITY; 8344d949f91Sopenharmony_ci ImageEffect_Any value; 8354d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_GetValue(filter, key, &value); 8364d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_GetValue failed"; 8374d949f91Sopenharmony_ci ASSERT_EQ(value.dataValue.floatValue, 0) << "OH_EffectFilter_GetValue failed"; 8384d949f91Sopenharmony_ci 8394d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterGetValue005 success! result: " << errorCode; 8404d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue005 END"; 8414d949f91Sopenharmony_ci} 8424d949f91Sopenharmony_ci 8434d949f91Sopenharmony_ci/** 8444d949f91Sopenharmony_ci * Feature: ImageEffect 8454d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_GetValue by FILTER_NAME 8464d949f91Sopenharmony_ci * SubFunction: NA 8474d949f91Sopenharmony_ci * FunctionPoints: NA 8484d949f91Sopenharmony_ci * EnvConditions: NA 8494d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_GetValue by FILTER_NAME 8504d949f91Sopenharmony_ci */ 8514d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterGetValue006, TestSize.Level1) 8524d949f91Sopenharmony_ci{ 8534d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue006 start"; 8544d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 8554d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr); 8564d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 8574d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr); 8584d949f91Sopenharmony_ci const char *key = "FILTER_NAME"; 8594d949f91Sopenharmony_ci ImageEffect_Any value; 8604d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_GetValue(filter, key, &value); 8614d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_GetValue failed"; 8624d949f91Sopenharmony_ci ASSERT_EQ(value.dataType, ImageEffect_DataType::EFFECT_DATA_TYPE_PTR) << "OH_EffectFilter_GetValue failed"; 8634d949f91Sopenharmony_ci ASSERT_NE(value.dataValue.ptrValue, nullptr) << "OH_EffectFilter_GetValue failed"; 8644d949f91Sopenharmony_ci ASSERT_STREQ(static_cast<char *>(value.dataValue.ptrValue), BRIGHTNESS_EFILTER) << 8654d949f91Sopenharmony_ci "OH_EffectFilter_GetValue failed"; 8664d949f91Sopenharmony_ci 8674d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterGetValue006 success! result: " << errorCode; 8684d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterGetValue006 END"; 8694d949f91Sopenharmony_ci} 8704d949f91Sopenharmony_ci 8714d949f91Sopenharmony_ci/** 8724d949f91Sopenharmony_ci * Feature: ImageEffect 8734d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Render with normal parameter 8744d949f91Sopenharmony_ci * SubFunction: NA 8754d949f91Sopenharmony_ci * FunctionPoints: NA 8764d949f91Sopenharmony_ci * EnvConditions: NA 8774d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Render with normal parameter 8784d949f91Sopenharmony_ci */ 8794d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRender001, TestSize.Level1) 8804d949f91Sopenharmony_ci{ 8814d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender001 start"; 8824d949f91Sopenharmony_ci 8834d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 8844d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Render(filter, pixelmapNative_, pixelmapNative_); 8854d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_Render failed"; 8864d949f91Sopenharmony_ci 8874d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRender001 success! result: " << errorCode; 8884d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender001 END"; 8894d949f91Sopenharmony_ci} 8904d949f91Sopenharmony_ci 8914d949f91Sopenharmony_ci/** 8924d949f91Sopenharmony_ci * Feature: ImageEffect 8934d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Render with all empty parameter 8944d949f91Sopenharmony_ci * SubFunction: NA 8954d949f91Sopenharmony_ci * FunctionPoints: NA 8964d949f91Sopenharmony_ci * EnvConditions: NA 8974d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Render with all empty parameter 8984d949f91Sopenharmony_ci */ 8994d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRender002, TestSize.Level1) 9004d949f91Sopenharmony_ci{ 9014d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender002 start"; 9024d949f91Sopenharmony_ci 9034d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Render(nullptr, nullptr, nullptr); 9044d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_Render failed"; 9054d949f91Sopenharmony_ci 9064d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRender002 success! result: " << errorCode; 9074d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender002 END"; 9084d949f91Sopenharmony_ci} 9094d949f91Sopenharmony_ci 9104d949f91Sopenharmony_ci/** 9114d949f91Sopenharmony_ci * Feature: ImageEffect 9124d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Render with empty OH_EffectFilter parameter 9134d949f91Sopenharmony_ci * SubFunction: NA 9144d949f91Sopenharmony_ci * FunctionPoints: NA 9154d949f91Sopenharmony_ci * EnvConditions: NA 9164d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Render with empty OH_EffectFilter parameter 9174d949f91Sopenharmony_ci */ 9184d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRender003, TestSize.Level1) 9194d949f91Sopenharmony_ci{ 9204d949f91Sopenharmony_ci InSequence s; 9214d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender003 start"; 9224d949f91Sopenharmony_ci 9234d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Render(nullptr, pixelmapNative_, pixelmapNative_); 9244d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_Render failed"; 9254d949f91Sopenharmony_ci 9264d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRender003 success! result: " << errorCode; 9274d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender003 END"; 9284d949f91Sopenharmony_ci} 9294d949f91Sopenharmony_ci 9304d949f91Sopenharmony_ci/** 9314d949f91Sopenharmony_ci * Feature: ImageEffect 9324d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Render with empty inputPixelmap, outputPixelmap parameter 9334d949f91Sopenharmony_ci * SubFunction: NA 9344d949f91Sopenharmony_ci * FunctionPoints: NA 9354d949f91Sopenharmony_ci * EnvConditions: NA 9364d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Render with empty inputPixelmap, outputPixelmap parameter 9374d949f91Sopenharmony_ci */ 9384d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRender004, TestSize.Level1) 9394d949f91Sopenharmony_ci{ 9404d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender004 start"; 9414d949f91Sopenharmony_ci 9424d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 9434d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Render(filter, nullptr, nullptr); 9444d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_Render failed"; 9454d949f91Sopenharmony_ci 9464d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRender004 success! result: " << errorCode; 9474d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender004 END"; 9484d949f91Sopenharmony_ci} 9494d949f91Sopenharmony_ci 9504d949f91Sopenharmony_ci/** 9514d949f91Sopenharmony_ci * Feature: ImageEffect 9524d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Render with empty outputPixelmap parameter 9534d949f91Sopenharmony_ci * SubFunction: NA 9544d949f91Sopenharmony_ci * FunctionPoints: NA 9554d949f91Sopenharmony_ci * EnvConditions: NA 9564d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Render with empty outputPixelmap parameter 9574d949f91Sopenharmony_ci */ 9584d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRender005, TestSize.Level1) 9594d949f91Sopenharmony_ci{ 9604d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender005 start"; 9614d949f91Sopenharmony_ci InSequence s; 9624d949f91Sopenharmony_ci 9634d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 9644d949f91Sopenharmony_ci 9654d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Render(filter, pixelmapNative_, nullptr); 9664d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_Render failed"; 9674d949f91Sopenharmony_ci 9684d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRender005 success! result: " << errorCode; 9694d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender005 END"; 9704d949f91Sopenharmony_ci} 9714d949f91Sopenharmony_ci 9724d949f91Sopenharmony_ci/** 9734d949f91Sopenharmony_ci * Feature: ImageEffect 9744d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Render with empty inputPixelmap parameter 9754d949f91Sopenharmony_ci * SubFunction: NA 9764d949f91Sopenharmony_ci * FunctionPoints: NA 9774d949f91Sopenharmony_ci * EnvConditions: NA 9784d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Render with empty inputPixelmap parameter 9794d949f91Sopenharmony_ci */ 9804d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRender006, TestSize.Level1) 9814d949f91Sopenharmony_ci{ 9824d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender006 start"; 9834d949f91Sopenharmony_ci InSequence s; 9844d949f91Sopenharmony_ci 9854d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 9864d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Render(filter, nullptr, pixelmapNative_); 9874d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_Render failed"; 9884d949f91Sopenharmony_ci 9894d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRender006 success! result: " << errorCode; 9904d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRender006 END"; 9914d949f91Sopenharmony_ci} 9924d949f91Sopenharmony_ci 9934d949f91Sopenharmony_ci/** 9944d949f91Sopenharmony_ci * Feature: ImageEffect 9954d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Release with normal parameter 9964d949f91Sopenharmony_ci * SubFunction: NA 9974d949f91Sopenharmony_ci * FunctionPoints: NA 9984d949f91Sopenharmony_ci * EnvConditions: NA 9994d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Release with normal parameter 10004d949f91Sopenharmony_ci */ 10014d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRelease001, TestSize.Level1) 10024d949f91Sopenharmony_ci{ 10034d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRelease001 start"; 10044d949f91Sopenharmony_ci 10054d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 10064d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Release(filter); 10074d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_Release failed"; 10084d949f91Sopenharmony_ci 10094d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRelease001 success! result: " << errorCode; 10104d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRelease001 END"; 10114d949f91Sopenharmony_ci} 10124d949f91Sopenharmony_ci 10134d949f91Sopenharmony_ci/** 10144d949f91Sopenharmony_ci * Feature: ImageEffect 10154d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Release with empty parameter 10164d949f91Sopenharmony_ci * SubFunction: NA 10174d949f91Sopenharmony_ci * FunctionPoints: NA 10184d949f91Sopenharmony_ci * EnvConditions: NA 10194d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Release with empty parameter 10204d949f91Sopenharmony_ci */ 10214d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRelease002, TestSize.Level1) 10224d949f91Sopenharmony_ci{ 10234d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRelease002 start"; 10244d949f91Sopenharmony_ci 10254d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Release(nullptr); 10264d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_Release failed"; 10274d949f91Sopenharmony_ci 10284d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRelease002 success! result: " << errorCode; 10294d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRelease002 END"; 10304d949f91Sopenharmony_ci} 10314d949f91Sopenharmony_ci 10324d949f91Sopenharmony_ci/** 10334d949f91Sopenharmony_ci * Feature: ImageEffect 10344d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Release with not exist OH_EffectFilter parameter 10354d949f91Sopenharmony_ci * SubFunction: NA 10364d949f91Sopenharmony_ci * FunctionPoints: NA 10374d949f91Sopenharmony_ci * EnvConditions: NA 10384d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Release with not exist OH_EffectFilter parameter 10394d949f91Sopenharmony_ci */ 10404d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRelease003, TestSize.Level1) 10414d949f91Sopenharmony_ci{ 10424d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRelease003 start"; 10434d949f91Sopenharmony_ci 10444d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create("TestEFilter"); 10454d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Release(filter); 10464d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_Release failed"; 10474d949f91Sopenharmony_ci 10484d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRelease003 success! result: " << errorCode; 10494d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRelease003 END"; 10504d949f91Sopenharmony_ci} 10514d949f91Sopenharmony_ci 10524d949f91Sopenharmony_ci/** 10534d949f91Sopenharmony_ci * Feature: ImageEffect 10544d949f91Sopenharmony_ci * Function: Test ImageEffectSingleFilter with normal parameter 10554d949f91Sopenharmony_ci * SubFunction: NA 10564d949f91Sopenharmony_ci * FunctionPoints: NA 10574d949f91Sopenharmony_ci * EnvConditions: NA 10584d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSingleFilter with normal parameter 10594d949f91Sopenharmony_ci */ 10604d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSingleFilterUnittest001, TestSize.Level1) 10614d949f91Sopenharmony_ci{ 10624d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest001 start"; 10634d949f91Sopenharmony_ci InSequence s; 10644d949f91Sopenharmony_ci 10654d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 10664d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectSingleFilterUnittest001 OH_EffectFilter_Create failed"; 10674d949f91Sopenharmony_ci ImageEffect_Any value; 10684d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 10694d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 10704d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 10714d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 10724d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest001 OH_EffectFilter_SetValue failed"; 10734d949f91Sopenharmony_ci 10744d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Render(filter, pixelmapNative_, pixelmapNative_); 10754d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 10764d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest001 OH_EffectFilter_Render failed"; 10774d949f91Sopenharmony_ci 10784d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Release(filter); 10794d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 10804d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest001 OH_EffectFilter_Release failed"; 10814d949f91Sopenharmony_ci 10824d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectSingleFilterUnittest001 success! result: " << errorCode; 10834d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest001 END"; 10844d949f91Sopenharmony_ci} 10854d949f91Sopenharmony_ci 10864d949f91Sopenharmony_ci/** 10874d949f91Sopenharmony_ci * Feature: ImageEffect 10884d949f91Sopenharmony_ci * Function: Test ImageEffectSingleFilter submethod OH_EffectFilter_Create with not exist OH_EffectFilter parameter 10894d949f91Sopenharmony_ci * SubFunction: NA 10904d949f91Sopenharmony_ci * FunctionPoints: NA 10914d949f91Sopenharmony_ci * EnvConditions: NA 10924d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSingleFilter submethod OH_EffectFilter_Create with not exist OH_EffectFilter 10934d949f91Sopenharmony_ci * parameter 10944d949f91Sopenharmony_ci */ 10954d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSingleFilterUnittest002, TestSize.Level1) 10964d949f91Sopenharmony_ci{ 10974d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest002 start"; 10984d949f91Sopenharmony_ci InSequence s; 10994d949f91Sopenharmony_ci 11004d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create("TestEFilter"); 11014d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "ImageEffectSingleFilterUnittest002 OH_EffectFilter_Create failed"; 11024d949f91Sopenharmony_ci ImageEffect_Any value; 11034d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 11044d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 11054d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 11064d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 11074d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest002 OH_EffectFilter_SetValue failed"; 11084d949f91Sopenharmony_ci 11094d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Render(filter, pixelmapNative_, pixelmapNative_); 11104d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 11114d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest002 OH_EffectFilter_Render failed"; 11124d949f91Sopenharmony_ci 11134d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Release(filter); 11144d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 11154d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest002 OH_EffectFilter_Release failed"; 11164d949f91Sopenharmony_ci 11174d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectSingleFilterUnittest002 success! result: " << errorCode; 11184d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest002 END"; 11194d949f91Sopenharmony_ci} 11204d949f91Sopenharmony_ci 11214d949f91Sopenharmony_ci/** 11224d949f91Sopenharmony_ci * Feature: ImageEffect 11234d949f91Sopenharmony_ci * Function: Test ImageEffectSingleFilter submethod OH_EffectFilter_SetValue with not exist key parameter 11244d949f91Sopenharmony_ci * SubFunction: NA 11254d949f91Sopenharmony_ci * FunctionPoints: NA 11264d949f91Sopenharmony_ci * EnvConditions: NA 11274d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSingleFilter submethod OH_EffectFilter_SetValue with not exist key parameter 11284d949f91Sopenharmony_ci */ 11294d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSingleFilterUnittest003, TestSize.Level1) 11304d949f91Sopenharmony_ci{ 11314d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest003 start"; 11324d949f91Sopenharmony_ci InSequence s; 11334d949f91Sopenharmony_ci 11344d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 11354d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectSingleFilterUnittest003 OH_EffectFilter_Create failed"; 11364d949f91Sopenharmony_ci ImageEffect_Any value; 11374d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 11384d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 11394d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, "testRatio", &value); 11404d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 11414d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest003 OH_EffectFilter_SetValue failed"; 11424d949f91Sopenharmony_ci 11434d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Render(filter, pixelmapNative_, pixelmapNative_); 11444d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 11454d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest003 OH_EffectFilter_Render failed"; 11464d949f91Sopenharmony_ci 11474d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Release(filter); 11484d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 11494d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest003 OH_EffectFilter_Release failed"; 11504d949f91Sopenharmony_ci 11514d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectSingleFilterUnittest003 success! result: " << errorCode; 11524d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest003 END"; 11534d949f91Sopenharmony_ci} 11544d949f91Sopenharmony_ci 11554d949f91Sopenharmony_ci/** 11564d949f91Sopenharmony_ci * Feature: ImageEffect 11574d949f91Sopenharmony_ci * Function: Test ImageEffectSingleFilter submethod OH_EffectFilter_Render unobstructed 11584d949f91Sopenharmony_ci * SubFunction: NA 11594d949f91Sopenharmony_ci * FunctionPoints: NA 11604d949f91Sopenharmony_ci * EnvConditions: NA 11614d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSingleFilter submethod OH_EffectFilter_Render unobstructed 11624d949f91Sopenharmony_ci */ 11634d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSingleFilterUnittest004, TestSize.Level1) 11644d949f91Sopenharmony_ci{ 11654d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest004 start"; 11664d949f91Sopenharmony_ci 11674d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create(BRIGHTNESS_EFILTER); 11684d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectSingleFilterUnittest004 OH_EffectFilter_Create failed"; 11694d949f91Sopenharmony_ci ImageEffect_Any value; 11704d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 11714d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 11724d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 11734d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 11744d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest004 OH_EffectFilter_SetValue failed"; 11754d949f91Sopenharmony_ci 11764d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Release(filter); 11774d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 11784d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest004 OH_EffectFilter_Release failed"; 11794d949f91Sopenharmony_ci 11804d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectSingleFilterUnittest004 success! result: " << errorCode; 11814d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest004 END"; 11824d949f91Sopenharmony_ci} 11834d949f91Sopenharmony_ci 11844d949f91Sopenharmony_ci/** 11854d949f91Sopenharmony_ci * Feature: ImageEffect 11864d949f91Sopenharmony_ci * Function: Test ImageEffectSingleFilter with normal parameter 11874d949f91Sopenharmony_ci * SubFunction: NA 11884d949f91Sopenharmony_ci * FunctionPoints: NA 11894d949f91Sopenharmony_ci * EnvConditions: NA 11904d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSingleFilter with normal parameter 11914d949f91Sopenharmony_ci */ 11924d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSingleFilterUnittest005, TestSize.Level1) 11934d949f91Sopenharmony_ci{ 11944d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest005 start"; 11954d949f91Sopenharmony_ci InSequence s; 11964d949f91Sopenharmony_ci 11974d949f91Sopenharmony_ci std::shared_ptr<OH_PixelmapNative> pixelmapNative = std::make_shared<OH_PixelmapNative>(nullptr); 11984d949f91Sopenharmony_ci std::unique_ptr<PixelMap> pixelMap = TestPixelMapUtils::ParsePixelMapByPath(g_jpgHdrPath); 11994d949f91Sopenharmony_ci ASSERT_NE(pixelMap, nullptr); 12004d949f91Sopenharmony_ci pixelmapNative->pixelmap_ = std::move(pixelMap); 12014d949f91Sopenharmony_ci 12024d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_EffectFilter_Create(CROP_EFILTER); 12034d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectSingleFilterUnittest005 OH_EffectFilter_Create failed"; 12044d949f91Sopenharmony_ci 12054d949f91Sopenharmony_ci uint32_t x1 = static_cast<uint32_t>(pixelmapNative->pixelmap_->GetWidth() / CROP_FACTOR); 12064d949f91Sopenharmony_ci uint32_t y1 = static_cast<uint32_t>(pixelmapNative->pixelmap_->GetHeight() / CROP_FACTOR); 12074d949f91Sopenharmony_ci uint32_t areaInfo[] = { 0, 0, x1, y1}; 12084d949f91Sopenharmony_ci ImageEffect_Any value; 12094d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_PTR; 12104d949f91Sopenharmony_ci value.dataValue.ptrValue = static_cast<void *>(areaInfo); 12114d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_REGION, &value); 12124d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 12134d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest005 OH_EffectFilter_SetValue failed"; 12144d949f91Sopenharmony_ci 12154d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Render(filter, pixelmapNative_, pixelmapNative_); 12164d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 12174d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest003 OH_EffectFilter_Render failed"; 12184d949f91Sopenharmony_ci 12194d949f91Sopenharmony_ci errorCode = OH_EffectFilter_Release(filter); 12204d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 12214d949f91Sopenharmony_ci "ImageEffectSingleFilterUnittest005 OH_EffectFilter_Release failed"; 12224d949f91Sopenharmony_ci 12234d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectSingleFilterUnittest005 success! result: " << errorCode; 12244d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSingleFilterUnittest005 END"; 12254d949f91Sopenharmony_ci} 12264d949f91Sopenharmony_ci 12274d949f91Sopenharmony_ci 12284d949f91Sopenharmony_ci/** 12294d949f91Sopenharmony_ci * Feature: ImageEffect 12304d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetInputPixelmap with normal parameter 12314d949f91Sopenharmony_ci * SubFunction: NA 12324d949f91Sopenharmony_ci * FunctionPoints: NA 12334d949f91Sopenharmony_ci * EnvConditions: NA 12344d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetInputPixelmap with normal parameter 12354d949f91Sopenharmony_ci */ 12364d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetInputPixelmap001, TestSize.Level1) 12374d949f91Sopenharmony_ci{ 12384d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputPixelmap001 start"; 12394d949f91Sopenharmony_ci InSequence s; 12404d949f91Sopenharmony_ci 12414d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 12424d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 12434d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetInputPixelmap failed"; 12444d949f91Sopenharmony_ci 12454d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetInputPixelmap001 success! result: " << errorCode; 12464d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputPixelmap001 END"; 12474d949f91Sopenharmony_ci} 12484d949f91Sopenharmony_ci 12494d949f91Sopenharmony_ci/** 12504d949f91Sopenharmony_ci * Feature: ImageEffect 12514d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetInputPixelmap with all empty parameter 12524d949f91Sopenharmony_ci * SubFunction: NA 12534d949f91Sopenharmony_ci * FunctionPoints: NA 12544d949f91Sopenharmony_ci * EnvConditions: NA 12554d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetInputPixelmap with all empty parameter 12564d949f91Sopenharmony_ci */ 12574d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetInputPixelmap002, TestSize.Level1) 12584d949f91Sopenharmony_ci{ 12594d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputPixelmap002 start"; 12604d949f91Sopenharmony_ci 12614d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetInputPixelmap(nullptr, nullptr); 12624d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetInputPixelmap failed"; 12634d949f91Sopenharmony_ci 12644d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetInputPixelmap002 success! result: " << errorCode; 12654d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputPixelmap002 END"; 12664d949f91Sopenharmony_ci} 12674d949f91Sopenharmony_ci 12684d949f91Sopenharmony_ci/** 12694d949f91Sopenharmony_ci * Feature: ImageEffect 12704d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetInputPixelmap with empty OH_PixelmapNative parameter 12714d949f91Sopenharmony_ci * SubFunction: NA 12724d949f91Sopenharmony_ci * FunctionPoints: NA 12734d949f91Sopenharmony_ci * EnvConditions: NA 12744d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetInputPixelmap with empty OH_PixelmapNative parameter 12754d949f91Sopenharmony_ci */ 12764d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetInputPixelmap003, TestSize.Level1) 12774d949f91Sopenharmony_ci{ 12784d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputPixelmap003 start"; 12794d949f91Sopenharmony_ci InSequence s; 12804d949f91Sopenharmony_ci 12814d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 12824d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, nullptr); 12834d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetInputPixelmap failed"; 12844d949f91Sopenharmony_ci 12854d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetInputPixelmap003 success! result: " << errorCode; 12864d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputPixelmap003 END"; 12874d949f91Sopenharmony_ci} 12884d949f91Sopenharmony_ci 12894d949f91Sopenharmony_ci/** 12904d949f91Sopenharmony_ci * Feature: ImageEffect 12914d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetInputPixelmap with empty OH_ImageEffect parameter 12924d949f91Sopenharmony_ci * SubFunction: NA 12934d949f91Sopenharmony_ci * FunctionPoints: NA 12944d949f91Sopenharmony_ci * EnvConditions: NA 12954d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetInputPixelmap with empty OH_ImageEffect parameter 12964d949f91Sopenharmony_ci */ 12974d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetInputPixelmap004, TestSize.Level1) 12984d949f91Sopenharmony_ci{ 12994d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputPixelmap004 start"; 13004d949f91Sopenharmony_ci InSequence s; 13014d949f91Sopenharmony_ci 13024d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetInputPixelmap(nullptr, pixelmapNative_); 13034d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetInputPixelmap failed"; 13044d949f91Sopenharmony_ci 13054d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetInputPixelmap004 success! result: " << errorCode; 13064d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputPixelmap004 END"; 13074d949f91Sopenharmony_ci} 13084d949f91Sopenharmony_ci 13094d949f91Sopenharmony_ci/** 13104d949f91Sopenharmony_ci * Feature: ImageEffect 13114d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetOutputPixelmap with normal parameter 13124d949f91Sopenharmony_ci * SubFunction: NA 13134d949f91Sopenharmony_ci * FunctionPoints: NA 13144d949f91Sopenharmony_ci * EnvConditions: NA 13154d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetOutputPixelmap with normal parameter 13164d949f91Sopenharmony_ci */ 13174d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetOutputPixelMap001, TestSize.Level1) 13184d949f91Sopenharmony_ci{ 13194d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputPixelMap001 start"; 13204d949f91Sopenharmony_ci InSequence s; 13214d949f91Sopenharmony_ci 13224d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 13234d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetOutputPixelmap(imageEffect, pixelmapNative_); 13244d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetOutputPixelmap failed"; 13254d949f91Sopenharmony_ci 13264d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetOutputPixelMap001 success! result: " << errorCode; 13274d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputPixelMap001 END"; 13284d949f91Sopenharmony_ci} 13294d949f91Sopenharmony_ci 13304d949f91Sopenharmony_ci/** 13314d949f91Sopenharmony_ci * Feature: ImageEffect 13324d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetOutputPixelmap with all empty parameter 13334d949f91Sopenharmony_ci * SubFunction: NA 13344d949f91Sopenharmony_ci * FunctionPoints: NA 13354d949f91Sopenharmony_ci * EnvConditions: NA 13364d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetOutputPixelmap with all empty parameter 13374d949f91Sopenharmony_ci */ 13384d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetOutputPixelMap002, TestSize.Level1) 13394d949f91Sopenharmony_ci{ 13404d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputPixelMap002 start"; 13414d949f91Sopenharmony_ci 13424d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetOutputPixelmap(nullptr, nullptr); 13434d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetOutputPixelmap failed"; 13444d949f91Sopenharmony_ci 13454d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetOutputPixelMap002 success! result: " << errorCode; 13464d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputPixelMap002 END"; 13474d949f91Sopenharmony_ci} 13484d949f91Sopenharmony_ci 13494d949f91Sopenharmony_ci/** 13504d949f91Sopenharmony_ci * Feature: ImageEffect 13514d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetOutputPixelmap with empty OH_PixelmapNative parameter 13524d949f91Sopenharmony_ci * SubFunction: NA 13534d949f91Sopenharmony_ci * FunctionPoints: NA 13544d949f91Sopenharmony_ci * EnvConditions: NA 13554d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetOutputPixelmap with empty OH_PixelmapNative parameter 13564d949f91Sopenharmony_ci */ 13574d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetOutputPixelMap003, TestSize.Level1) 13584d949f91Sopenharmony_ci{ 13594d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputPixelMap003 start"; 13604d949f91Sopenharmony_ci 13614d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 13624d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetOutputPixelmap(imageEffect, nullptr); 13634d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetOutputPixelmap failed"; 13644d949f91Sopenharmony_ci 13654d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetOutputPixelMap003 success! result: " << errorCode; 13664d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputPixelMap003 END"; 13674d949f91Sopenharmony_ci} 13684d949f91Sopenharmony_ci 13694d949f91Sopenharmony_ci/** 13704d949f91Sopenharmony_ci * Feature: ImageEffect 13714d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetOutputPixelmap with empty OH_ImageEffect parameter 13724d949f91Sopenharmony_ci * SubFunction: NA 13734d949f91Sopenharmony_ci * FunctionPoints: NA 13744d949f91Sopenharmony_ci * EnvConditions: NA 13754d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetOutputPixelmap with empty OH_ImageEffect parameter 13764d949f91Sopenharmony_ci */ 13774d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetOutputPixelMap004, TestSize.Level1) 13784d949f91Sopenharmony_ci{ 13794d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputPixelMap004 start"; 13804d949f91Sopenharmony_ci InSequence s; 13814d949f91Sopenharmony_ci 13824d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetOutputPixelmap(nullptr, pixelmapNative_); 13834d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetOutputPixelmap failed"; 13844d949f91Sopenharmony_ci 13854d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetOutputPixelMap004 success! result: " << errorCode; 13864d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputPixelMap004 END"; 13874d949f91Sopenharmony_ci} 13884d949f91Sopenharmony_ci 13894d949f91Sopenharmony_ci/** 13904d949f91Sopenharmony_ci * Feature: ImageEffect 13914d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Start with normal parameter 13924d949f91Sopenharmony_ci * SubFunction: NA 13934d949f91Sopenharmony_ci * FunctionPoints: NA 13944d949f91Sopenharmony_ci * EnvConditions: NA 13954d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Start with normal parameter 13964d949f91Sopenharmony_ci */ 13974d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectStart001, TestSize.Level1) 13984d949f91Sopenharmony_ci{ 13994d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectStart001 start"; 14004d949f91Sopenharmony_ci 14014d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 14024d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Start(imageEffect); 14034d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Start failed"; 14044d949f91Sopenharmony_ci 14054d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectStart001 success! result: " << errorCode; 14064d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectStart001 END"; 14074d949f91Sopenharmony_ci} 14084d949f91Sopenharmony_ci 14094d949f91Sopenharmony_ci/** 14104d949f91Sopenharmony_ci * Feature: ImageEffect 14114d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Start with empty parameter 14124d949f91Sopenharmony_ci * SubFunction: NA 14134d949f91Sopenharmony_ci * FunctionPoints: NA 14144d949f91Sopenharmony_ci * EnvConditions: NA 14154d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Start with empty parameter 14164d949f91Sopenharmony_ci */ 14174d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectStart002, TestSize.Level1) 14184d949f91Sopenharmony_ci{ 14194d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectStart002 start"; 14204d949f91Sopenharmony_ci 14214d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Start(nullptr); 14224d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Start failed"; 14234d949f91Sopenharmony_ci 14244d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectStart002 success! result: " << errorCode; 14254d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectStart002 END"; 14264d949f91Sopenharmony_ci} 14274d949f91Sopenharmony_ci 14284d949f91Sopenharmony_ci/** 14294d949f91Sopenharmony_ci * Feature: ImageEffect 14304d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Release with normal parameter 14314d949f91Sopenharmony_ci * SubFunction: NA 14324d949f91Sopenharmony_ci * FunctionPoints: NA 14334d949f91Sopenharmony_ci * EnvConditions: NA 14344d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Release with normal parameter 14354d949f91Sopenharmony_ci */ 14364d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRelease001, TestSize.Level1) 14374d949f91Sopenharmony_ci{ 14384d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRelease001 start"; 14394d949f91Sopenharmony_ci 14404d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 14414d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Release(imageEffect); 14424d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OHImageEffectRelease001 failed"; 14434d949f91Sopenharmony_ci 14444d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRelease001 success! result: " << errorCode; 14454d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRelease001 END"; 14464d949f91Sopenharmony_ci} 14474d949f91Sopenharmony_ci 14484d949f91Sopenharmony_ci/** 14494d949f91Sopenharmony_ci * Feature: ImageEffect 14504d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Release with empty parameter 14514d949f91Sopenharmony_ci * SubFunction: NA 14524d949f91Sopenharmony_ci * FunctionPoints: NA 14534d949f91Sopenharmony_ci * EnvConditions: NA 14544d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Release with empty parameter 14554d949f91Sopenharmony_ci */ 14564d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRelease002, TestSize.Level1) 14574d949f91Sopenharmony_ci{ 14584d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRelease002 start"; 14594d949f91Sopenharmony_ci 14604d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Release(nullptr); 14614d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Release002 failed"; 14624d949f91Sopenharmony_ci 14634d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRelease002 success! result: " << errorCode; 14644d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRelease002 END"; 14654d949f91Sopenharmony_ci} 14664d949f91Sopenharmony_ci 14674d949f91Sopenharmony_ci/** 14684d949f91Sopenharmony_ci * Feature: ImageEffect 14694d949f91Sopenharmony_ci * Function: Test ImageEffectStandardFilter with normal parameter 14704d949f91Sopenharmony_ci * SubFunction: NA 14714d949f91Sopenharmony_ci * FunctionPoints: NA 14724d949f91Sopenharmony_ci * EnvConditions: NA 14734d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectStandardFilter with normal parameter 14744d949f91Sopenharmony_ci */ 14754d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectStandardFilterUnittest001, TestSize.Level1) 14764d949f91Sopenharmony_ci{ 14774d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest001 start"; 14784d949f91Sopenharmony_ci InSequence s; 14794d949f91Sopenharmony_ci 14804d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 14814d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectStandardFilterUnittest001 OH_ImageEffect_Create failed"; 14824d949f91Sopenharmony_ci 14834d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 14844d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectStandardFilterUnittest001 OH_ImageEffect_AddFilter failed"; 14854d949f91Sopenharmony_ci 14864d949f91Sopenharmony_ci ImageEffect_Any value; 14874d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 14884d949f91Sopenharmony_ci value.dataValue.floatValue = 200.f; 14894d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 14904d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 14914d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest001 OH_EffectFilter_SetValue failed"; 14924d949f91Sopenharmony_ci 14934d949f91Sopenharmony_ci ImageEffect_Any result; 14944d949f91Sopenharmony_ci errorCode = OH_EffectFilter_GetValue(filter, KEY_FILTER_INTENSITY, &result); 14954d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_GetValue failed"; 14964d949f91Sopenharmony_ci ASSERT_EQ(result.dataType, ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT) << 14974d949f91Sopenharmony_ci "OH_EffectFilter_GetValue dataType failed"; 14984d949f91Sopenharmony_ci ASSERT_EQ(result.dataValue.floatValue, 100.f) << "OH_EffectFilter_GetValue dataValue failed"; 14994d949f91Sopenharmony_ci 15004d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 15014d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15024d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest001 OH_ImageEffect_SetInputPixelmap failed"; 15034d949f91Sopenharmony_ci 15044d949f91Sopenharmony_ci std::shared_ptr<PixelMap> outputPixelmap = std::make_shared<MockPixelMap>(); 15054d949f91Sopenharmony_ci std::shared_ptr<OH_PixelmapNative> outputPixelmapNative = std::make_shared<OH_PixelmapNative>(outputPixelmap); 15064d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetOutputPixelmap(imageEffect, outputPixelmapNative.get()); 15074d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15084d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest001 OH_ImageEffect_SetOutputPixelmap failed"; 15094d949f91Sopenharmony_ci 15104d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(imageEffect); 15114d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15124d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest001 OH_ImageEffect_Start failed"; 15134d949f91Sopenharmony_ci 15144d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 15154d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15164d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest001 OH_ImageEffect_Release failed"; 15174d949f91Sopenharmony_ci 15184d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectStandardFilterUnittest001 success! result: " << errorCode; 15194d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest001 END"; 15204d949f91Sopenharmony_ci} 15214d949f91Sopenharmony_ci 15224d949f91Sopenharmony_ci/** 15234d949f91Sopenharmony_ci * Feature: ImageEffect 15244d949f91Sopenharmony_ci * Function: Test ImageEffectStandardFilter submethod OH_ImageEffect_AddFilter with not exist OH_EffectFilter parameter 15254d949f91Sopenharmony_ci * SubFunction: NA 15264d949f91Sopenharmony_ci * FunctionPoints: NA 15274d949f91Sopenharmony_ci * EnvConditions: NA 15284d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectStandardFilter submethod OH_ImageEffect_AddFilter with not exist OH_EffectFilter 15294d949f91Sopenharmony_ci * parameter 15304d949f91Sopenharmony_ci */ 15314d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectStandardFilterUnittest002, TestSize.Level1) 15324d949f91Sopenharmony_ci{ 15334d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest002 start"; 15344d949f91Sopenharmony_ci InSequence s; 15354d949f91Sopenharmony_ci 15364d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 15374d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectStandardFilterUnittest002 OH_ImageEffect_Create failed"; 15384d949f91Sopenharmony_ci 15394d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, "TestEFilter"); 15404d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "ImageEffectStandardFilterUnittest002 OH_ImageEffect_AddFilter failed"; 15414d949f91Sopenharmony_ci 15424d949f91Sopenharmony_ci ImageEffect_Any value; 15434d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 15444d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 15454d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 15464d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15474d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest002 OH_EffectFilter_SetValue failed"; 15484d949f91Sopenharmony_ci 15494d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 15504d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15514d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest002 OH_ImageEffect_SetInputPixelmap failed"; 15524d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetOutputPixelmap(imageEffect, pixelmapNative_); 15534d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15544d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest002 OH_ImageEffect_SetOutputPixelmap failed"; 15554d949f91Sopenharmony_ci 15564d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(imageEffect); 15574d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15584d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest002 OH_ImageEffect_Start failed"; 15594d949f91Sopenharmony_ci 15604d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 15614d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15624d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest002 OH_ImageEffect_Release failed"; 15634d949f91Sopenharmony_ci 15644d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectStandardFilterUnittest002 success! result: " << errorCode; 15654d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest002 END"; 15664d949f91Sopenharmony_ci} 15674d949f91Sopenharmony_ci 15684d949f91Sopenharmony_ci/** 15694d949f91Sopenharmony_ci * Feature: ImageEffect 15704d949f91Sopenharmony_ci * Function: Test ImageEffectStandardFilter submethod OH_EffectFilter_SetValue with not exist key parameter 15714d949f91Sopenharmony_ci * SubFunction: NA 15724d949f91Sopenharmony_ci * FunctionPoints: NA 15734d949f91Sopenharmony_ci * EnvConditions: NA 15744d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectStandardFilter submethod OH_EffectFilter_SetValue with not exist key parameter 15754d949f91Sopenharmony_ci */ 15764d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectStandardFilterUnittest003, TestSize.Level1) 15774d949f91Sopenharmony_ci{ 15784d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest003 start"; 15794d949f91Sopenharmony_ci InSequence s; 15804d949f91Sopenharmony_ci 15814d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 15824d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectStandardFilterUnittest003 OH_ImageEffect_Create failed"; 15834d949f91Sopenharmony_ci 15844d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 15854d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectStandardFilterUnittest003 OH_ImageEffect_AddFilter failed"; 15864d949f91Sopenharmony_ci 15874d949f91Sopenharmony_ci ImageEffect_Any value; 15884d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 15894d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 15904d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, "test", &value); 15914d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15924d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest003 OH_EffectFilter_SetValue failed"; 15934d949f91Sopenharmony_ci 15944d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 15954d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15964d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest003 OH_ImageEffect_SetInputPixelmap failed"; 15974d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetOutputPixelmap(imageEffect, pixelmapNative_); 15984d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 15994d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest003 OH_ImageEffect_SetOutputPixelmap failed"; 16004d949f91Sopenharmony_ci 16014d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(imageEffect); 16024d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16034d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest003 OH_ImageEffect_Start failed"; 16044d949f91Sopenharmony_ci 16054d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 16064d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16074d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest003 OH_ImageEffect_Release failed"; 16084d949f91Sopenharmony_ci 16094d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectStandardFilterUnittest003 success! result: " << errorCode; 16104d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest003 END"; 16114d949f91Sopenharmony_ci} 16124d949f91Sopenharmony_ci 16134d949f91Sopenharmony_ci/** 16144d949f91Sopenharmony_ci * Feature: ImageEffect 16154d949f91Sopenharmony_ci * Function: Test ImageEffectStandardFilter submethod OH_ImageEffect_Start with empty parameter 16164d949f91Sopenharmony_ci * SubFunction: NA 16174d949f91Sopenharmony_ci * FunctionPoints: NA 16184d949f91Sopenharmony_ci * EnvConditions: NA 16194d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectStandardFilter submethod OH_ImageEffect_Start with empty parameter 16204d949f91Sopenharmony_ci */ 16214d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectStandardFilterUnittest004, TestSize.Level1) 16224d949f91Sopenharmony_ci{ 16234d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest004 start"; 16244d949f91Sopenharmony_ci InSequence s; 16254d949f91Sopenharmony_ci 16264d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 16274d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectStandardFilterUnittest004 OH_ImageEffect_Create failed"; 16284d949f91Sopenharmony_ci 16294d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 16304d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectStandardFilterUnittest004 OH_ImageEffect_AddFilter failed"; 16314d949f91Sopenharmony_ci 16324d949f91Sopenharmony_ci ImageEffect_Any value; 16334d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 16344d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 16354d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 16364d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16374d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest004 OH_EffectFilter_SetValue failed"; 16384d949f91Sopenharmony_ci 16394d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 16404d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16414d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest004 OH_ImageEffect_SetInputPixelmap failed"; 16424d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetOutputPixelmap(imageEffect, pixelmapNative_); 16434d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16444d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest004 OH_ImageEffect_SetOutputPixelmap failed"; 16454d949f91Sopenharmony_ci 16464d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(nullptr); 16474d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16484d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest004 OH_ImageEffect_Start failed"; 16494d949f91Sopenharmony_ci 16504d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 16514d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16524d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest004 OH_ImageEffect_Release failed"; 16534d949f91Sopenharmony_ci 16544d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectStandardFilterUnittest004 success! result: " << errorCode; 16554d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest004 END"; 16564d949f91Sopenharmony_ci} 16574d949f91Sopenharmony_ci 16584d949f91Sopenharmony_ci/** 16594d949f91Sopenharmony_ci * Feature: ImageEffect 16604d949f91Sopenharmony_ci * Function: Test ImageEffectStandardFilter submethod OH_ImageEffect_Release with empty parameter 16614d949f91Sopenharmony_ci * SubFunction: NA 16624d949f91Sopenharmony_ci * FunctionPoints: NA 16634d949f91Sopenharmony_ci * EnvConditions: NA 16644d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectStandardFilter submethod OH_ImageEffect_Release with empty parameter 16654d949f91Sopenharmony_ci */ 16664d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectStandardFilterUnittest005, TestSize.Level1) 16674d949f91Sopenharmony_ci{ 16684d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest005 start"; 16694d949f91Sopenharmony_ci InSequence s; 16704d949f91Sopenharmony_ci 16714d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 16724d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectStandardFilterUnittest005 OH_ImageEffect_Create failed"; 16734d949f91Sopenharmony_ci 16744d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 16754d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectStandardFilterUnittest005 OH_ImageEffect_AddFilter failed"; 16764d949f91Sopenharmony_ci 16774d949f91Sopenharmony_ci ImageEffect_Any value; 16784d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 16794d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 16804d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 16814d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16824d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest005 OH_EffectFilter_SetValue failed"; 16834d949f91Sopenharmony_ci 16844d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 16854d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16864d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest005 OH_ImageEffect_SetInputPixelmap failed"; 16874d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetOutputPixelmap(imageEffect, pixelmapNative_); 16884d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16894d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest005 OH_ImageEffect_SetOutputPixelmap failed"; 16904d949f91Sopenharmony_ci 16914d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(imageEffect); 16924d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16934d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest005 OH_ImageEffect_Start failed"; 16944d949f91Sopenharmony_ci 16954d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(nullptr); 16964d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 16974d949f91Sopenharmony_ci "ImageEffectStandardFilterUnittest004 OH_ImageEffect_Release failed"; 16984d949f91Sopenharmony_ci 16994d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectStandardFilterUnittest005 success! result: " << errorCode; 17004d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectStandardFilterUnittest005 END"; 17014d949f91Sopenharmony_ci} 17024d949f91Sopenharmony_ci 17034d949f91Sopenharmony_ci/** 17044d949f91Sopenharmony_ci * Feature: ImageEffect 17054d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Register with normal parameter 17064d949f91Sopenharmony_ci * SubFunction: NA 17074d949f91Sopenharmony_ci * FunctionPoints: NA 17084d949f91Sopenharmony_ci * EnvConditions: NA 17094d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Register with normal parameter 17104d949f91Sopenharmony_ci */ 17114d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRegister001, TestSize.Level1) 17124d949f91Sopenharmony_ci{ 17134d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRegister001 start"; 17144d949f91Sopenharmony_ci 17154d949f91Sopenharmony_ci ImageEffect_FilterDelegate delegate = { 17164d949f91Sopenharmony_ci .setValue = [](OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value) { return true; }, 17174d949f91Sopenharmony_ci .render = [](OH_EffectFilter *filter, OH_EffectBufferInfo *src, OH_EffectFilterDelegate_PushData pushData) { 17184d949f91Sopenharmony_ci pushData(filter, src); 17194d949f91Sopenharmony_ci return true; 17204d949f91Sopenharmony_ci }, 17214d949f91Sopenharmony_ci .save = [](OH_EffectFilter *filter, char **info) { return true; }, 17224d949f91Sopenharmony_ci .restore = [](const char *info) { return OH_EffectFilter_Create("CustomBrightnessEFilter"); } 17234d949f91Sopenharmony_ci }; 17244d949f91Sopenharmony_ci 17254d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Register(filterInfo_, &delegate); 17264d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 17274d949f91Sopenharmony_ci "OHEFilterRegister001 OH_EffectFilter_Register failed"; 17284d949f91Sopenharmony_ci 17294d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRegister001 success! result: " << errorCode; 17304d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRegister001 END"; 17314d949f91Sopenharmony_ci} 17324d949f91Sopenharmony_ci 17334d949f91Sopenharmony_ci/** 17344d949f91Sopenharmony_ci * Feature: ImageEffect 17354d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Register with ImageEffect_FilterDelegate not exist OH_EffectFilter parameter 17364d949f91Sopenharmony_ci * SubFunction: NA 17374d949f91Sopenharmony_ci * FunctionPoints: NA 17384d949f91Sopenharmony_ci * EnvConditions: NA 17394d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Register with ImageEffect_FilterDelegate not exist OH_EffectFilter parameter 17404d949f91Sopenharmony_ci */ 17414d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRegister002, TestSize.Level1) 17424d949f91Sopenharmony_ci{ 17434d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRegister002 start"; 17444d949f91Sopenharmony_ci 17454d949f91Sopenharmony_ci ImageEffect_FilterDelegate delegate = { 17464d949f91Sopenharmony_ci .setValue = [](OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value) { return true; }, 17474d949f91Sopenharmony_ci .render = [](OH_EffectFilter *filter, OH_EffectBufferInfo *src, OH_EffectFilterDelegate_PushData pushData) { 17484d949f91Sopenharmony_ci pushData(filter, src); 17494d949f91Sopenharmony_ci return true; 17504d949f91Sopenharmony_ci }, 17514d949f91Sopenharmony_ci .save = [](OH_EffectFilter *filter, char **info) { return true; }, 17524d949f91Sopenharmony_ci .restore = [](const char *info) { return OH_EffectFilter_Create("CustomTestEFilter"); } 17534d949f91Sopenharmony_ci }; 17544d949f91Sopenharmony_ci 17554d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Register(filterInfo_, &delegate); 17564d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 17574d949f91Sopenharmony_ci "OHEFilterRegister002 OH_EffectFilter_Register failed"; 17584d949f91Sopenharmony_ci 17594d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRegister002 success! result: " << errorCode; 17604d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRegister002 END"; 17614d949f91Sopenharmony_ci} 17624d949f91Sopenharmony_ci 17634d949f91Sopenharmony_ci/** 17644d949f91Sopenharmony_ci * Feature: ImageEffect 17654d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Register with ImageEffect_FilterDelegate all false parameter 17664d949f91Sopenharmony_ci * SubFunction: NA 17674d949f91Sopenharmony_ci * FunctionPoints: NA 17684d949f91Sopenharmony_ci * EnvConditions: NA 17694d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Register with ImageEffect_FilterDelegate all false parameter 17704d949f91Sopenharmony_ci */ 17714d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRegister003, TestSize.Level1) 17724d949f91Sopenharmony_ci{ 17734d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRegister003 start"; 17744d949f91Sopenharmony_ci 17754d949f91Sopenharmony_ci ImageEffect_FilterDelegate delegate = { 17764d949f91Sopenharmony_ci .setValue = [](OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value) { return false; }, 17774d949f91Sopenharmony_ci .render = [](OH_EffectFilter *filter, OH_EffectBufferInfo *src, OH_EffectFilterDelegate_PushData pushData) { 17784d949f91Sopenharmony_ci return false; 17794d949f91Sopenharmony_ci }, 17804d949f91Sopenharmony_ci .save = [](OH_EffectFilter *filter, char **info) { return false; }, 17814d949f91Sopenharmony_ci .restore = [](const char *info) { return OH_EffectFilter_Create("CustomBrightnessEFilter"); } 17824d949f91Sopenharmony_ci }; 17834d949f91Sopenharmony_ci 17844d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Register(filterInfo_, &delegate); 17854d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 17864d949f91Sopenharmony_ci "OHEFilterRegister003 OH_EffectFilter_Register failed"; 17874d949f91Sopenharmony_ci 17884d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRegister003 success! result: " << errorCode; 17894d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRegister003 END"; 17904d949f91Sopenharmony_ci} 17914d949f91Sopenharmony_ci 17924d949f91Sopenharmony_ci/** 17934d949f91Sopenharmony_ci * Feature: ImageEffect 17944d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_Register with OH_EffectInfo not exist OH_EffectFilter parameter 17954d949f91Sopenharmony_ci * SubFunction: NA 17964d949f91Sopenharmony_ci * FunctionPoints: NA 17974d949f91Sopenharmony_ci * EnvConditions: NA 17984d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_Register with OH_EffectInfo not exist OH_EffectFilter parameter 17994d949f91Sopenharmony_ci */ 18004d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterRegister004, TestSize.Level1) 18014d949f91Sopenharmony_ci{ 18024d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRegister004 start"; 18034d949f91Sopenharmony_ci 18044d949f91Sopenharmony_ci ImageEffect_FilterDelegate delegate = { 18054d949f91Sopenharmony_ci .setValue = [](OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value) { return true; }, 18064d949f91Sopenharmony_ci .render = [](OH_EffectFilter *filter, OH_EffectBufferInfo *src, OH_EffectFilterDelegate_PushData pushData) { 18074d949f91Sopenharmony_ci pushData(filter, src); 18084d949f91Sopenharmony_ci return true; 18094d949f91Sopenharmony_ci }, 18104d949f91Sopenharmony_ci .save = [](OH_EffectFilter *filter, char **info) { return true; }, 18114d949f91Sopenharmony_ci .restore = [](const char *info) { return OH_EffectFilter_Create("CustomBrightnessEFilter"); } 18124d949f91Sopenharmony_ci }; 18134d949f91Sopenharmony_ci 18144d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_Register(filterInfo_, &delegate); 18154d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 18164d949f91Sopenharmony_ci "OHEFilterRegister004 OH_EffectFilter_Register failed"; 18174d949f91Sopenharmony_ci 18184d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterRegister004 success! result: " << errorCode; 18194d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterRegister004 END"; 18204d949f91Sopenharmony_ci} 18214d949f91Sopenharmony_ci 18224d949f91Sopenharmony_ci/** 18234d949f91Sopenharmony_ci * Feature: ImageEffect 18244d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_LookupFilterInfo with normal parameter 18254d949f91Sopenharmony_ci * SubFunction: NA 18264d949f91Sopenharmony_ci * FunctionPoints: NA 18274d949f91Sopenharmony_ci * EnvConditions: NA 18284d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_LookupFilterInfo with normal parameter 18294d949f91Sopenharmony_ci */ 18304d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterLookupFilterInfo001, TestSize.Level1) 18314d949f91Sopenharmony_ci{ 18324d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo001 start"; 18334d949f91Sopenharmony_ci 18344d949f91Sopenharmony_ci OH_EffectFilterInfo *filterInfo = OH_EffectFilterInfo_Create(); 18354d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_LookupFilterInfo(BRIGHTNESS_EFILTER, filterInfo); 18364d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_LookupFilterInfo failed"; 18374d949f91Sopenharmony_ci OH_EffectFilterInfo_Release(filterInfo); 18384d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterLookupFilterInfo001 success! result: " << errorCode; 18394d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo001 END"; 18404d949f91Sopenharmony_ci} 18414d949f91Sopenharmony_ci 18424d949f91Sopenharmony_ci/** 18434d949f91Sopenharmony_ci * Feature: ImageEffect 18444d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_LookupFilterInfo with empty key parameter 18454d949f91Sopenharmony_ci * SubFunction: NA 18464d949f91Sopenharmony_ci * FunctionPoints: NA 18474d949f91Sopenharmony_ci * EnvConditions: NA 18484d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_LookupFilterInfo with empty key parameter 18494d949f91Sopenharmony_ci */ 18504d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterLookupFilterInfo002, TestSize.Level1) 18514d949f91Sopenharmony_ci{ 18524d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo002 start"; 18534d949f91Sopenharmony_ci 18544d949f91Sopenharmony_ci OH_EffectFilterInfo *filterInfo = OH_EffectFilterInfo_Create(); 18554d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_LookupFilterInfo(nullptr, filterInfo); 18564d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OHEFilterLookupFilterInfo failed"; 18574d949f91Sopenharmony_ci OH_EffectFilterInfo_Release(filterInfo); 18584d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterLookupFilterInfo002 success! result: " << errorCode; 18594d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo002 END"; 18604d949f91Sopenharmony_ci} 18614d949f91Sopenharmony_ci 18624d949f91Sopenharmony_ci/** 18634d949f91Sopenharmony_ci * Feature: ImageEffect 18644d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_LookupFilterInfo with not esist key parameter 18654d949f91Sopenharmony_ci * SubFunction: NA 18664d949f91Sopenharmony_ci * FunctionPoints: NA 18674d949f91Sopenharmony_ci * EnvConditions: NA 18684d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_LookupFilterInfo with not esist key parameter 18694d949f91Sopenharmony_ci */ 18704d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterLookupFilterInfo003, TestSize.Level1) 18714d949f91Sopenharmony_ci{ 18724d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo003 start"; 18734d949f91Sopenharmony_ci 18744d949f91Sopenharmony_ci OH_EffectFilterInfo *filterInfo = OH_EffectFilterInfo_Create(); 18754d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_LookupFilterInfo("TestEFilter", filterInfo); 18764d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OHEFilterLookupFilterInfo003 failed"; 18774d949f91Sopenharmony_ci OH_EffectFilterInfo_Release(filterInfo); 18784d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterLookupFilterInfo003 success! result: " << errorCode; 18794d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo003 END"; 18804d949f91Sopenharmony_ci} 18814d949f91Sopenharmony_ci 18824d949f91Sopenharmony_ci/** 18834d949f91Sopenharmony_ci * Feature: ImageEffect 18844d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_LookupFilterInfo with all empty parameter 18854d949f91Sopenharmony_ci * SubFunction: NA 18864d949f91Sopenharmony_ci * FunctionPoints: NA 18874d949f91Sopenharmony_ci * EnvConditions: NA 18884d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_LookupFilterInfo with all empty parameter 18894d949f91Sopenharmony_ci */ 18904d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterLookupFilterInfo004, TestSize.Level1) 18914d949f91Sopenharmony_ci{ 18924d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo004 start"; 18934d949f91Sopenharmony_ci 18944d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_LookupFilterInfo(nullptr, nullptr); 18954d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_LookupFilterInfo failed"; 18964d949f91Sopenharmony_ci 18974d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterLookupFilterInfo004 success! result: " << errorCode; 18984d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo004 END"; 18994d949f91Sopenharmony_ci} 19004d949f91Sopenharmony_ci 19014d949f91Sopenharmony_ci/** 19024d949f91Sopenharmony_ci * Feature: ImageEffect 19034d949f91Sopenharmony_ci * Function: Test OH_EffectFilter_LookupFilterInfo with empty OH_EffectInfo parameter 19044d949f91Sopenharmony_ci * SubFunction: NA 19054d949f91Sopenharmony_ci * FunctionPoints: NA 19064d949f91Sopenharmony_ci * EnvConditions: NA 19074d949f91Sopenharmony_ci * CaseDescription: Test OH_EffectFilter_LookupFilterInfo with empty OH_EffectInfo parameter 19084d949f91Sopenharmony_ci */ 19094d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHEFilterLookupFilterInfo005, TestSize.Level1) 19104d949f91Sopenharmony_ci{ 19114d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo005 start"; 19124d949f91Sopenharmony_ci 19134d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_LookupFilterInfo(BRIGHTNESS_EFILTER, nullptr); 19144d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_EffectFilter_LookupFilterInfo failed"; 19154d949f91Sopenharmony_ci 19164d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHEFilterLookupFilterInfo005 success! result: " << errorCode; 19174d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHEFilterLookupFilterInfo005 END"; 19184d949f91Sopenharmony_ci} 19194d949f91Sopenharmony_ci 19204d949f91Sopenharmony_ci/** 19214d949f91Sopenharmony_ci * Feature: ImageEffect 19224d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Stop with normal parameter 19234d949f91Sopenharmony_ci * SubFunction: NA 19244d949f91Sopenharmony_ci * FunctionPoints: NA 19254d949f91Sopenharmony_ci * EnvConditions: NA 19264d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Stop with normal parameter 19274d949f91Sopenharmony_ci */ 19284d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectStop001, TestSize.Level1) 19294d949f91Sopenharmony_ci{ 19304d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectStop001 start"; 19314d949f91Sopenharmony_ci 19324d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 19334d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Stop(imageEffect); 19344d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Stop failed"; 19354d949f91Sopenharmony_ci 19364d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectStop001 success! result: " << errorCode; 19374d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectStop001 END"; 19384d949f91Sopenharmony_ci} 19394d949f91Sopenharmony_ci 19404d949f91Sopenharmony_ci/** 19414d949f91Sopenharmony_ci * Feature: ImageEffect 19424d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Stop with empty parameter 19434d949f91Sopenharmony_ci * SubFunction: NA 19444d949f91Sopenharmony_ci * FunctionPoints: NA 19454d949f91Sopenharmony_ci * EnvConditions: NA 19464d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Stop with empty parameter 19474d949f91Sopenharmony_ci */ 19484d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectStop002, TestSize.Level1) 19494d949f91Sopenharmony_ci{ 19504d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectStop002 start"; 19514d949f91Sopenharmony_ci 19524d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Stop(nullptr); 19534d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Stop failed"; 19544d949f91Sopenharmony_ci 19554d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectStop002 success! result: " << errorCode; 19564d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectStop002 END"; 19574d949f91Sopenharmony_ci} 19584d949f91Sopenharmony_ci 19594d949f91Sopenharmony_ci/** 19604d949f91Sopenharmony_ci * Feature: ImageEffect 19614d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Save with normal parameter 19624d949f91Sopenharmony_ci * SubFunction: NA 19634d949f91Sopenharmony_ci * FunctionPoints: NA 19644d949f91Sopenharmony_ci * EnvConditions: NA 19654d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Save with normal parameter 19664d949f91Sopenharmony_ci */ 19674d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSave001, TestSize.Level1) 19684d949f91Sopenharmony_ci{ 19694d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSave001 start"; 19704d949f91Sopenharmony_ci 19714d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 19724d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 19734d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Save(imageEffect, &imageEffectInfo); 19744d949f91Sopenharmony_ci 19754d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Save failed"; 19764d949f91Sopenharmony_ci 19774d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSave001 success! result: " << errorCode; 19784d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSave001 END"; 19794d949f91Sopenharmony_ci} 19804d949f91Sopenharmony_ci 19814d949f91Sopenharmony_ci/** 19824d949f91Sopenharmony_ci * Feature: ImageEffect 19834d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Save with empty OH_ImageEffect parameter 19844d949f91Sopenharmony_ci * SubFunction: NA 19854d949f91Sopenharmony_ci * FunctionPoints: NA 19864d949f91Sopenharmony_ci * EnvConditions: NA 19874d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Save with empty OH_ImageEffect parameter 19884d949f91Sopenharmony_ci */ 19894d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSave002, TestSize.Level1) 19904d949f91Sopenharmony_ci{ 19914d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSave002 start"; 19924d949f91Sopenharmony_ci 19934d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 19944d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Save(nullptr, &imageEffectInfo); 19954d949f91Sopenharmony_ci 19964d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Save failed"; 19974d949f91Sopenharmony_ci 19984d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSave002 success! result: " << errorCode; 19994d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSave002 END"; 20004d949f91Sopenharmony_ci} 20014d949f91Sopenharmony_ci 20024d949f91Sopenharmony_ci/** 20034d949f91Sopenharmony_ci * Feature: ImageEffect 20044d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Restore with normal parameter 20054d949f91Sopenharmony_ci * SubFunction: NA 20064d949f91Sopenharmony_ci * FunctionPoints: NA 20074d949f91Sopenharmony_ci * EnvConditions: NA 20084d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Restore with normal parameter 20094d949f91Sopenharmony_ci */ 20104d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRestore001, TestSize.Level1) 20114d949f91Sopenharmony_ci{ 20124d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRestore001 start"; 20134d949f91Sopenharmony_ci 20144d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 20154d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "OH_ImageEffect_Restore failed"; 20164d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 20174d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Save(imageEffect, &imageEffectInfo); 20184d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Restore failed"; 20194d949f91Sopenharmony_ci imageEffect = OH_ImageEffect_Restore(imageEffectInfo); 20204d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "OH_ImageEffect_Restore failed"; 20214d949f91Sopenharmony_ci 20224d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRestore001 success! result: " << errorCode; 20234d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRestore001 END"; 20244d949f91Sopenharmony_ci} 20254d949f91Sopenharmony_ci 20264d949f91Sopenharmony_ci/** 20274d949f91Sopenharmony_ci * Feature: ImageEffect 20284d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Restore submethods OH_ImageEffect_Save with empty OH_ImageEffect parameter 20294d949f91Sopenharmony_ci * SubFunction: NA 20304d949f91Sopenharmony_ci * FunctionPoints: NA 20314d949f91Sopenharmony_ci * EnvConditions: NA 20324d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Restore submethods OH_ImageEffect_Save with empty OH_ImageEffect parameter 20334d949f91Sopenharmony_ci */ 20344d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRestore002, TestSize.Level1) 20354d949f91Sopenharmony_ci{ 20364d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRestore002 start"; 20374d949f91Sopenharmony_ci 20384d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 20394d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "OH_ImageEffect_Restore failed"; 20404d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 20414d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Save(nullptr, &imageEffectInfo); 20424d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Restore failed"; 20434d949f91Sopenharmony_ci imageEffect = OH_ImageEffect_Restore(imageEffectInfo); 20444d949f91Sopenharmony_ci ASSERT_EQ(imageEffect, nullptr) << "OH_ImageEffect_Restore failed"; 20454d949f91Sopenharmony_ci 20464d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRestore002 success! result: " << errorCode; 20474d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRestore002 END"; 20484d949f91Sopenharmony_ci} 20494d949f91Sopenharmony_ci 20504d949f91Sopenharmony_ci/** 20514d949f91Sopenharmony_ci * Feature: ImageEffect 20524d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_Restore with empty parameter 20534d949f91Sopenharmony_ci * SubFunction: NA 20544d949f91Sopenharmony_ci * FunctionPoints: NA 20554d949f91Sopenharmony_ci * EnvConditions: NA 20564d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_Restore with empty parameter 20574d949f91Sopenharmony_ci */ 20584d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectRestore003, TestSize.Level1) 20594d949f91Sopenharmony_ci{ 20604d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRestore003 start"; 20614d949f91Sopenharmony_ci 20624d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 20634d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "OH_ImageEffect_Restore failed"; 20644d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 20654d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_Save(imageEffect, &imageEffectInfo); 20664d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_Restore failed"; 20674d949f91Sopenharmony_ci imageEffect = OH_ImageEffect_Restore(nullptr); 20684d949f91Sopenharmony_ci ASSERT_EQ(imageEffect, nullptr) << "OH_ImageEffect_Restore failed"; 20694d949f91Sopenharmony_ci 20704d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectRestore003 success! result: " << errorCode; 20714d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectRestore003 END"; 20724d949f91Sopenharmony_ci} 20734d949f91Sopenharmony_ci 20744d949f91Sopenharmony_ci/** 20754d949f91Sopenharmony_ci * Feature: ImageEffect 20764d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetOutputSurface with normal parameter 20774d949f91Sopenharmony_ci * SubFunction: NA 20784d949f91Sopenharmony_ci * FunctionPoints: NA 20794d949f91Sopenharmony_ci * EnvConditions: NA 20804d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetOutputSurface with normal parameter 20814d949f91Sopenharmony_ci */ 20824d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetOutputSurface001, TestSize.Level1) 20834d949f91Sopenharmony_ci{ 20844d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputSurface001 start"; 20854d949f91Sopenharmony_ci 20864d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 20874d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetOutputSurface(imageEffect, nativeWindow_); 20884d949f91Sopenharmony_ci 20894d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetOutputSurface failed"; 20904d949f91Sopenharmony_ci 20914d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetOutputSurface001 success! result: " << errorCode; 20924d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputSurface001 END"; 20934d949f91Sopenharmony_ci} 20944d949f91Sopenharmony_ci 20954d949f91Sopenharmony_ci/** 20964d949f91Sopenharmony_ci * Feature: ImageEffect 20974d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetOutputSurface with all empty parameter 20984d949f91Sopenharmony_ci * SubFunction: NA 20994d949f91Sopenharmony_ci * FunctionPoints: NA 21004d949f91Sopenharmony_ci * EnvConditions: NA 21014d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetOutputSurface with all empty parameter 21024d949f91Sopenharmony_ci */ 21034d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetOutputSurface002, TestSize.Level1) 21044d949f91Sopenharmony_ci{ 21054d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputSurface002 start"; 21064d949f91Sopenharmony_ci 21074d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetOutputSurface(nullptr, nullptr); 21084d949f91Sopenharmony_ci 21094d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetOutputSurface failed"; 21104d949f91Sopenharmony_ci 21114d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetOutputSurface002 success! result: " << errorCode; 21124d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputSurface002 END"; 21134d949f91Sopenharmony_ci} 21144d949f91Sopenharmony_ci 21154d949f91Sopenharmony_ci/** 21164d949f91Sopenharmony_ci * Feature: ImageEffect 21174d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetOutputSurface with empty OH_ImageEffect parameter 21184d949f91Sopenharmony_ci * SubFunction: NA 21194d949f91Sopenharmony_ci * FunctionPoints: NA 21204d949f91Sopenharmony_ci * EnvConditions: NA 21214d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetOutputSurface with empty OH_ImageEffect parameter 21224d949f91Sopenharmony_ci */ 21234d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetOutputSurface003, TestSize.Level1) 21244d949f91Sopenharmony_ci{ 21254d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputSurface003 start"; 21264d949f91Sopenharmony_ci 21274d949f91Sopenharmony_ci OHNativeWindow *nativeWindow = new OHNativeWindow(); 21284d949f91Sopenharmony_ci nativeWindow->surface = nullptr; 21294d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetOutputSurface(nullptr, nativeWindow); 21304d949f91Sopenharmony_ci 21314d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetOutputSurface failed"; 21324d949f91Sopenharmony_ci 21334d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetOutputSurface003 success! result: " << errorCode; 21344d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputSurface003 END"; 21354d949f91Sopenharmony_ci} 21364d949f91Sopenharmony_ci 21374d949f91Sopenharmony_ci/** 21384d949f91Sopenharmony_ci * Feature: ImageEffect 21394d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetOutputSurface with empty surfaceId parameter 21404d949f91Sopenharmony_ci * SubFunction: NA 21414d949f91Sopenharmony_ci * FunctionPoints: NA 21424d949f91Sopenharmony_ci * EnvConditions: NA 21434d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetOutputSurface with empty surfaceId parameter 21444d949f91Sopenharmony_ci */ 21454d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetOutputSurface004, TestSize.Level1) 21464d949f91Sopenharmony_ci{ 21474d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputSurface004 start"; 21484d949f91Sopenharmony_ci 21494d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 21504d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetOutputSurface(imageEffect, nullptr); 21514d949f91Sopenharmony_ci 21524d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetOutputSurface failed"; 21534d949f91Sopenharmony_ci 21544d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetOutputSurface004 success! result: " << errorCode; 21554d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetOutputSurface004 END"; 21564d949f91Sopenharmony_ci} 21574d949f91Sopenharmony_ci 21584d949f91Sopenharmony_ci/** 21594d949f91Sopenharmony_ci * Feature: ImageEffect 21604d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_GetInputSurface with normal parameter 21614d949f91Sopenharmony_ci * SubFunction: NA 21624d949f91Sopenharmony_ci * FunctionPoints: NA 21634d949f91Sopenharmony_ci * EnvConditions: NA 21644d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_GetInputSurface with normal parameter 21654d949f91Sopenharmony_ci */ 21664d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectGetInputSurface001, TestSize.Level1) 21674d949f91Sopenharmony_ci{ 21684d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectGetInputSurface001 start"; 21694d949f91Sopenharmony_ci 21704d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 21714d949f91Sopenharmony_ci OHNativeWindow *nativeWindow = nullptr; 21724d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_GetInputSurface(imageEffect, &nativeWindow); 21734d949f91Sopenharmony_ci 21744d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_GetInputSurface failed"; 21754d949f91Sopenharmony_ci ASSERT_NE(nativeWindow, nullptr) << "OH_ImageEffect_GetInputSurface failed"; 21764d949f91Sopenharmony_ci 21774d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectGetInputSurface001 success! result: " << errorCode; 21784d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectGetInputSurface001 END"; 21794d949f91Sopenharmony_ci} 21804d949f91Sopenharmony_ci 21814d949f91Sopenharmony_ci/** 21824d949f91Sopenharmony_ci * Feature: ImageEffect 21834d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_GetInputSurface with empty OH_ImageEffect parameter 21844d949f91Sopenharmony_ci * SubFunction: NA 21854d949f91Sopenharmony_ci * FunctionPoints: NA 21864d949f91Sopenharmony_ci * EnvConditions: NA 21874d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_GetInputSurface with empty OH_ImageEffect parameter 21884d949f91Sopenharmony_ci */ 21894d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectGetInputSurface002, TestSize.Level1) 21904d949f91Sopenharmony_ci{ 21914d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectGetInputSurface002 start"; 21924d949f91Sopenharmony_ci 21934d949f91Sopenharmony_ci OHNativeWindow *nativeWindow = nullptr; 21944d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_GetInputSurface(nullptr, &nativeWindow); 21954d949f91Sopenharmony_ci 21964d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_GetInputSurface failed"; 21974d949f91Sopenharmony_ci ASSERT_EQ(nativeWindow, nullptr) << "OH_ImageEffect_GetInputSurface failed"; 21984d949f91Sopenharmony_ci 21994d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectGetInputSurface002 success! result: " << errorCode; 22004d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectGetInputSurface002 END"; 22014d949f91Sopenharmony_ci} 22024d949f91Sopenharmony_ci 22034d949f91Sopenharmony_ci/** 22044d949f91Sopenharmony_ci * Feature: ImageEffect 22054d949f91Sopenharmony_ci * Function: Test ImageEffectSaveAndRestore with normal parameter 22064d949f91Sopenharmony_ci * SubFunction: NA 22074d949f91Sopenharmony_ci * FunctionPoints: NA 22084d949f91Sopenharmony_ci * EnvConditions: NA 22094d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSaveAndRestore with normal parameter 22104d949f91Sopenharmony_ci */ 22114d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSaveAndRestoreUnittest001, TestSize.Level1) 22124d949f91Sopenharmony_ci{ 22134d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSaveAndRestoreUnittest001 start"; 22144d949f91Sopenharmony_ci 22154d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 22164d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectSaveAndRestoreUnittest001 OH_ImageEffect_Create failed"; 22174d949f91Sopenharmony_ci 22184d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 22194d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectSaveAndRestoreUnittest001 OH_ImageEffect_AddFilter failed"; 22204d949f91Sopenharmony_ci 22214d949f91Sopenharmony_ci ImageEffect_Any value; 22224d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 22234d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 22244d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 22254d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 22264d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest001 OH_EffectFilter_SetValue failed"; 22274d949f91Sopenharmony_ci 22284d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 22294d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Save(imageEffect, &imageEffectInfo); 22304d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 22314d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest001 OH_EffectFilter_SetValue failed"; 22324d949f91Sopenharmony_ci 22334d949f91Sopenharmony_ci ASSERT_NE(imageEffectInfo, nullptr) << "ImageEffectSaveAndRestoreUnittest001 imageEffectInfo is null"; 22344d949f91Sopenharmony_ci std::string info = imageEffectInfo; 22354d949f91Sopenharmony_ci 22364d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 22374d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 22384d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest001 OH_ImageEffect_Release failed"; 22394d949f91Sopenharmony_ci 22404d949f91Sopenharmony_ci imageEffect = OH_ImageEffect_Restore(info.c_str()); 22414d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectSaveAndRestoreUnittest001 OH_ImageEffect_Restore failed"; 22424d949f91Sopenharmony_ci 22434d949f91Sopenharmony_ci OH_EffectFilter *restoreFilter = OH_ImageEffect_GetFilter(imageEffect, 0); 22444d949f91Sopenharmony_ci ASSERT_NE(restoreFilter, nullptr) << "ImageEffectSaveAndRestoreUnittest001: OH_ImageEffect_GetFilter failed"; 22454d949f91Sopenharmony_ci 22464d949f91Sopenharmony_ci ImageEffect_Any restoreValue; 22474d949f91Sopenharmony_ci OH_EffectFilter_GetValue(restoreFilter, KEY_FILTER_INTENSITY, &restoreValue); 22484d949f91Sopenharmony_ci ASSERT_FLOAT_EQ(restoreValue.dataValue.floatValue, 100.f) << 22494d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest001 OH_EffectFilter_GetValue failed"; 22504d949f91Sopenharmony_ci 22514d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 22524d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 22534d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest001 OH_ImageEffect_SetInputPixelmap failed"; 22544d949f91Sopenharmony_ci 22554d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(imageEffect); 22564d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 22574d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest001 OH_ImageEffect_Start failed"; 22584d949f91Sopenharmony_ci 22594d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 22604d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 22614d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest001 OH_ImageEffect_Release failed"; 22624d949f91Sopenharmony_ci 22634d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectSaveAndRestoreUnittest001 success! result: " << errorCode; 22644d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest ImageEffectSaveAndRestoreUnittest001 END"; 22654d949f91Sopenharmony_ci} 22664d949f91Sopenharmony_ci 22674d949f91Sopenharmony_ci/** 22684d949f91Sopenharmony_ci * Feature: ImageEffect 22694d949f91Sopenharmony_ci * Function: Test ImageEffectSaveAndRestore unobstructed func OH_ImageEffect_Create 22704d949f91Sopenharmony_ci * SubFunction: NA 22714d949f91Sopenharmony_ci * FunctionPoints: NA 22724d949f91Sopenharmony_ci * EnvConditions: NA 22734d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSaveAndRestore unobstructed func OH_ImageEffect_Create 22744d949f91Sopenharmony_ci */ 22754d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSaveAndRestoreUnittest002, TestSize.Level1) 22764d949f91Sopenharmony_ci{ 22774d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSaveAndRestoreUnittest002 start"; 22784d949f91Sopenharmony_ci 22794d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(nullptr, BRIGHTNESS_EFILTER); 22804d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "ImageEffectSaveAndRestoreUnittest002 OH_ImageEffect_AddFilter failed"; 22814d949f91Sopenharmony_ci 22824d949f91Sopenharmony_ci ImageEffect_Any value; 22834d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 22844d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 22854d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 22864d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 22874d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest002 OH_EffectFilter_SetValue failed"; 22884d949f91Sopenharmony_ci 22894d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 22904d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Save(nullptr, &imageEffectInfo); 22914d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 22924d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest002 OH_EffectFilter_SetValue failed"; 22934d949f91Sopenharmony_ci 22944d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(nullptr); 22954d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 22964d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest00 OH_ImageEffect_Release failed"; 22974d949f91Sopenharmony_ci 22984d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(nullptr, pixelmapNative_); 22994d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23004d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest002 OH_ImageEffect_SetInputPixelmap failed"; 23014d949f91Sopenharmony_ci 23024d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(nullptr); 23034d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23044d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest002 OH_ImageEffect_Start failed"; 23054d949f91Sopenharmony_ci 23064d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(nullptr); 23074d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23084d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest002 OH_ImageEffect_Release failed"; 23094d949f91Sopenharmony_ci 23104d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectSaveAndRestoreUnittest002 success! result: " << errorCode; 23114d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSaveAndRestoreUnittest002 END"; 23124d949f91Sopenharmony_ci} 23134d949f91Sopenharmony_ci 23144d949f91Sopenharmony_ci/** 23154d949f91Sopenharmony_ci * Feature: ImageEffect 23164d949f91Sopenharmony_ci * Function: Test ImageEffectSaveAndRestore unobstructed func OH_ImageEffect_AddFilter 23174d949f91Sopenharmony_ci * SubFunction: NA 23184d949f91Sopenharmony_ci * FunctionPoints: NA 23194d949f91Sopenharmony_ci * EnvConditions: NA 23204d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSaveAndRestore unobstructed func OH_ImageEffect_AddFilter 23214d949f91Sopenharmony_ci */ 23224d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSaveAndRestoreUnittest003, TestSize.Level1) 23234d949f91Sopenharmony_ci{ 23244d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest ImageEffectSaveAndRestoreUnittest003 start"; 23254d949f91Sopenharmony_ci 23264d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 23274d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectSaveAndRestoreUnittest003 OH_ImageEffect_Create failed"; 23284d949f91Sopenharmony_ci 23294d949f91Sopenharmony_ci ImageEffect_Any value; 23304d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 23314d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 23324d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(nullptr, KEY_FILTER_INTENSITY, &value); 23334d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23344d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest003 OH_EffectFilter_SetValue failed"; 23354d949f91Sopenharmony_ci 23364d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 23374d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Save(imageEffect, &imageEffectInfo); 23384d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23394d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest003 OH_EffectFilter_SetValue failed"; 23404d949f91Sopenharmony_ci ASSERT_NE(imageEffectInfo, nullptr); 23414d949f91Sopenharmony_ci std::string infoStr = imageEffectInfo; 23424d949f91Sopenharmony_ci 23434d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 23444d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23454d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest003 OH_ImageEffect_Release failed"; 23464d949f91Sopenharmony_ci 23474d949f91Sopenharmony_ci imageEffect = OH_ImageEffect_Restore(infoStr.c_str()); 23484d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectSaveAndRestoreUnittest00 OH_ImageEffect_Restore failed"; 23494d949f91Sopenharmony_ci 23504d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 23514d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23524d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest003 OH_ImageEffect_SetInputPixelmap failed"; 23534d949f91Sopenharmony_ci 23544d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(imageEffect); 23554d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23564d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest003 OH_ImageEffect_Start failed"; 23574d949f91Sopenharmony_ci 23584d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 23594d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23604d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest003 OH_ImageEffect_Release failed"; 23614d949f91Sopenharmony_ci 23624d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectSaveAndRestoreUnittest003 success! result: " << errorCode; 23634d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest ImageEffectSaveAndRestoreUnittest003 END"; 23644d949f91Sopenharmony_ci} 23654d949f91Sopenharmony_ci 23664d949f91Sopenharmony_ci/** 23674d949f91Sopenharmony_ci * Feature: ImageEffect 23684d949f91Sopenharmony_ci * Function: Test ImageEffectSaveAndRestore with empty inputPixelmap parameter 23694d949f91Sopenharmony_ci * SubFunction: NA 23704d949f91Sopenharmony_ci * FunctionPoints: NA 23714d949f91Sopenharmony_ci * EnvConditions: NA 23724d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSaveAndRestore with empty inputPixelmap parameter 23734d949f91Sopenharmony_ci */ 23744d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSaveAndRestoreUnittest004, TestSize.Level1) 23754d949f91Sopenharmony_ci{ 23764d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest ImageEffectSaveAndRestoreUnittest004 start"; 23774d949f91Sopenharmony_ci 23784d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 23794d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectSaveAndRestoreUnittest004 OH_ImageEffect_Create failed"; 23804d949f91Sopenharmony_ci 23814d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, BRIGHTNESS_EFILTER); 23824d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr) << "ImageEffectSaveAndRestoreUnittest004 OH_ImageEffect_AddFilter failed"; 23834d949f91Sopenharmony_ci 23844d949f91Sopenharmony_ci ImageEffect_Any value; 23854d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 23864d949f91Sopenharmony_ci value.dataValue.floatValue = 100.f; 23874d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 23884d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23894d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest004 OH_EffectFilter_SetValue failed"; 23904d949f91Sopenharmony_ci 23914d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 23924d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Save(imageEffect, &imageEffectInfo); 23934d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 23944d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest004 OH_EffectFilter_SetValue failed"; 23954d949f91Sopenharmony_ci 23964d949f91Sopenharmony_ci ASSERT_NE(imageEffectInfo, nullptr); 23974d949f91Sopenharmony_ci std::string info = imageEffectInfo; 23984d949f91Sopenharmony_ci 23994d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 24004d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 24014d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest004 OH_ImageEffect_Release failed"; 24024d949f91Sopenharmony_ci 24034d949f91Sopenharmony_ci imageEffect = OH_ImageEffect_Restore(info.c_str()); 24044d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "ImageEffectSaveAndRestoreUnittest004 OH_ImageEffect_Restore failed"; 24054d949f91Sopenharmony_ci 24064d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, nullptr); 24074d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 24084d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest004 OH_ImageEffect_SetInputPixelmap failed"; 24094d949f91Sopenharmony_ci 24104d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(imageEffect); 24114d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 24124d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest004 OH_ImageEffect_Start failed"; 24134d949f91Sopenharmony_ci 24144d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 24154d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << 24164d949f91Sopenharmony_ci "ImageEffectSaveAndRestoreUnittest004 OH_ImageEffect_Release failed"; 24174d949f91Sopenharmony_ci 24184d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectSaveAndRestoreUnittest004 success! result: " << errorCode; 24194d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: ImageEffectSaveAndRestoreUnittest004 END"; 24204d949f91Sopenharmony_ci} 24214d949f91Sopenharmony_ci 24224d949f91Sopenharmony_ci/** 24234d949f91Sopenharmony_ci * Feature: ImageEffect 24244d949f91Sopenharmony_ci * Function: Test ImageEffectSaveAndRestore with ContrastEFilter normal parameter 24254d949f91Sopenharmony_ci * SubFunction: NA 24264d949f91Sopenharmony_ci * FunctionPoints: NA 24274d949f91Sopenharmony_ci * EnvConditions: NA 24284d949f91Sopenharmony_ci * CaseDescription: Test ImageEffectSaveAndRestore with ContrastEFilter normal parameter 24294d949f91Sopenharmony_ci */ 24304d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, ImageEffectSaveAndRestoreUnittest005, TestSize.Level1) 24314d949f91Sopenharmony_ci{ 24324d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 24334d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr); 24344d949f91Sopenharmony_ci 24354d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_AddFilter(imageEffect, CONTRAST_EFILTER); 24364d949f91Sopenharmony_ci ASSERT_NE(filter, nullptr); 24374d949f91Sopenharmony_ci 24384d949f91Sopenharmony_ci ImageEffect_Any value; 24394d949f91Sopenharmony_ci value.dataType = ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT; 24404d949f91Sopenharmony_ci value.dataValue.floatValue = 200.f; 24414d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_EffectFilter_SetValue(filter, KEY_FILTER_INTENSITY, &value); 24424d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 24434d949f91Sopenharmony_ci 24444d949f91Sopenharmony_ci ImageEffect_Any result; 24454d949f91Sopenharmony_ci errorCode = OH_EffectFilter_GetValue(filter, KEY_FILTER_INTENSITY, &result); 24464d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 24474d949f91Sopenharmony_ci ASSERT_EQ(result.dataType, ImageEffect_DataType::EFFECT_DATA_TYPE_FLOAT); 24484d949f91Sopenharmony_ci ASSERT_EQ(result.dataValue.floatValue, 100.f); 24494d949f91Sopenharmony_ci 24504d949f91Sopenharmony_ci char *imageEffectInfo = nullptr; 24514d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Save(imageEffect, &imageEffectInfo); 24524d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 24534d949f91Sopenharmony_ci 24544d949f91Sopenharmony_ci ASSERT_NE(imageEffectInfo, nullptr); 24554d949f91Sopenharmony_ci std::string info = imageEffectInfo; 24564d949f91Sopenharmony_ci 24574d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 24584d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 24594d949f91Sopenharmony_ci 24604d949f91Sopenharmony_ci imageEffect = OH_ImageEffect_Restore(info.c_str()); 24614d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr); 24624d949f91Sopenharmony_ci 24634d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetInputPixelmap(imageEffect, pixelmapNative_); 24644d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 24654d949f91Sopenharmony_ci 24664d949f91Sopenharmony_ci std::shared_ptr<PixelMap> outputPixelmap = std::make_shared<MockPixelMap>(); 24674d949f91Sopenharmony_ci std::shared_ptr<OH_PixelmapNative> outputPixelmapNative = std::make_shared<OH_PixelmapNative>(outputPixelmap); 24684d949f91Sopenharmony_ci errorCode = OH_ImageEffect_SetOutputPixelmap(imageEffect, outputPixelmapNative.get()); 24694d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 24704d949f91Sopenharmony_ci 24714d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Start(imageEffect); 24724d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 24734d949f91Sopenharmony_ci 24744d949f91Sopenharmony_ci errorCode = OH_ImageEffect_Release(imageEffect); 24754d949f91Sopenharmony_ci ASSERT_EQ(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS); 24764d949f91Sopenharmony_ci} 24774d949f91Sopenharmony_ci 24784d949f91Sopenharmony_ci/** 24794d949f91Sopenharmony_ci * Feature: ImageEffect 24804d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_SetInputUri with empty uri parameter 24814d949f91Sopenharmony_ci * SubFunction: NA 24824d949f91Sopenharmony_ci * FunctionPoints: NA 24834d949f91Sopenharmony_ci * EnvConditions: NA 24844d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_SetInputUri with empty uri parameter 24854d949f91Sopenharmony_ci */ 24864d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectSetInputUri001, TestSize.Level1) 24874d949f91Sopenharmony_ci{ 24884d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputUri001 start"; 24894d949f91Sopenharmony_ci OH_ImageEffect *imageEffect = OH_ImageEffect_Create(IMAGE_EFFECT_NAME); 24904d949f91Sopenharmony_ci ASSERT_NE(imageEffect, nullptr) << "OHImageEffectSetInputUri001 OH_ImageEffect_Create failed"; 24914d949f91Sopenharmony_ci 24924d949f91Sopenharmony_ci ImageEffect_ErrorCode errorCode = OH_ImageEffect_SetInputUri(imageEffect, nullptr); 24934d949f91Sopenharmony_ci ASSERT_NE(errorCode, ImageEffect_ErrorCode::EFFECT_SUCCESS) << "OH_ImageEffect_SetInputUri failed"; 24944d949f91Sopenharmony_ci 24954d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectSetInputUri001 success! result: " << errorCode; 24964d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectSetInputUri001 END"; 24974d949f91Sopenharmony_ci} 24984d949f91Sopenharmony_ci 24994d949f91Sopenharmony_ci/** 25004d949f91Sopenharmony_ci * Feature: ImageEffect 25014d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_FiltersSize with empty parameter 25024d949f91Sopenharmony_ci * SubFunction: NA 25034d949f91Sopenharmony_ci * FunctionPoints: NA 25044d949f91Sopenharmony_ci * EnvConditions: NA 25054d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_FiltersSize with empty parameter 25064d949f91Sopenharmony_ci */ 25074d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OHImageEffectFiltersSize001, TestSize.Level1) 25084d949f91Sopenharmony_ci{ 25094d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectFiltersSize001 start"; 25104d949f91Sopenharmony_ci int32_t res = OH_ImageEffect_GetFilterCount(nullptr); 25114d949f91Sopenharmony_ci ASSERT_EQ(res, 0) << "OHImageEffectFiltersSize001 OH_ImageEffect_FiltersSize failed"; 25124d949f91Sopenharmony_ci 25134d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OHImageEffectFiltersSize001 success! result: " << res; 25144d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OHImageEffectFiltersSize001 END"; 25154d949f91Sopenharmony_ci} 25164d949f91Sopenharmony_ci 25174d949f91Sopenharmony_ci/** 25184d949f91Sopenharmony_ci * Feature: ImageEffect 25194d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_GetFilter with empty parameter 25204d949f91Sopenharmony_ci * SubFunction: NA 25214d949f91Sopenharmony_ci * FunctionPoints: NA 25224d949f91Sopenharmony_ci * EnvConditions: NA 25234d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_GetFilter with empty parameter 25244d949f91Sopenharmony_ci */ 25254d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OH_ImageEffect_GetFilter001, TestSize.Level1) 25264d949f91Sopenharmony_ci{ 25274d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OH_ImageEffect_GetFilter001 start"; 25284d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_GetFilter(nullptr, 0); 25294d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "OH_ImageEffect_GetFilter001 OH_ImageEffect_GetFilter failed"; 25304d949f91Sopenharmony_ci 25314d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OH_ImageEffect_GetFilter001 success! result: " << filter; 25324d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OH_ImageEffect_GetFilter001 END"; 25334d949f91Sopenharmony_ci} 25344d949f91Sopenharmony_ci 25354d949f91Sopenharmony_ci/** 25364d949f91Sopenharmony_ci * Feature: ImageEffect 25374d949f91Sopenharmony_ci * Function: Test OH_ImageEffect_GetFilter with empty parameter and negative index 25384d949f91Sopenharmony_ci * SubFunction: NA 25394d949f91Sopenharmony_ci * FunctionPoints: NA 25404d949f91Sopenharmony_ci * EnvConditions: NA 25414d949f91Sopenharmony_ci * CaseDescription: Test OH_ImageEffect_GetFilter with empty parameter and negative index 25424d949f91Sopenharmony_ci */ 25434d949f91Sopenharmony_ciHWTEST_F(ImageEffectCApiUnittest, OH_ImageEffect_GetFilter002, TestSize.Level1) 25444d949f91Sopenharmony_ci{ 25454d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OH_ImageEffect_GetFilter002 start"; 25464d949f91Sopenharmony_ci OH_EffectFilter *filter = OH_ImageEffect_GetFilter(nullptr, -1); 25474d949f91Sopenharmony_ci ASSERT_EQ(filter, nullptr) << "OH_ImageEffect_GetFilter002 OH_ImageEffect_GetFilter failed"; 25484d949f91Sopenharmony_ci 25494d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "OH_ImageEffect_GetFilter002 success! result: " << filter; 25504d949f91Sopenharmony_ci GTEST_LOG_(INFO) << "ImageEffectCApiUnittest: OH_ImageEffect_GetFilter002 END"; 25514d949f91Sopenharmony_ci} 25524d949f91Sopenharmony_ci} // namespace Effect 25534d949f91Sopenharmony_ci} // namespace Media 25544d949f91Sopenharmony_ci} // namespace OHOS