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

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

Issue 678683003: Make RenderTextHarfBuzz examine full font list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable test on windows Created 6 years, 1 month 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_harfbuzz.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 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 render_text->SetText(kString); 2319 render_text->SetText(kString);
2320 render_text->ApplyStyle(BOLD, true, Range(0, 3)); 2320 render_text->ApplyStyle(BOLD, true, Range(0, 3));
2321 render_text->SetElideBehavior(ELIDE_TAIL); 2321 render_text->SetElideBehavior(ELIDE_TAIL);
2322 2322
2323 render_text->SetDisplayRect(Rect(0, 0, 500, 100)); 2323 render_text->SetDisplayRect(Rect(0, 0, 500, 100));
2324 EXPECT_EQ(kString, render_text->GetLayoutText()); 2324 EXPECT_EQ(kString, render_text->GetLayoutText());
2325 render_text->SetDisplayRect(Rect(0, 0, render_text->GetContentWidth(), 100)); 2325 render_text->SetDisplayRect(Rect(0, 0, render_text->GetContentWidth(), 100));
2326 EXPECT_EQ(kString, render_text->GetLayoutText()); 2326 EXPECT_EQ(kString, render_text->GetLayoutText());
2327 } 2327 }
2328 2328
2329 // TODO(derat): Figure out why this fails on Windows: http://crbug.com/427184
2330 #if !defined(OS_WIN)
2331 // Ensure that RenderText examines all of the fonts in its FontList before
2332 // falling back to other fonts.
2333 TEST_F(RenderTextTest, FontListFallback) {
2334 // Double-check that the requested fonts are present.
2335 FontList font_list("Arial, Symbol, 12px");
2336 const std::vector<Font>& fonts = font_list.GetFonts();
2337 ASSERT_EQ(2u, fonts.size());
2338 ASSERT_EQ("arial",
2339 base::StringToLowerASCII(fonts[0].GetActualFontNameForTesting()));
2340 ASSERT_EQ("symbol",
2341 base::StringToLowerASCII(fonts[1].GetActualFontNameForTesting()));
2342
2343 // "⊕" (CIRCLED PLUS) should be rendered with Symbol rather than falling back
2344 // to some other font that's present on the system.
2345 scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
2346 render_text->SetFontList(font_list);
2347 render_text->SetText(UTF8ToUTF16("\xE2\x8A\x95"));
2348 const std::vector<RenderText::FontSpan> spans =
2349 render_text->GetFontSpansForTesting();
2350 ASSERT_EQ(static_cast<size_t>(1), spans.size());
2351 EXPECT_EQ("Symbol", spans[0].first.GetFontName());
2352 }
2353 #endif // !defined(OS_WIN)
2354
2329 } // namespace gfx 2355 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text_harfbuzz.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698