1 /*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gtest/gtest.h>
17
18 #include "ext/gex_flow_light_sweep_shader.h"
19
20 #include "draw/color.h"
21 #include "image/bitmap.h"
22
23 using namespace testing;
24 using namespace testing::ext;
25
26 namespace OHOS {
27 namespace GraphicsEffectEngine {
28
29 using namespace Rosen;
30
31 class GEXFlowLightSweepShaderTest : public testing::Test {
32 public:
33 static void SetUpTestCase();
34 static void TearDownTestCase();
35 void SetUp() override;
36 void TearDown() override;
37 };
38
SetUpTestCase()39 void GEXFlowLightSweepShaderTest::SetUpTestCase() {}
TearDownTestCase()40 void GEXFlowLightSweepShaderTest::TearDownTestCase() {}
SetUp()41 void GEXFlowLightSweepShaderTest::SetUp() {}
TearDown()42 void GEXFlowLightSweepShaderTest::TearDown() {}
43
44 /**
45 * @tc.name: CreateDynamicImpl001
46 * @tc.desc: Verify function CreateDynamicImpl
47 * @tc.type:FUNC
48 */
49 HWTEST_F(GEXFlowLightSweepShaderTest, CreateDynamicImpl001, TestSize.Level1)
50 {
51 std::vector<std::pair<Drawing::Color, float>> para;
52 para.push_back(std::pair(Drawing::Color::COLOR_RED, 0.0f));
53 para.push_back(std::pair(Drawing::Color::COLOR_GREEN, 0.5f));
54 auto shader = GEXFlowLightSweepShader::CreateDynamicImpl(para);
55
56 ASSERT_NE(shader, nullptr);
57 }
58
59 /**
60 * @tc.name: GetDescription001
61 * @tc.desc: Verify function GetDescription
62 * @tc.type:FUNC
63 */
64 HWTEST_F(GEXFlowLightSweepShaderTest, GetDescription001, TestSize.Level1)
65 {
66 auto shader = std::make_shared<GEXFlowLightSweepShader>();
67 ASSERT_TRUE(shader != nullptr);
68
69 std::string expectStr = "GEXFlowLightSweepShader";
70 EXPECT_EQ(shader->GetDescription(), expectStr);
71 }
72
73 } // namespace GraphicsEffectEngine
74 } // namespace OHOS
75