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

Unified Diff: ui/gfx/text_elider_unittest.cc

Issue 354963003: Move gfx::ElideText functionality to RenderText. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and rebase. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/text_elider.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/text_elider_unittest.cc
diff --git a/ui/gfx/text_elider_unittest.cc b/ui/gfx/text_elider_unittest.cc
index 0b6bcad7f5af004fcd3201751679f7f89eab0fdd..92c47ce6873076588874d3ef477231f8d5e61667 100644
--- a/ui/gfx/text_elider_unittest.cc
+++ b/ui/gfx/text_elider_unittest.cc
@@ -302,17 +302,12 @@ TEST(TextEliderTest, MAYBE_ElideTextEllipsisFront) {
static void CheckSurrogatePairs(const base::string16& text,
base::char16 first_char,
base::char16 second_char) {
- size_t index = text.find_first_of(first_char);
- while (index != base::string16::npos) {
- EXPECT_LT(index, text.length() - 1);
- EXPECT_EQ(second_char, text[index + 1]);
- index = text.find_first_of(first_char, index + 1);
- }
- index = text.find_first_of(second_char);
- while (index != base::string16::npos) {
- EXPECT_GT(index, 0U);
- EXPECT_EQ(first_char, text[index - 1]);
- index = text.find_first_of(second_char, index + 1);
+ for (size_t index = 0; index < text.length(); ++index) {
+ EXPECT_NE(second_char, text[index]);
+ if (text[index] == first_char) {
+ ASSERT_LT(++index, text.length());
+ EXPECT_EQ(second_char, text[index]);
+ }
}
}
@@ -327,8 +322,7 @@ TEST(TextEliderTest, MAYBE_ElideTextSurrogatePairs) {
// The below is 'MUSICAL SYMBOL G CLEF', which is represented in UTF-16 as
// two characters forming a surrogate pair 0x0001D11E.
const std::string kSurrogate = "\xF0\x9D\x84\x9E";
- const base::string16 kTestString =
- UTF8ToUTF16(kSurrogate + "ab" + kSurrogate + kSurrogate + "cd");
+ const base::string16 kTestString = UTF8ToUTF16(kSurrogate + "x" + kSurrogate);
const float kTestStringWidth = GetStringWidthF(kTestString, font_list);
const base::char16 kSurrogateFirstChar = kTestString[0];
const base::char16 kSurrogateSecondChar = kTestString[1];
« no previous file with comments | « ui/gfx/text_elider.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698