[Impeller] Fixed GlyphAtlasWithLotsOfdUniqueGlyphSize (flutter/engine#42423)

fixes https://github.com/flutter/flutter/issues/127715

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
This commit is contained in:
gaaclarke
2023-05-30 13:13:36 -07:00
committed by GitHub
parent 38da048728
commit 25154333d5
2 changed files with 20 additions and 8 deletions

View File

@@ -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;
@@ -188,8 +190,20 @@ TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) {
ASSERT_NE(atlas, nullptr);
ASSERT_NE(atlas->GetTexture(), nullptr);
ASSERT_EQ(atlas->GetTexture()->GetSize().width * 2,
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) {

View File

@@ -1201,12 +1201,10 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
'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
)