Chromium Code Reviews| Index: ui/gfx/render_text_unittest.cc |
| diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc |
| index d262f5f5d790806a4c9ef9fd07d905702f08f243..8b859b2e63c571f6c087458db3646312b769b7a8 100644 |
| --- a/ui/gfx/render_text_unittest.cc |
| +++ b/ui/gfx/render_text_unittest.cc |
| @@ -534,6 +534,8 @@ class RenderTextHarfBuzzTest : public RenderTextTest { |
| return GetRenderText()->GetLineOffset(line_num).y() + 1; |
| } |
| + void EnsureLayoutRunList() { GetRenderTextHarfBuzz()->EnsureLayoutRunList(); } |
|
msw
2017/04/18 17:23:44
nit: remove this, just call |test_api()->EnsureLay
simonhong
2017/04/18 19:56:02
For emptiness test, this is added. When EnsureLayo
msw
2017/04/18 20:13:02
Oh, hmm... I suppose this is okay, but it would al
|
| + |
| private: |
| DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzzTest); |
| }; |
| @@ -3963,6 +3965,17 @@ TEST_P(RenderTextMacTest, Mac_ElidedText) { |
| EXPECT_GT(text.size(), static_cast<size_t>(glyph_count)); |
| EXPECT_NE(0, glyph_count); |
| } |
| + |
| +TEST_P(RenderTextMacTest, LinesInvalidationOnElideBehaviorChange) { |
| + RenderTextMac* render_text = GetRenderTextMac(); |
| + render_text->SetText(ASCIIToUTF16("This is an example")); |
| + test_api()->EnsureLayout(); |
| + EXPECT_TRUE(GetCoreTextLine()); |
| + |
| + // Lines are cleared when elide behavior changes. |
| + render_text->SetElideBehavior(gfx::ELIDE_TAIL); |
| + EXPECT_FALSE(GetCoreTextLine()); |
| +} |
| #endif // defined(OS_MACOSX) |
| // Ensure color changes are picked up by the RenderText implementation. |
| @@ -4409,6 +4422,18 @@ TEST_P(RenderTextTest, InvalidFont) { |
| DrawVisualText(); |
| } |
| +TEST_P(RenderTextHarfBuzzTest, LinesInvalidationOnElideBehaviorChange) { |
| + RenderTextHarfBuzz* render_text = GetRenderTextHarfBuzz(); |
| + render_text->SetText(ASCIIToUTF16("This is an example")); |
| + test_api()->EnsureLayout(); |
| + EXPECT_FALSE(test_api()->lines().empty()); |
| + |
| + // Lines are cleared when elide behavior changes. |
| + render_text->SetElideBehavior(gfx::ELIDE_TAIL); |
| + EnsureLayoutRunList(); |
| + EXPECT_TRUE(test_api()->lines().empty()); |
| +} |
| + |
| // Ensures that text is centered vertically and consistently when either the |
| // display rectangle height changes, or when the minimum line height changes. |
| // The difference between the two is the selection rectangle, which should match |