OLD | NEW |
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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 render_text->SetText(UTF8ToUTF16(" ")); | 1338 render_text->SetText(UTF8ToUTF16(" ")); |
1339 EXPECT_EQ(font_list.GetHeight(), render_text->GetStringSize().height()); | 1339 EXPECT_EQ(font_list.GetHeight(), render_text->GetStringSize().height()); |
1340 EXPECT_EQ(font_list.GetBaseline(), render_text->GetBaseline()); | 1340 EXPECT_EQ(font_list.GetBaseline(), render_text->GetBaseline()); |
1341 } | 1341 } |
1342 #endif // !defined(OS_MACOSX) | 1342 #endif // !defined(OS_MACOSX) |
1343 | 1343 |
1344 TEST_F(RenderTextTest, StringSizeRespectsFontListMetrics) { | 1344 TEST_F(RenderTextTest, StringSizeRespectsFontListMetrics) { |
1345 // Check that Arial and Symbol have different font metrics. | 1345 // Check that Arial and Symbol have different font metrics. |
1346 Font arial_font("Arial", 16); | 1346 Font arial_font("Arial", 16); |
1347 ASSERT_EQ("arial", | 1347 ASSERT_EQ("arial", |
1348 StringToLowerASCII(arial_font.GetActualFontNameForTesting())); | 1348 base::StringToLowerASCII(arial_font.GetActualFontNameForTesting())); |
1349 Font symbol_font("Symbol", 16); | 1349 Font symbol_font("Symbol", 16); |
1350 ASSERT_EQ("symbol", | 1350 ASSERT_EQ("symbol", |
1351 StringToLowerASCII(symbol_font.GetActualFontNameForTesting())); | 1351 base::StringToLowerASCII( |
| 1352 symbol_font.GetActualFontNameForTesting())); |
1352 EXPECT_NE(arial_font.GetHeight(), symbol_font.GetHeight()); | 1353 EXPECT_NE(arial_font.GetHeight(), symbol_font.GetHeight()); |
1353 EXPECT_NE(arial_font.GetBaseline(), symbol_font.GetBaseline()); | 1354 EXPECT_NE(arial_font.GetBaseline(), symbol_font.GetBaseline()); |
1354 // "a" should be rendered with Arial, not with Symbol. | 1355 // "a" should be rendered with Arial, not with Symbol. |
1355 const char* arial_font_text = "a"; | 1356 const char* arial_font_text = "a"; |
1356 // "®" (registered trademark symbol) should be rendered with Symbol, | 1357 // "®" (registered trademark symbol) should be rendered with Symbol, |
1357 // not with Arial. | 1358 // not with Arial. |
1358 const char* symbol_font_text = "\xC2\xAE"; | 1359 const char* symbol_font_text = "\xC2\xAE"; |
1359 | 1360 |
1360 Font smaller_font = arial_font; | 1361 Font smaller_font = arial_font; |
1361 Font larger_font = symbol_font; | 1362 Font larger_font = symbol_font; |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 EXPECT_EQ(Range(0, 0), run.CharRangeToGlyphRange(Range(4, 5))); | 2286 EXPECT_EQ(Range(0, 0), run.CharRangeToGlyphRange(Range(4, 5))); |
2286 EXPECT_EQ(Range(0, 0), run.GetGraphemeBounds(iter.get(), 4)); | 2287 EXPECT_EQ(Range(0, 0), run.GetGraphemeBounds(iter.get(), 4)); |
2287 Range chars; | 2288 Range chars; |
2288 Range glyphs; | 2289 Range glyphs; |
2289 run.GetClusterAt(4, &chars, &glyphs); | 2290 run.GetClusterAt(4, &chars, &glyphs); |
2290 EXPECT_EQ(Range(3, 8), chars); | 2291 EXPECT_EQ(Range(3, 8), chars); |
2291 EXPECT_EQ(Range(0, 0), glyphs); | 2292 EXPECT_EQ(Range(0, 0), glyphs); |
2292 } | 2293 } |
2293 | 2294 |
2294 } // namespace gfx | 2295 } // namespace gfx |
OLD | NEW |