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_TEXT_STYLE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TEXT_STYLE_H 18 19 #include <string> 20 #include <vector> 21 22 #include "testing_color.h" 23 #include "testing_pen.h" 24 #include "testing_point.h" 25 26 namespace OHOS::Ace::Testing { 27 enum class TestingFontWeight { 28 W100, // thin 29 W200, 30 W300, 31 W400, 32 W500, 33 W600, 34 W700, 35 W800, 36 W900, 37 }; 38 39 enum class TestingTextDecoration { 40 NONE = 0x0, 41 UNDERLINE = 0x1, 42 OVERLINE = 0x2, 43 LINE_THROUGH = 0x4, 44 }; 45 46 enum class TestingTextDecorationStyle { 47 SOLID, 48 DOUBLE, 49 DOTTED, 50 DASHED, 51 WAVY, 52 }; 53 54 enum class TestingFontStyle { 55 NORMAL, 56 ITALIC, 57 }; 58 59 enum class TestingTextBaseline { 60 ALPHABETIC, 61 IDEOGRAPHIC, 62 }; 63 64 class TestingTextShadow { 65 public: 66 TestingTextShadow() = default; 67 virtual ~TestingTextShadow() = default; 68 hasShadow()69 virtual bool hasShadow() const 70 { 71 return false; 72 } 73 74 TestingColor color; 75 TestingPoint offset; 76 double blurRadius = 0.0; 77 }; 78 79 class TestingFontFeatures { 80 public: 81 TestingFontFeatures() = default; 82 virtual ~TestingFontFeatures() = default; 83 }; 84 85 class TestingTextStyle { 86 public: 87 TestingTextStyle() = default; 88 ~TestingTextStyle() = default; 89 equals(const TestingTextStyle &)90 virtual bool equals(const TestingTextStyle& /* rhs */) const 91 { 92 return false; 93 } 94 95 double decorationThicknessMultiplier = 1.0; 96 double fontSize = 14.0; 97 double letterSpacing = 0.0; 98 double wordSpacing = 0.0; 99 double heightScale = 1.0; 100 bool heightOnly = false; 101 bool hasBackground = false; 102 bool hasForeground = false; 103 std::u16string ellipsis; 104 std::string locale; 105 std::vector<std::string> fontFamilies; 106 TestingColor color; 107 TestingTextDecoration decoration = TestingTextDecoration::NONE; 108 TestingColor decorationColor; 109 TestingPen background; 110 TestingPen foreground; 111 TestingTextDecorationStyle decorationStyle = TestingTextDecorationStyle::SOLID; 112 TestingFontWeight fontWeight = TestingFontWeight::W400; 113 TestingFontStyle fontStyle = TestingFontStyle::NORMAL; 114 TestingTextBaseline baseline = TestingTextBaseline::ALPHABETIC; 115 std::vector<TestingTextShadow> textShadows; 116 TestingFontFeatures fontFeatures; 117 }; 118 } // namespace OHOS::Ace::Testing 119 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TEXT_STYLE_H 120