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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TYPOGRAPHY_CREATE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TYPOGRAPHY_CREATE_H 18 19 #include <memory> 20 #include <vector> 21 22 #include "testing_font_collection.h" 23 #include "testing_typography.h" 24 #include "testing_typography_properties.h" 25 #include "testing_typography_style.h" 26 27 namespace OHOS::Ace::Testing { 28 class TestingTypographyCreate { 29 public: 30 TestingTypographyCreate() = default; 31 virtual ~TestingTypographyCreate() = default; 32 CreateRosenBuilder(const TestingTypographyStyle & style,std::shared_ptr<TestingFontCollection> font_collection)33 static std::unique_ptr<TestingTypographyCreate> CreateRosenBuilder( 34 const TestingTypographyStyle& style, std::shared_ptr<TestingFontCollection> font_collection) 35 { 36 return std::make_unique<TestingTypographyCreate>(); 37 } 38 39 #ifdef USE_GRAPHIC_TEXT_GINE Create(const TestingTypographyStyle & style,std::shared_ptr<TestingFontCollection> collection)40 static std::unique_ptr<TestingTypographyCreate> Create( 41 const TestingTypographyStyle &style, std::shared_ptr<TestingFontCollection> collection) 42 { 43 return std::make_unique<TestingTypographyCreate>(); 44 } 45 CreateTypography()46 std::unique_ptr<TestingTypography> CreateTypography() 47 { 48 return std::make_unique<TestingTypography>(); 49 } 50 #endif 51 PushStyle(const TestingTextStyle & style)52 virtual void PushStyle(const TestingTextStyle& style) {} 53 54 #ifndef USE_GRAPHIC_TEXT_GINE Pop()55 virtual void Pop() {} 56 AddText(const std::u16string & text)57 virtual void AddText(const std::u16string& text) {} 58 #else PopStyle()59 virtual void PopStyle() {} 60 AppendText(const std::u16string & text)61 virtual void AppendText(const std::u16string& text) {} 62 #endif 63 Build()64 virtual std::unique_ptr<TestingTypography> Build() 65 { 66 return std::make_unique<TestingTypography>(); 67 } 68 }; 69 } // namespace OHOS::Ace::Testing 70 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TYPOGRAPHY_CREATE_H 71