1 /* 2 * Copyright (c) 2023 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 "text_style.h" 17 18 #include <gtest/gtest.h> 19 #include <unicode/ubidi.h> 20 21 using namespace testing; 22 using namespace testing::ext; 23 24 namespace OHOS { 25 namespace Rosen { 26 namespace TextEngine { 27 class FontFeaturesTest : public testing::Test { 28 }; 29 30 /** 31 * @tc.name: SetFeature 32 * @tc.desc: Verify the FontFeatures 33 * @tc.type:FUNC 34 * @tc.require: 35 */ 36 HWTEST_F(FontFeaturesTest, SetFeature, TestSize.Level1) 37 { 38 std::shared_ptr<FontFeatures> fontFeatures = std::make_shared<FontFeatures>(); 39 std::string ftag = "num"; 40 int fvalue = 1; 41 EXPECT_NO_THROW({ 42 fontFeatures->SetFeature(ftag, fvalue); 43 }); 44 } 45 46 /** 47 * @tc.name: GetFeatures 48 * @tc.desc: Verify the FontFeatures 49 * @tc.type:FUNC 50 * @tc.require: 51 */ 52 HWTEST_F(FontFeaturesTest, GetFeatures, TestSize.Level1) 53 { 54 std::shared_ptr<FontFeatures> fontFeatures = std::make_shared<FontFeatures>(); 55 std::string ftag = "num"; 56 int fvalue = 1; 57 58 EXPECT_NO_THROW({ 59 fontFeatures->SetFeature(ftag, fvalue); 60 }); 61 62 auto features = fontFeatures->GetFeatures(); 63 ASSERT_EQ(features[ftag], fvalue); 64 } 65 } // namespace TextEngine 66 } // namespace Rosen 67 } // namespace OHOS 68