• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 "effect_chain_unittest.h"
17 #include "builder.h"
18 #include "image_chain.h"
19 
20 using namespace testing;
21 using namespace testing::ext;
22 
23 namespace OHOS {
24 namespace Rosen {
25 /**
26  * @tc.name: BuilderCreateFromConfigTest001
27  * @tc.desc: Ensure the ability of creating effect chain from config file.
28  * @tc.type: FUNC
29  * @tc.require:
30  * @tc.author:
31  */
32 HWTEST_F(EffectChainUnittest, BuilderCreateFromConfigTest001, TestSize.Level1)
33 {
34     GTEST_LOG_(INFO) << "EffectChainUnittest BuilderCreateFromConfigTest001 start";
35     /**
36      * @tc.steps: step1. Create a builder pointer
37      */
38     std::unique_ptr<Builder> builder = std::make_unique<Builder>();
39     /**
40      * @tc.steps: step2. Call createFromConfig to load file
41      */
42     ImageChain* imageChain = builder->CreateFromConfig("/cannot/find/config.json");
43     EXPECT_EQ(imageChain, nullptr);
44 }
45 
46 /**
47  * @tc.name: BuilderCreateFromConfigTest002
48  * @tc.desc: Ensure the ability of creating effect chain from config file.
49  * @tc.type: FUNC
50  * @tc.require:
51  * @tc.author:
52  */
53 HWTEST_F(EffectChainUnittest, BuilderCreateFromConfigTest002, TestSize.Level1)
54 {
55     GTEST_LOG_(INFO) << "EffectChainUnittest BuilderCreateFromConfigTest002 start";
56     /**
57      * @tc.steps: step1. Create a builder pointer
58      */
59     std::unique_ptr<Builder> builder = std::make_unique<Builder>();
60     /**
61      * @tc.steps: step2. Call createFromConfig to load file
62      */
63     ImageChain* imageChain = builder->CreateFromConfig("config.json");
64     EXPECT_EQ(imageChain, nullptr);
65 }
66 
67 /**
68  * @tc.name: BuilderCreateFromConfigTest003
69  * @tc.desc: Ensure the ability of creating effect chain from config file.
70  * @tc.type: FUNC
71  * @tc.require:
72  * @tc.author:
73  */
74 HWTEST_F(EffectChainUnittest, BuilderCreateFromConfigTest003, TestSize.Level1)
75 {
76     GTEST_LOG_(INFO) << "EffectChainUnittest BuilderCreateFromConfigTest003 start";
77     /**
78      * @tc.steps: step1. Create a builder pointer
79      */
80     std::unique_ptr<Builder> builder = std::make_unique<Builder>();
81     /**
82      * @tc.steps: step2. Call createFromConfig to load file
83      */
84     ImageChain* imageChain = builder->CreateFromConfig("");
85     EXPECT_EQ(imageChain, nullptr);
86 }
87 } // namespace Rosen
88 } // namespace OHOS
89