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 #ifndef FOUNDATION_ACE_TEST_UNITTEST_ADAPTER_OHOS_CAPABILITY_CONVERT_TEST_TOOLS_H 17 #define FOUNDATION_ACE_TEST_UNITTEST_ADAPTER_OHOS_CAPABILITY_CONVERT_TEST_TOOLS_H 18 19 #include <cstddef> 20 #include <cstdint> 21 #include <iostream> 22 #include <ostream> 23 #include <string> 24 #include <vector> 25 26 #include "gtest/gtest.h" 27 #include "test/mock/core/common/mock_theme_manager.h" 28 #include "test/mock/core/pipeline/mock_pipeline_context.h" 29 #include "test/mock/core/render/mock_paragraph.h" 30 31 #include "base/geometry/dimension.h" 32 #include "base/geometry/size.h" 33 #include "base/memory/ace_type.h" 34 #include "base/memory/referenced.h" 35 #include "core/components/common/properties/color.h" 36 #include "core/components/common/properties/text_style.h" 37 #include "core/components/text/text_theme.h" 38 #include "html_to_span.h" 39 #include "span_to_html.h" 40 #include "core/components_ng/pattern/text/span/mutable_span_string.h" 41 #include "core/components_ng/pattern/text/span/span_object.h" 42 #include "core/components_ng/pattern/text/span/span_string.h" 43 #include "core/components_ng/pattern/text/span_node.h" 44 #include "core/components_ng/pattern/text/text_pattern.h" 45 #include "core/components_ng/pattern/text/text_styles.h" 46 #include "core/components_ng/property/measure_property.h" 47 48 #undef private 49 #undef protected 50 51 namespace OHOS::Ace::NG { 52 53 class HtmlConvertTestNg : public testing::Test { 54 public: 55 static void SetUpTestSuite(); 56 static void TearDownTestSuite(); 57 void SetUp() override; 58 void TearDown() override; 59 bool IsSpanItemSame(std::list<RefPtr<NG::SpanItem>> src, std::list<RefPtr<NG::SpanItem>> other); 60 SpanParagraphStyle GetDefaultParagraphStyle(); 61 62 ImageSpanOptions GetImageOption(const std::string& src); 63 static ImageSpanOptions GetImageOption( 64 const std::string& src, 65 const Dimension& width, 66 const Dimension& height, 67 ImageFit fit = ImageFit::CONTAIN, 68 VerticalAlign align = VerticalAlign::CENTER, 69 const BorderRadiusProperty& borderRadius = BorderRadiusProperty(), 70 const MarginProperty& margins = MarginProperty(), 71 const PaddingProperty& paddings = PaddingProperty() 72 ); 73 }; 74 }; 75 #endif // FOUNDATION_ACE_TEST_UNITTEST_ADAPTER_OHOS_CAPABILITY_CONVERT_TEST_TOOLS_H