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, Hardware
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 "EGL/egl_wrapper_layer.h"
19 
20 #include "egl_defs.h"
21 
22 using namespace testing;
23 using namespace testing::ext;
24 
25 namespace OHOS::Rosen {
26 class EglWrapperLayerTest : public testing::Test {
27 public:
SetUpTestCase()28     static void SetUpTestCase() {}
TearDownTestCase()29     static void TearDownTestCase() {}
SetUp()30     void SetUp() {}
TearDown()31     void TearDown() {}
32 };
33 
34 /**
35  * @tc.name: Init001
36  * @tc.desc:
37  * @tc.type: FUNC
38  */
HWTEST_F(EglWrapperLayerTest,Init001,Level1)39 HWTEST_F(EglWrapperLayerTest, Init001, Level1)
40 {
41     EglWrapperDispatchTable dispatchTable;
42 
43     auto result = EglWrapperLayer::GetInstance().Init(&dispatchTable);
44     ASSERT_TRUE(result);
45 }
46 
47 /**
48  * @tc.name: Init002
49  * @tc.desc:
50  * @tc.type: FUNC
51  */
HWTEST_F(EglWrapperLayerTest,Init002,Level2)52 HWTEST_F(EglWrapperLayerTest, Init002, Level2)
53 {
54     EglWrapperDispatchTable dispatchTable;
55     auto result = EglWrapperLayer::GetInstance().Init(&dispatchTable);
56     ASSERT_TRUE(result);
57     result = EglWrapperLayer::GetInstance().Init(&dispatchTable);
58     ASSERT_TRUE(result);
59 }
60 
61 /**
62  * @tc.name: InitLayers001
63  * @tc.desc:
64  * @tc.type: FUNC
65  */
HWTEST_F(EglWrapperLayerTest,InitLayers001,Level1)66 HWTEST_F(EglWrapperLayerTest, InitLayers001, Level1)
67 {
68     EglWrapperDispatchTable dispatchTable;
69     bool result = true;
70     EglWrapperLayer::GetInstance().InitLayers(&dispatchTable);
71     ASSERT_TRUE(result);
72 }
73 
74 /**
75  * @tc.name: LoadLayers001
76  * @tc.desc:
77  * @tc.type: FUNC
78  */
HWTEST_F(EglWrapperLayerTest,LoadLayers001,Level1)79 HWTEST_F(EglWrapperLayerTest, LoadLayers001, Level1)
80 {
81     EglWrapperDispatchTable dispatchTable;
82 
83     bool result = EglWrapperLayer::GetInstance().LoadLayers();
84     ASSERT_TRUE(result);
85 }
86 
87 /**
88  * @tc.name: InitBundleInfo001
89  * @tc.desc:
90  * @tc.type: FUNC
91  */
HWTEST_F(EglWrapperLayerTest,InitBundleInfo001,Level1)92 HWTEST_F(EglWrapperLayerTest, InitBundleInfo001, Level1)
93 {
94     EglWrapperDispatchTable dispatchTable;
95 
96     bool result = EglWrapperLayer::GetInstance().InitBundleInfo();
97     ASSERT_FALSE(result);
98 }
99 } // OHOS::Rosen