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

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

Issue 868753005: Enable Roboto by default for testing purpose. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify the test TextDoesntClip. Created 5 years, 10 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/base/ui_base_switches.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 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 render_text->Draw(canvas.get()); 2416 render_text->Draw(canvas.get());
2417 int width = render_text->GetStringSize().width(); 2417 int width = render_text->GetStringSize().width();
2418 ASSERT_LT(width + kTestWidth, kCanvasSize.width()); 2418 ASSERT_LT(width + kTestWidth, kCanvasSize.width());
2419 const uint32* buffer = static_cast<const uint32*>( 2419 const uint32* buffer = static_cast<const uint32*>(
2420 surface->peekPixels(NULL, NULL)); 2420 surface->peekPixels(NULL, NULL));
2421 ASSERT_NE(nullptr, buffer); 2421 ASSERT_NE(nullptr, buffer);
2422 2422
2423 for (int y = 0; y < kCanvasSize.height(); ++y) { 2423 for (int y = 0; y < kCanvasSize.height(); ++y) {
2424 // Allow one column of anti-aliased pixels past the expected width. 2424 // Allow one column of anti-aliased pixels past the expected width.
2425 SkColor color = buffer[width + y * kCanvasSize.width()]; 2425 SkColor color = buffer[width + y * kCanvasSize.width()];
2426 EXPECT_LT(230U, color_utils::GetLuminanceForColor(color)) << string; 2426 EXPECT_LT(220U, color_utils::GetLuminanceForColor(color)) << string;
2427 for (int x = 1; x < kTestWidth; ++x) { 2427 for (int x = 1; x < kTestWidth; ++x) {
2428 color = buffer[width + x + y * kCanvasSize.width()]; 2428 color = buffer[width + x + y * kCanvasSize.width()];
2429 EXPECT_EQ(SK_ColorWHITE, color) << string; 2429 EXPECT_EQ(SK_ColorWHITE, color) << string;
2430 } 2430 }
2431 } 2431 }
2432 } 2432 }
2433 } 2433 }
2434 2434
2435 // This test validates that the RenderText centering baseline is greater than 2435 // This test validates that the RenderText centering baseline is greater than
2436 // the font list baseline for a valid display rect. 2436 // the font list baseline for a valid display rect.
(...skipping 22 matching lines...) Expand all
2459 base::StringToLowerASCII(fonts[0].GetActualFontNameForTesting())); 2459 base::StringToLowerASCII(fonts[0].GetActualFontNameForTesting()));
2460 2460
2461 scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); 2461 scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
2462 render_text->SetDisplayRect(Rect(0, 0, 25, 25)); 2462 render_text->SetDisplayRect(Rect(0, 0, 25, 25));
2463 render_text->SetFontList(font_list); 2463 render_text->SetFontList(font_list);
2464 EXPECT_GT(render_text->GetBaseline(), font_list.GetBaseline()); 2464 EXPECT_GT(render_text->GetBaseline(), font_list.GetBaseline());
2465 } 2465 }
2466 #endif 2466 #endif
2467 2467
2468 } // namespace gfx 2468 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/base/ui_base_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698