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

Unified Diff: ui/base/text/text_elider_unittest.cc

Issue 10386016: Modify ui::ElideRectangleText() to honor trailing newlines. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
« base/string_util.cc ('K') | « ui/base/text/text_elider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/text/text_elider_unittest.cc
===================================================================
--- ui/base/text/text_elider_unittest.cc (revision 136913)
+++ ui/base/text/text_elider_unittest.cc (working copy)
@@ -530,6 +530,14 @@
{ "\nTest", test_width, line_height, true, "" },
{ "\n\nTest", test_width, line_height * 3, false, "||Test" },
{ "\n\nTest", test_width, line_height * 2, true, "|" },
+ { "Test\n", 2 * test_width, line_height * 5, false, "Test|" },
+ { "Test\n\n", 2 * test_width, line_height * 5, false, "Test||" },
+ { "Test\n\n\n", 2 * test_width, line_height * 5, false, "Test|||" },
+ { "Test\nTest\n\n", 2 * test_width, line_height * 5, false, "Test|Test||" },
+ { "Test\n\nTest\n", 2 * test_width, line_height * 5, false, "Test||Test|" },
+ { "Test\n\n\nTest", 2 * test_width, line_height * 5, false, "Test|||Test" },
+ { "Te ", test_width, line_height, false, "Te" },
+ { "Te Te Test", test_width, 3 * line_height, false, "Te|Te|Test" },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
@@ -541,10 +549,12 @@
cases[i].available_pixel_height,
TRUNCATE_LONG_WORDS,
&lines));
- if (cases[i].output)
- EXPECT_EQ(cases[i].output, UTF16ToUTF8(JoinString(lines, '|')));
- else
- EXPECT_TRUE(lines.empty());
+ if (cases[i].output) {
+ const std::string result = UTF16ToUTF8(JoinString(lines, '|'));
+ EXPECT_EQ(cases[i].output, result) << "Case " << i << " failed!";
+ } else {
+ EXPECT_TRUE(lines.empty()) << "Case " << i << " failed!";
+ }
}
}
@@ -579,10 +589,12 @@
cases[i].available_pixel_height,
wrap_behavior,
&lines));
- if (cases[i].output)
- EXPECT_EQ(cases[i].output, UTF16ToUTF8(JoinString(lines, '|')));
- else
- EXPECT_TRUE(lines.empty());
+ if (cases[i].output) {
+ const std::string result = UTF16ToUTF8(JoinString(lines, '|'));
+ EXPECT_EQ(cases[i].output, result) << "Case " << i << " failed!";
+ } else {
+ EXPECT_TRUE(lines.empty()) << "Case " << i << " failed!";
+ }
}
}
@@ -638,7 +650,8 @@
&lines);
std::string expected_output(cases[i].output);
ReplaceSubstringsAfterOffset(&expected_output, 0, "...", kEllipsis);
- EXPECT_EQ(expected_output, UTF16ToUTF8(JoinString(lines, '|')));
+ const std::string result = UTF16ToUTF8(JoinString(lines, '|'));
+ EXPECT_EQ(expected_output, result) << "Case " << i << " failed!";
}
}
« base/string_util.cc ('K') | « ui/base/text/text_elider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698