• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 <optional>
17 
18 #include "gtest/gtest.h"
19 #define private public
20 #define protected public
21 
22 #include "test/mock/core/common/mock_container.h"
23 #include "test/mock/core/pipeline/mock_pipeline_context.h"
24 
25 #include "frameworks/core/components/theme/theme_manager_impl.h"
26 #include "core/components/button/button_theme.h"
27 
28 using namespace testing;
29 using namespace testing::ext;
30 namespace OHOS::Ace::NG {
31 
32 class ThemeManagerTestNg : public testing::Test {
33 public:
34     static void SetUpTestCase();
35     static void TearDownTestCase();
36 };
37 
SetUpTestCase()38 void ThemeManagerTestNg::SetUpTestCase()
39 {
40     MockPipelineContext::SetUp();
41     MockContainer::SetUp();
42 }
43 
TearDownTestCase()44 void ThemeManagerTestNg::TearDownTestCase()
45 {
46     MockPipelineContext::TearDown();
47     MockContainer::TearDown();
48 }
49 
50 /**
51  * @tc.name: ThemeMangerTestNg001
52  * @tc.desc: GetThemeOrigin
53  * @tc.type: FUNC
54  */
55 HWTEST_F(ThemeManagerTestNg, ThemeManagerTestNg001, TestSize.Level1)
56 {
57     /**
58      * @tc.steps: create themeManager
59      */
60     auto themeManager = AceType::MakeRefPtr<ThemeManagerImpl>();
61     auto theme = themeManager->GetThemeOrigin(ButtonTheme::TypeId());
62     EXPECT_TRUE(AceType::InstanceOf<ButtonTheme>(theme));
63 }
64 }
65