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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1644 const int expected_width = render_text->GetStringSize().width(); | 1644 const int expected_width = render_text->GetStringSize().width(); |
| 1645 render_text->MoveCursorTo(SelectionModel(ui::Range(0, 1), CURSOR_FORWARD)); | 1645 render_text->MoveCursorTo(SelectionModel(ui::Range(0, 1), CURSOR_FORWARD)); |
| 1646 EXPECT_EQ(expected_width, render_text->GetStringSize().width()); | 1646 EXPECT_EQ(expected_width, render_text->GetStringSize().width()); |
| 1647 // Draw the text. It shouldn't hit any DCHECKs or crash. | 1647 // Draw the text. It shouldn't hit any DCHECKs or crash. |
| 1648 // See http://crbug.com/214150 | 1648 // See http://crbug.com/214150 |
| 1649 render_text->Draw(&canvas); | 1649 render_text->Draw(&canvas); |
| 1650 render_text->MoveCursorTo(SelectionModel(0, CURSOR_FORWARD)); | 1650 render_text->MoveCursorTo(SelectionModel(0, CURSOR_FORWARD)); |
| 1651 } | 1651 } |
| 1652 } | 1652 } |
| 1653 | 1653 |
| 1654 #if defined(OS_WIN) | |
| 1655 TEST_F(RenderTextTest, Win_BreakRunsByUnicodeBlocks) { | |
| 1656 const base::string16 kTestString = WideToUTF16(L"x\x25B6y"); | |
|
msw
2013/09/04 22:05:38
nit: Add another test case with spaces, like "x \x
ckocagil
2013/09/05 20:13:15
Done.
| |
| 1657 | |
| 1658 scoped_ptr<RenderTextWin> render_text( | |
| 1659 static_cast<RenderTextWin*>(RenderText::CreateInstance())); | |
| 1660 render_text->SetText(kTestString); | |
| 1661 render_text->EnsureLayout(); | |
| 1662 | |
| 1663 ASSERT_EQ(3U, render_text->runs_.size()); | |
| 1664 EXPECT_EQ(ui::Range(0, 1), render_text->runs_[0]->range); | |
| 1665 EXPECT_EQ(ui::Range(1, 2), render_text->runs_[1]->range); | |
| 1666 EXPECT_EQ(ui::Range(2, 3), render_text->runs_[2]->range); | |
| 1667 } | |
| 1668 #endif // !defined(OS_WIN) | |
| 1669 | |
| 1654 } // namespace gfx | 1670 } // namespace gfx |
| OLD | NEW |