Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c2f4fc0

Browse files
authored
[Impeller] Fixed GlyphAtlasWithLotsOfdUniqueGlyphSize (#42423)
fixes flutter/flutter#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
1 parent 79bdbb8 commit c2f4fc0

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

impeller/typographer/typographer_unittests.cc

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,20 @@ TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) {
165165
ASSERT_TRUE(context && context->IsValid());
166166
SkFont sk_font;
167167

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

176177
TextFrame frame;
177178
size_t count = 0;
179+
const int size_count = 8;
178180
TextRenderContext::FrameIterator iterator = [&]() -> const TextFrame* {
179-
if (count < 8) {
181+
if (count < size_count) {
180182
count++;
181183
frame = TextFrameFromTextBlob(blob, 0.6 * count);
182184
return &frame;
@@ -188,8 +190,20 @@ TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) {
188190
ASSERT_NE(atlas, nullptr);
189191
ASSERT_NE(atlas->GetTexture(), nullptr);
190192

191-
ASSERT_EQ(atlas->GetTexture()->GetSize().width * 2,
192-
atlas->GetTexture()->GetSize().height);
193+
std::set<uint16_t> unique_glyphs;
194+
std::vector<uint16_t> total_glyphs;
195+
atlas->IterateGlyphs([&](const FontGlyphPair& pair, const Rect& rect) {
196+
unique_glyphs.insert(pair.glyph.index);
197+
total_glyphs.push_back(pair.glyph.index);
198+
return true;
199+
});
200+
201+
EXPECT_EQ(unique_glyphs.size() * size_count, atlas->GetGlyphCount());
202+
EXPECT_EQ(total_glyphs.size(), atlas->GetGlyphCount());
203+
204+
EXPECT_TRUE(atlas->GetGlyphCount() > 0);
205+
EXPECT_TRUE(atlas->GetTexture()->GetSize().width > 0);
206+
EXPECT_TRUE(atlas->GetTexture()->GetSize().height > 0);
193207
}
194208

195209
TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledIfUnchanged) {

testing/run_tests.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,12 +1201,10 @@ def main():
12011201
'impeller_unittests',
12021202
engine_filter,
12031203
# TODO(https://github.com/flutter/flutter/issues/127714): Remove test exemption.
1204-
# TODO(https://github.com/flutter/flutter/issues/127715): Remove test exemption.
12051204
shuffle_flags + [
12061205
'--gtest_filter=-'
12071206
'*/OpenGLES:'
12081207
'Play/TypographerTest.MaybeHasOverlapping/Vulkan:'
1209-
'Play/TypographerTest.GlyphAtlasWithLotsOfdUniqueGlyphSize/Vulkan',
12101208
],
12111209
coverage=args.coverage
12121210
)

0 commit comments

Comments
 (0)