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

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

Issue 23857008: Re-land: "RenderTextWin: Break runs between any two characters that are not in the same code block" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/render_text_win.h » ('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 <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
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 scoped_ptr<RenderTextWin> render_text(
1657 static_cast<RenderTextWin*>(RenderText::CreateInstance()));
1658
1659 render_text->SetText(WideToUTF16(L"x\x25B6y"));
1660 render_text->EnsureLayout();
1661 ASSERT_EQ(3U, render_text->runs_.size());
1662 EXPECT_EQ(Range(0, 1), render_text->runs_[0]->range);
1663 EXPECT_EQ(Range(1, 2), render_text->runs_[1]->range);
1664 EXPECT_EQ(Range(2, 3), render_text->runs_[2]->range);
1665
1666 render_text->SetText(WideToUTF16(L"x \x25B6 y"));
1667 render_text->EnsureLayout();
1668 ASSERT_EQ(3U, render_text->runs_.size());
1669 EXPECT_EQ(Range(0, 2), render_text->runs_[0]->range);
1670 EXPECT_EQ(Range(2, 3), render_text->runs_[1]->range);
1671 EXPECT_EQ(Range(3, 5), render_text->runs_[2]->range);
1672
1673 }
1674 #endif // !defined(OS_WIN)
1675
1654 } // namespace gfx 1676 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698