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..2904aa8c25a4a03985ba497fa61da303c2f12564 100644 |
| --- a/ui/gfx/render_text_unittest.cc |
| +++ b/ui/gfx/render_text_unittest.cc |
| @@ -98,6 +98,10 @@ class RenderTextTestApi { |
| return render_text_->lines(); |
| } |
| + void set_lines(std::vector<internal::Line>* lines) { |
| + render_text_->set_lines(lines); |
| + } |
| + |
| SelectionModel EdgeSelectionModel(VisualCursorDirection direction) { |
| return render_text_->EdgeSelectionModel(direction); |
| } |
| @@ -4409,6 +4413,21 @@ TEST_P(RenderTextTest, InvalidFont) { |
| DrawVisualText(); |
| } |
| +TEST_P(RenderTextTest, LinesInvalidationOnElideBehaviorChange) { |
| + RenderText* render_text = GetRenderText(); |
| + EXPECT_EQ(render_text->elide_behavior(), gfx::NO_ELIDE); |
| + |
| + std::vector<internal::Line> lines(1); |
| + test_api()->set_lines(&lines); |
|
msw
2017/04/17 23:51:44
nit: avoid adding RenderTextTestApi::set_lines and
simonhong
2017/04/18 13:33:33
Done.
|
| + |
| + render_text->SetElideBehavior(gfx::NO_ELIDE); |
| + EXPECT_FALSE(test_api()->lines().empty()); |
| + |
| + // lines are cleared when elide behavior changes. |
|
msw
2017/04/17 23:51:44
nit: "Lines"
simonhong
2017/04/18 13:33:33
Done.
|
| + render_text->SetElideBehavior(gfx::ELIDE_TAIL); |
| + 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 |