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

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

Issue 2959913002: PlatformFontMac: Use a default NSFont when an invalid font is passed. (Closed)
Patch Set: Use a default font Created 3 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
« ui/gfx/font_fallback_mac.mm ('K') | « ui/gfx/platform_font_mac.mm ('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 <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 4514 matching lines...) Expand 10 before | Expand all | Expand 10 after
4525 } 4525 }
4526 4526
4527 // Test complete bounds. 4527 // Test complete bounds.
4528 render_text->SelectAll(false); 4528 render_text->SelectAll(false);
4529 EXPECT_EQ(expected_total_bounds, GetSelectionBoundsUnion()); 4529 EXPECT_EQ(expected_total_bounds, GetSelectionBoundsUnion());
4530 } 4530 }
4531 4531
4532 // Tests that RenderText doesn't crash even if it's passed an invalid font. Test 4532 // Tests that RenderText doesn't crash even if it's passed an invalid font. Test
4533 // for crbug.com/668058. 4533 // for crbug.com/668058.
4534 TEST_P(RenderTextTest, InvalidFont) { 4534 TEST_P(RenderTextTest, InvalidFont) {
4535 // TODO(crbug.com/699820): This crashes with RenderTextHarfBuzz on Mac.
4536 #if defined(OS_MACOSX)
4537 if (GetParam() == RENDER_TEXT_HARFBUZZ)
4538 return;
4539 #endif
4540 const std::string font_name = "invalid_font"; 4535 const std::string font_name = "invalid_font";
4541 const int kFontSize = 13; 4536 const int kFontSize = 13;
4542 RenderText* render_text = GetRenderText(); 4537 RenderText* render_text = GetRenderText();
4543 render_text->SetFontList(FontList(Font(font_name, kFontSize))); 4538 render_text->SetFontList(FontList(Font(font_name, kFontSize)));
4544 render_text->SetText(ASCIIToUTF16("abc")); 4539 render_text->SetText(ASCIIToUTF16("abc"));
4545 4540
4546 DrawVisualText(); 4541 DrawVisualText();
4547 } 4542 }
4548 4543
4549 TEST_P(RenderTextHarfBuzzTest, LinesInvalidationOnElideBehaviorChange) { 4544 TEST_P(RenderTextHarfBuzzTest, LinesInvalidationOnElideBehaviorChange) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4670 ::testing::Values(RENDER_TEXT_HARFBUZZ), 4665 ::testing::Values(RENDER_TEXT_HARFBUZZ),
4671 PrintRenderTextBackend()); 4666 PrintRenderTextBackend());
4672 #endif 4667 #endif
4673 4668
4674 INSTANTIATE_TEST_CASE_P(, 4669 INSTANTIATE_TEST_CASE_P(,
4675 RenderTextHarfBuzzTest, 4670 RenderTextHarfBuzzTest,
4676 ::testing::Values(RENDER_TEXT_HARFBUZZ), 4671 ::testing::Values(RENDER_TEXT_HARFBUZZ),
4677 PrintRenderTextBackend()); 4672 PrintRenderTextBackend());
4678 4673
4679 } // namespace gfx 4674 } // namespace gfx
OLDNEW
« ui/gfx/font_fallback_mac.mm ('K') | « ui/gfx/platform_font_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698