tdd coverage

Signed-off-by: liumingxiang <liumingxiang1@huawei.com>
Change-Id: I22c1e10645356aabd51d118210aa31b1300a9493
This commit is contained in:
liumingxiang 2024-11-04 17:34:51 +08:00
parent 40295b3354
commit 7140e924d9
3 changed files with 15 additions and 1 deletions

View File

@ -110,6 +110,7 @@ HWTEST_F(ParagraphTest, ParagraphTest001, TestSize.Level1)
EXPECT_EQ(paragraph_->GetGlyphPositionAtCoordinate(0.0, 0.0).position, 0.0);
EXPECT_EQ(paragraph_->GetWordBoundary(0).start, 0);
EXPECT_EQ(paragraph_->GetActualTextRange(0, false).start, 0);
EXPECT_EQ(paragraph_->GetActualTextRange(-1, false).start, 0);
EXPECT_EQ(paragraph_->GetLineMetrics().size(), 1);
EXPECT_EQ(static_cast<int>(paragraph_->GetLongestLineWithIndent()), 44);
}
@ -262,6 +263,8 @@ HWTEST_F(ParagraphTest, ParagraphTest011, TestSize.Level1)
HWTEST_F(ParagraphTest, ParagraphTest012, TestSize.Level1)
{
skt::TextStyle skStyle;
skStyle.setBackgroundPaintID(-1);
skStyle.addShadow(skia::textlayout::TextShadow());
skStyle.setColor(0xFF0000FF); // used for testing. Set the color to blue.
skStyle.setDecorationColor(0xFF000000); // used for testing. Set the color to black.
skStyle.setDecorationThicknessMultiplier(2.0f);

View File

@ -51,6 +51,8 @@ HWTEST_F(TypefaceFontAssetProviderTest, TypefaceFontAssetProviderTest001, TestSi
sk_sp<SkTypeface> skTypeface = SkTypeface::MakeDefault();
ASSERT_NE(skTypeface, nullptr);
typefaceFontAssetProvider_->RegisterTypeface(skTypeface);
typefaceFontAssetProvider_->RegisterTypeface(nullptr);
typefaceFontAssetProvider_->RegisterTypeface(nullptr, "");
EXPECT_EQ(typefaceFontAssetProvider_->GetFamilyCount(), 1);
std::string result = { 0x48, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x4f, 0x53, 0x2d, 0x53, 0x61, 0x6e, 0x73 };
EXPECT_EQ(typefaceFontAssetProvider_->GetFamilyName(0), result);
@ -76,6 +78,7 @@ HWTEST_F(TypefaceFontAssetProviderTest, TypefaceFontAssetProviderTest004, TestSi
EXPECT_EQ(typefaceFontStyleSet->count(), 1);
SkFontStyle style;
SkString name;
typefaceFontStyleSet->getStyle(INT_MAX, &style, &name);
typefaceFontStyleSet->getStyle(0, &style, &name);
EXPECT_TRUE(name.isEmpty());
SkFontStyle pattern;

View File

@ -160,7 +160,15 @@ HWTEST_F(FontParserTest, CmapTableParserTest1, TestSize.Level1)
{
MockCmapTableParser mockCmapTableParser;
CmapTableParser cmapTableParser_default;
CmapTableParser cmapTableParser("test data", 9);
char* data = new char[sizeof(CmapTables) + sizeof(EncodingRecord)];
CmapTables* p = reinterpret_cast<CmapTables*>(data);
p->version = { 0 };
p->numTables = { 1 };
p->encodingRecords[0].platformID = { 0 };
p->encodingRecords[0].encodingID = { 0 };
p->encodingRecords[0].subtableOffset = { 0 };
CmapTableParser cmapTableParser(data, sizeof(CmapTables) + sizeof(EncodingRecord));
cmapTableParser.Dump();
struct NameRecord nameRecord;
struct NameTable nameTable;
nameRecord.encodingId = nameTable.count;