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

Side by Side Diff: ui/gfx/render_text_unittest.cc

Issue 965393003: alternative tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150303-RenderText-Goo
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/render_text_mac.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/render_text.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
(...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 2616
2617 #if defined(OS_MACOSX) 2617 #if defined(OS_MACOSX)
2618 TEST_F(RenderTextTest, Mac_ElidedText) { 2618 TEST_F(RenderTextTest, Mac_ElidedText) {
2619 RenderTextMac render_text; 2619 RenderTextMac render_text;
2620 base::string16 text(ASCIIToUTF16("This is an example.")); 2620 base::string16 text(ASCIIToUTF16("This is an example."));
2621 render_text.SetText(text); 2621 render_text.SetText(text);
2622 render_text.EnsureLayout(); 2622 render_text.EnsureLayout();
2623 // NOTE: Character and glyph counts are only comparable for simple text. 2623 // NOTE: Character and glyph counts are only comparable for simple text.
2624 EXPECT_EQ(text.size(), 2624 EXPECT_EQ(text.size(),
2625 static_cast<size_t>(CTLineGetGlyphCount(render_text.line_))); 2625 static_cast<size_t>(CTLineGetGlyphCount(render_text.line_)));
2626 EXPECT_NE(0u, render_text.GetDisplayText().size());
2626 2627
2628 DLOG(INFO) << " -- set elide";
2627 render_text.SetElideBehavior(ELIDE_TAIL); 2629 render_text.SetElideBehavior(ELIDE_TAIL);
2630 DLOG(INFO) << " -- get string size";
2628 gfx::Size string_size = render_text.GetStringSize(); 2631 gfx::Size string_size = render_text.GetStringSize();
2629 string_size.set_width(string_size.width() / 2); 2632 string_size.set_width(string_size.width() / 2);
2633
2634 DLOG(INFO) << " -- set display_rect";
2630 render_text.SetDisplayRect(gfx::Rect(string_size)); 2635 render_text.SetDisplayRect(gfx::Rect(string_size));
2636 DLOG(INFO) << " -- set";
2631 render_text.EnsureLayout(); 2637 render_text.EnsureLayout();
2632 EXPECT_GT(text.size(), 2638 EXPECT_GT(text.size(),
2633 static_cast<size_t>(CTLineGetGlyphCount(render_text.line_))); 2639 static_cast<size_t>(CTLineGetGlyphCount(render_text.line_)));
2640 EXPECT_NE(0u, render_text.GetDisplayText().size());
2634 } 2641 }
2635 #endif 2642 #endif
2636 2643
2637 } // namespace gfx 2644 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698