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

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

Issue 2105123002: various: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 | « storage/browser/quota/usage_tracker.cc ('k') | ui/message_center/message_center_impl.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 <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 const Size kCanvasSize(300, 50); 3186 const Size kCanvasSize(300, 50);
3187 const int kTestSize = 10; 3187 const int kTestSize = 10;
3188 3188
3189 sk_sp<SkSurface> surface = 3189 sk_sp<SkSurface> surface =
3190 SkSurface::MakeRasterN32Premul(kCanvasSize.width(), kCanvasSize.height()); 3190 SkSurface::MakeRasterN32Premul(kCanvasSize.width(), kCanvasSize.height());
3191 Canvas canvas(sk_ref_sp(surface->getCanvas()), 1.0f); 3191 Canvas canvas(sk_ref_sp(surface->getCanvas()), 1.0f);
3192 std::unique_ptr<RenderText> render_text(RenderText::CreateInstance()); 3192 std::unique_ptr<RenderText> render_text(RenderText::CreateInstance());
3193 render_text->SetHorizontalAlignment(ALIGN_LEFT); 3193 render_text->SetHorizontalAlignment(ALIGN_LEFT);
3194 render_text->SetColor(SK_ColorBLACK); 3194 render_text->SetColor(SK_ColorBLACK);
3195 3195
3196 for (auto string : kTestStrings) { 3196 for (auto* string : kTestStrings) {
3197 surface->getCanvas()->clear(SK_ColorWHITE); 3197 surface->getCanvas()->clear(SK_ColorWHITE);
3198 render_text->SetText(WideToUTF16(string)); 3198 render_text->SetText(WideToUTF16(string));
3199 const Size string_size = render_text->GetStringSize(); 3199 const Size string_size = render_text->GetStringSize();
3200 render_text->ApplyBaselineStyle(SUPERSCRIPT, Range(1, 2)); 3200 render_text->ApplyBaselineStyle(SUPERSCRIPT, Range(1, 2));
3201 render_text->ApplyBaselineStyle(SUPERIOR, Range(3, 4)); 3201 render_text->ApplyBaselineStyle(SUPERIOR, Range(3, 4));
3202 render_text->ApplyBaselineStyle(INFERIOR, Range(5, 6)); 3202 render_text->ApplyBaselineStyle(INFERIOR, Range(5, 6));
3203 render_text->ApplyBaselineStyle(SUBSCRIPT, Range(7, 8)); 3203 render_text->ApplyBaselineStyle(SUBSCRIPT, Range(7, 8));
3204 render_text->SetWeight(Font::Weight::BOLD); 3204 render_text->SetWeight(Font::Weight::BOLD);
3205 render_text->SetDisplayRect( 3205 render_text->SetDisplayRect(
3206 Rect(kTestSize, kTestSize, string_size.width(), string_size.height())); 3206 Rect(kTestSize, kTestSize, string_size.width(), string_size.height()));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3278 const Size kCanvasSize(300, 50); 3278 const Size kCanvasSize(300, 50);
3279 const int kTestSize = 10; 3279 const int kTestSize = 10;
3280 3280
3281 sk_sp<SkSurface> surface = 3281 sk_sp<SkSurface> surface =
3282 SkSurface::MakeRasterN32Premul(kCanvasSize.width(), kCanvasSize.height()); 3282 SkSurface::MakeRasterN32Premul(kCanvasSize.width(), kCanvasSize.height());
3283 Canvas canvas(sk_ref_sp(surface->getCanvas()), 1.0f); 3283 Canvas canvas(sk_ref_sp(surface->getCanvas()), 1.0f);
3284 std::unique_ptr<RenderText> render_text(RenderText::CreateInstance()); 3284 std::unique_ptr<RenderText> render_text(RenderText::CreateInstance());
3285 render_text->SetHorizontalAlignment(ALIGN_LEFT); 3285 render_text->SetHorizontalAlignment(ALIGN_LEFT);
3286 render_text->SetColor(SK_ColorBLACK); 3286 render_text->SetColor(SK_ColorBLACK);
3287 3287
3288 for (auto string : kTestStrings) { 3288 for (auto* string : kTestStrings) {
3289 surface->getCanvas()->clear(SK_ColorWHITE); 3289 surface->getCanvas()->clear(SK_ColorWHITE);
3290 render_text->SetText(WideToUTF16(string)); 3290 render_text->SetText(WideToUTF16(string));
3291 const Size string_size = render_text->GetStringSize(); 3291 const Size string_size = render_text->GetStringSize();
3292 int fake_width = string_size.width() / 2; 3292 int fake_width = string_size.width() / 2;
3293 int fake_height = string_size.height() / 2; 3293 int fake_height = string_size.height() / 2;
3294 render_text->SetDisplayRect( 3294 render_text->SetDisplayRect(
3295 Rect(kTestSize, kTestSize, fake_width, fake_height)); 3295 Rect(kTestSize, kTestSize, fake_width, fake_height));
3296 render_text->set_clip_to_display_rect(true); 3296 render_text->set_clip_to_display_rect(true);
3297 render_text->Draw(&canvas); 3297 render_text->Draw(&canvas);
3298 ASSERT_LT(string_size.width() + kTestSize, kCanvasSize.width()); 3298 ASSERT_LT(string_size.width() + kTestSize, kCanvasSize.width());
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 EXPECT_FALSE(backend.paint().isLCDRenderText()); 3431 EXPECT_FALSE(backend.paint().isLCDRenderText());
3432 backend.GetHarfbuzzRunList()->runs()[0]->render_params.subpixel_rendering = 3432 backend.GetHarfbuzzRunList()->runs()[0]->render_params.subpixel_rendering =
3433 FontRenderParams::SUBPIXEL_RENDERING_RGB; 3433 FontRenderParams::SUBPIXEL_RENDERING_RGB;
3434 backend.DrawVisualText(); 3434 backend.DrawVisualText();
3435 #endif 3435 #endif
3436 EXPECT_FALSE(backend.paint().isLCDRenderText()); 3436 EXPECT_FALSE(backend.paint().isLCDRenderText());
3437 } 3437 }
3438 } 3438 }
3439 3439
3440 } // namespace gfx 3440 } // namespace gfx
OLDNEW
« no previous file with comments | « storage/browser/quota/usage_tracker.cc ('k') | ui/message_center/message_center_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698