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

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

Issue 960203004: tracing for RenderTextMac::GetDisplayText() eliding goo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150129-MacViews-Bringup5-RTHB-in-Label
Patch Set: fix upstream 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') | ui/views/controls/label.cc » ('j') | 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 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 EXPECT_EQ(SK_ColorWHITE, color) << string; 2611 EXPECT_EQ(SK_ColorWHITE, color) << string;
2612 } 2612 }
2613 } 2613 }
2614 } 2614 }
2615 } 2615 }
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.SetDisplayRect(gfx::Rect(0, 0, 200, 10));
2621 render_text.SetText(text); 2622 render_text.SetText(text);
2622 render_text.EnsureLayout(); 2623 render_text.EnsureLayout();
2623 // NOTE: Character and glyph counts are only comparable for simple text. 2624 // NOTE: Character and glyph counts are only comparable for simple text.
2624 EXPECT_EQ(text.size(), 2625 EXPECT_EQ(text.size(),
2625 static_cast<size_t>(CTLineGetGlyphCount(render_text.line_))); 2626 static_cast<size_t>(CTLineGetGlyphCount(render_text.line_)));
2626 2627
2627 render_text.SetElideBehavior(ELIDE_TAIL); 2628 render_text.SetElideBehavior(ELIDE_TAIL);
2628 gfx::Size string_size = render_text.GetStringSize(); 2629 gfx::Size string_size = render_text.GetStringSize();
2630 DLOG(INFO) << string_size.ToString();
2629 string_size.set_width(string_size.width() / 2); 2631 string_size.set_width(string_size.width() / 2);
2630 render_text.SetDisplayRect(gfx::Rect(string_size)); 2632 render_text.SetDisplayRect(gfx::Rect(string_size));
2633 DLOG(INFO) << gfx::Rect(string_size).ToString();
2631 render_text.EnsureLayout(); 2634 render_text.EnsureLayout();
2632 EXPECT_GT(text.size(), 2635 EXPECT_GT(text.size(),
2633 static_cast<size_t>(CTLineGetGlyphCount(render_text.line_))); 2636 static_cast<size_t>(CTLineGetGlyphCount(render_text.line_)));
2634 } 2637 }
2635 #endif 2638 #endif
2636 2639
2637 } // namespace gfx 2640 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text_mac.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698