Chromium Code Reviews| 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 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1607 }; | 1607 }; |
| 1608 | 1608 |
| 1609 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(large_content_cases); i++) { | 1609 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(large_content_cases); i++) { |
| 1610 render_text->SetHorizontalAlignment(large_content_cases[i].alignment); | 1610 render_text->SetHorizontalAlignment(large_content_cases[i].alignment); |
| 1611 render_text->SetDisplayOffset(large_content_cases[i].offset); | 1611 render_text->SetDisplayOffset(large_content_cases[i].offset); |
| 1612 EXPECT_EQ(large_content_cases[i].expected_offset, | 1612 EXPECT_EQ(large_content_cases[i].expected_offset, |
| 1613 render_text->GetUpdatedDisplayOffset().x()); | 1613 render_text->GetUpdatedDisplayOffset().x()); |
| 1614 } | 1614 } |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 // TODO(ckocagil): Enable for RenderTextHarfBuzz. http://crbug.com/396776 | 1617 // TODO(ckocagil): Enable for RenderTextHarfBuzz. http://crbug.com/396776 |
|
msw
2014/09/02 18:20:25
Can you remove this TODO now?
ckocagil
2014/09/03 01:22:29
Done.
| |
| 1618 TEST_F(RenderTextTest, SameFontForParentheses) { | 1618 TEST_F(RenderTextTest, SameFontForParentheses) { |
| 1619 struct { | 1619 struct { |
| 1620 const base::char16 left_char; | 1620 const base::char16 left_char; |
| 1621 const base::char16 right_char; | 1621 const base::char16 right_char; |
| 1622 } punctuation_pairs[] = { | 1622 } punctuation_pairs[] = { |
| 1623 { '(', ')' }, | 1623 { '(', ')' }, |
| 1624 { '{', '}' }, | 1624 { '{', '}' }, |
| 1625 { '<', '>' }, | 1625 { '<', '>' }, |
| 1626 }; | 1626 }; |
| 1627 struct { | 1627 struct { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1647 { WideToUTF16(L"Hello World(\x0915\x093f)Hello World") }, | 1647 { WideToUTF16(L"Hello World(\x0915\x093f)Hello World") }, |
| 1648 | 1648 |
| 1649 // Hebrew(English) | 1649 // Hebrew(English) |
| 1650 { WideToUTF16(L"\x05e0\x05b8(a)") }, | 1650 { WideToUTF16(L"\x05e0\x05b8(a)") }, |
| 1651 // Hebrew(English)Hebrew | 1651 // Hebrew(English)Hebrew |
| 1652 { WideToUTF16(L"\x05e0\x05b8(a)\x05e0\x05b8") }, | 1652 { WideToUTF16(L"\x05e0\x05b8(a)\x05e0\x05b8") }, |
| 1653 // English(Hebrew)English | 1653 // English(Hebrew)English |
| 1654 { WideToUTF16(L"Hello World(\x05e0\x05b8)Hello World") }, | 1654 { WideToUTF16(L"Hello World(\x05e0\x05b8)Hello World") }, |
| 1655 }; | 1655 }; |
| 1656 | 1656 |
| 1657 scoped_ptr<RenderText> render_text(RenderText::CreateNativeInstance()); | 1657 scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); |
| 1658 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { | 1658 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { |
| 1659 base::string16 text = cases[i].text; | 1659 base::string16 text = cases[i].text; |
| 1660 const size_t start_paren_char_index = text.find('('); | 1660 const size_t start_paren_char_index = text.find('('); |
| 1661 ASSERT_NE(base::string16::npos, start_paren_char_index); | 1661 ASSERT_NE(base::string16::npos, start_paren_char_index); |
| 1662 const size_t end_paren_char_index = text.find(')'); | 1662 const size_t end_paren_char_index = text.find(')'); |
| 1663 ASSERT_NE(base::string16::npos, end_paren_char_index); | 1663 ASSERT_NE(base::string16::npos, end_paren_char_index); |
| 1664 | 1664 |
| 1665 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(punctuation_pairs); ++j) { | 1665 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(punctuation_pairs); ++j) { |
| 1666 text[start_paren_char_index] = punctuation_pairs[j].left_char; | 1666 text[start_paren_char_index] = punctuation_pairs[j].left_char; |
| 1667 text[end_paren_char_index] = punctuation_pairs[j].right_char; | 1667 text[end_paren_char_index] = punctuation_pairs[j].right_char; |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2286 EXPECT_EQ(Range(0, 0), run.CharRangeToGlyphRange(Range(4, 5))); | 2286 EXPECT_EQ(Range(0, 0), run.CharRangeToGlyphRange(Range(4, 5))); |
| 2287 EXPECT_EQ(Range(0, 0), run.GetGraphemeBounds(iter.get(), 4)); | 2287 EXPECT_EQ(Range(0, 0), run.GetGraphemeBounds(iter.get(), 4)); |
| 2288 Range chars; | 2288 Range chars; |
| 2289 Range glyphs; | 2289 Range glyphs; |
| 2290 run.GetClusterAt(4, &chars, &glyphs); | 2290 run.GetClusterAt(4, &chars, &glyphs); |
| 2291 EXPECT_EQ(Range(3, 8), chars); | 2291 EXPECT_EQ(Range(3, 8), chars); |
| 2292 EXPECT_EQ(Range(0, 0), glyphs); | 2292 EXPECT_EQ(Range(0, 0), glyphs); |
| 2293 } | 2293 } |
| 2294 | 2294 |
| 2295 } // namespace gfx | 2295 } // namespace gfx |
| OLD | NEW |