Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Unified Diff: ui/gfx/render_text_unittest.cc

Issue 2817403002: [Omnibox] Elide omnibox text (Closed)
Patch Set: Reposition elide changing code Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/gfx/render_text.cc ('K') | « ui/gfx/render_text.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+
+ render_text->SetElideBehavior(gfx::NO_ELIDE);
+ EXPECT_FALSE(test_api()->lines().empty());
+
+ // lines are cleared when elide behavior changes.
+ 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
« ui/gfx/render_text.cc ('K') | « ui/gfx/render_text.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698