Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions impeller/typographer/typographer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,20 @@ TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) {
ASSERT_TRUE(context && context->IsValid());
SkFont sk_font;

auto blob = SkTextBlob::MakeFromString(
const char* test_string =
"QWERTYUIOPASDFGHJKLZXCVBNMqewrtyuiopasdfghjklzxcvbnm,.<>[]{};':"
"2134567890-=!@#$%^&*()_+"
"œ∑´®†¥¨ˆøπ““‘‘åß∂ƒ©˙∆˚¬…æ≈ç√∫˜µ≤≥≥≥≥÷¡™£¢∞§¶•ªº–≠⁄€‹›fifl‡°·‚—±Œ„´‰Á¨Ø∏”’/"
"* Í˝ */¸˛Ç◊ı˜Â¯˘¿",
sk_font);
"* Í˝ */¸˛Ç◊ı˜Â¯˘¿";

auto blob = SkTextBlob::MakeFromString(test_string, sk_font);
ASSERT_TRUE(blob);

TextFrame frame;
size_t count = 0;
const int size_count = 8;
TextRenderContext::FrameIterator iterator = [&]() -> const TextFrame* {
if (count < 8) {
if (count < size_count) {
count++;
frame = TextFrameFromTextBlob(blob, 0.6 * count);
return &frame;
Expand All @@ -188,8 +190,20 @@ TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) {
ASSERT_NE(atlas, nullptr);
ASSERT_NE(atlas->GetTexture(), nullptr);

ASSERT_EQ(atlas->GetTexture()->GetSize().width * 2,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The aspect ratio of the texture isn't really consequential. It just matters that there is an atlas that has all the glyphs (and it fits into texture the size the hardware can support).

atlas->GetTexture()->GetSize().height);
std::set<uint16_t> unique_glyphs;
std::vector<uint16_t> total_glyphs;
atlas->IterateGlyphs([&](const FontGlyphPair& pair, const Rect& rect) {
unique_glyphs.insert(pair.glyph.index);
total_glyphs.push_back(pair.glyph.index);
return true;
});

EXPECT_EQ(unique_glyphs.size() * size_count, atlas->GetGlyphCount());
EXPECT_EQ(total_glyphs.size(), atlas->GetGlyphCount());

EXPECT_TRUE(atlas->GetGlyphCount() > 0);
EXPECT_TRUE(atlas->GetTexture()->GetSize().width > 0);
EXPECT_TRUE(atlas->GetTexture()->GetSize().height > 0);
}

TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledIfUnchanged) {
Expand Down
2 changes: 0 additions & 2 deletions testing/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,12 +1201,10 @@ def main():
'impeller_unittests',
engine_filter,
# TODO(https://github.com/flutter/flutter/issues/127714): Remove test exemption.
# TODO(https://github.com/flutter/flutter/issues/127715): Remove test exemption.
shuffle_flags + [
'--gtest_filter=-'
'*/OpenGLES:'
'Play/TypographerTest.MaybeHasOverlapping/Vulkan:'
'Play/TypographerTest.GlyphAtlasWithLotsOfdUniqueGlyphSize/Vulkan',
],
coverage=args.coverage
)
Expand Down